public class OxidationStateGuesser extends java.lang.Object implements Commandable, Options, java.io.Serializable
Works by finding all combinations non-zero oxidation states for each element, computing which are the most reasonable, and finding which of those have the minimum value of
Implemented Command
run <composition> -
Find all ionic compounds possible at this composition
Usage: [<oxidation states>] [<en>]
Prints a list of charges to the screen where the first is the most favored
based on the electronegative elements having the greatest charge.
Lookup tables must files where each line is contains either the allowed
oxidation states or electronegativity for each element. Lines must be ordered
by atomic number (H, He, ...). By default, looks in "./lookup-data/".
Constructor and Description |
---|
OxidationStateGuesser() |
Modifier and Type | Method and Description |
---|---|
java.util.List<int[]> |
getPossibleStates(CompositionEntry comp)
Get list of possible charge states.
|
protected java.lang.String |
printStates(int[] elems,
int[] charges)
Print out the elements and charges in a nice way.
|
java.lang.String |
printUsage()
Print out required format for options.
|
java.lang.Object |
runCommand(java.util.List<java.lang.Object> Command)
Process some command described by a list of Objects.
|
void |
setElectronegativity(double[] values)
Set the lookup table for electronegativity values.
|
void |
setElectronegativity(java.lang.String path)
Set the lookup table for electronegativity values.
|
void |
setOptions(java.util.List<java.lang.Object> Options)
Set any options for this object.
|
void |
setOxidationStates(double[][] states)
Set the oxidation states
|
void |
setOxidationStates(int[][] states)
Set the oxidation states
|
void |
setOxidationStates(java.lang.String path)
Set the oxidation states
|
public void setOptions(java.util.List<java.lang.Object> Options) throws java.lang.Exception
Options
setOptions
in interface Options
Options
- Array of options as Objects - can be null
java.lang.Exception
- if problem with inputspublic java.lang.String printUsage()
Options
printUsage
in interface Options
public void setElectronegativity(double[] values)
values
- Electronegativity for each element (ordered by Z)public void setElectronegativity(java.lang.String path) throws java.io.IOException
path
- Path to file containing electronegativity for each element, on lines
ordered by Z.java.io.IOException
public void setOxidationStates(int[][] states)
states
- Allowed oxidation states. Each row contains the allowed oxidation
states for each element (ordered by Z).public void setOxidationStates(double[][] states)
states
- Allowed oxidation states. Each row contains the allowed oxidation
states for each element (ordered by Z).public void setOxidationStates(java.lang.String path) throws java.lang.Exception
path
- Path to lookup file. Each line must contain the allowed oxidation
states for each element (ordered by Z).java.lang.Exception
public java.util.List<int[]> getPossibleStates(CompositionEntry comp)
comp
- Composition of allegedly ionic compoundOxidationStateGuesser
public java.lang.Object runCommand(java.util.List<java.lang.Object> Command) throws java.lang.Exception
Commandable
runCommand
in interface Commandable
Command
- Command as a list of objectsjava.lang.Exception
- If something goes wrongprotected java.lang.String printStates(int[] elems, int[] charges)
elems
- Element indices (Z-1)charges
- Oxidation state of each element