Package chemaxon.calculations
Class ElementalAnalyser
java.lang.Object
chemaxon.calculations.ElementalAnalyser
Calculates molecular formula, mass, MS mass and composition.
API usage example:
ElementalAnalyser elemanal = new ElementalAnalyser(); // run plugin on target molecules MolImporter mi = new MolImporter(input.smiles); Molecule mol = null; while ((mol = mi.read()) != null) { // set target molecule elemanal.setMolecule(mol); double exactMass = elemanal.exactMass(); double mass = elemanal.mass(); int massPrecision = elemanal.massPrecision(); int atomCount1 = elemanal.atomCount(8); // oxygen atom count int atomCount2 = elemanal.atomCount(8, 0); // non-isotope oxygen count int atomCount3 = elemanal.atomCount(8, 16); // oxygen isotope count with massno=16 String formula = elemanal.formula(); String isotopeFormula = elemanal.isotopeFormula(); String composition = elemanal.composition(2); // precision=2 String isotopeComposition = elemanal.isotopeComposition(2); // precision=2 // now use the results... }
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Calculates the number of atoms in the molecule.int
atomCount
(int z) Calculates the number of atoms of a given element in the molecule (including its isotopes).int
atomCount
(int z, int m) Calculates the number of atoms of a given element in the molecule.composition
(int precision) Gets the elemental analysis, the relative percent composition of a pure chemical substance by element (w/w%).Calculates the dot-disconnected molecular formula of a multifragment molecule.Calculates the dot-disconnected isotope formula of a multifragment molecule.dotDisconnectedIsotopeFormula
(boolean symbolD) Calculates the dot-disconnected isotope formula of a multifragment molecule.double
Calculates the weight of the molecular ion measured in Mass Spectrometry using the mass of the most frequent natural isotope of the atoms.int
Calculates the precision of the monoisitopic weight (number of significant decimal digits).formula()
Calculates the molecular formula which is a string listing all atom types an their occurence in the molecule.formula
(int digits) Calculates a fixed digit sortable molecular formula.Retrieves the input moleculeisotopeComposition
(int precision) Gets the molecular composition (w/w%).isotopeComposition
(int precision, boolean symbolD) Gets the molecular composition (w/w%).Calculates the molecular formula (isotopes are separated).isotopeFormula
(boolean symbolD) Calculates the molecular formula (isotopes are separated).double
mass()
Calculates the molecular weight of the molecule.int
Calculates the precision of the molecular weight (number of decimal digits).void
setMolecule
(MoleculeGraph mol) Specifies a molecule to calculate with.void
setMolecule
(Smolecule mol) Deprecated, for removal: This API element is subject to removal in a future version.void
setMolecule
(String formula) Specifies a molecule to calculate with.
-
Constructor Details
-
ElementalAnalyser
public ElementalAnalyser()
-
-
Method Details
-
getSmolecule
Retrieves the input molecule- Returns:
- the molecule to calculate with
-
setMolecule
Specifies a molecule to calculate with.- Parameters:
formula
- the molecular formula to calculate with (e.g. C3H10, C6H11N3.2(HCl))- Throws:
IllegalArgumentException
- if the formula is invalid- Since:
- Marvin 5.3.2
-
setMolecule
Specifies a molecule to calculate with.- Parameters:
mol
- the molecule to calculate with
-
setMolecule
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void setMolecule(Smolecule mol) Deprecated, for removal: This API element is subject to removal in a future version.as of Marvin 6.0, replaced bysetMolecule(MoleculeGraph mol)
.Specifies a molecule to calculate with.- Parameters:
mol
- the molecule to calculate with- Since:
- Marvin 5.3, 04/29/2009
-
atomCount
public int atomCount()Calculates the number of atoms in the molecule.- Returns:
- number of atoms
-
atomCount
public int atomCount(int z) Calculates the number of atoms of a given element in the molecule (including its isotopes). included- Parameters:
z
- atomic number of the atom (protons)- Returns:
- number of the specified atoms
-
atomCount
public int atomCount(int z, int m) Calculates the number of atoms of a given element in the molecule. When m is 0, number of the given element atoms is returned, but its isotopes are not included- Parameters:
z
- atomic number of the atom (protons)m
- mass number of the atom (protons + neutrons)- Returns:
- number of the specified atoms
-
mass
public double mass()Calculates the molecular weight of the molecule. The result is rounded according to the decimals of the lowest precision atomic mass value.- Returns:
- molecular weigth of the molecule
-
massPrecision
public int massPrecision()Calculates the precision of the molecular weight (number of decimal digits).- Returns:
- the number of significant digits after the decimal point
-
exactMass
public double exactMass()Calculates the weight of the molecular ion measured in Mass Spectrometry using the mass of the most frequent natural isotope of the atoms.- Returns:
- weight of the molecule ion
-
exactMassPrecision
public int exactMassPrecision()Calculates the precision of the monoisitopic weight (number of significant decimal digits).- Returns:
- the number of significant digits after the decimal point
-
formula
Calculates the molecular formula which is a string listing all atom types an their occurence in the molecule. For example the formula of benzene is C6H6.- Returns:
- molecular formula
-
formula
Calculates a fixed digit sortable molecular formula. If the digits parameter is 4, then the formula of benzene will be "C0006H0006".- Parameters:
digits
- number of minimum digits- Returns:
- molecular formula
-
isotopeFormula
Calculates the molecular formula (isotopes are separated). For example, it returns C7D5NaO2 for the deuterated sodium benzoate.- Returns:
- isotope formula
-
isotopeFormula
Calculates the molecular formula (isotopes are separated). For example, it returns C7[2H]5NaO2 or C7D5NaO2 for the deuterated sodium benzoate depending on symbolD parameter.- Parameters:
symbolD
- uses the D symbol for Deuterium and T for Tritium if true, otherwise [2H] and [3H]- Returns:
- isotope formula
-
dotDisconnectedFormula
Calculates the dot-disconnected molecular formula of a multifragment molecule. For example, it returns C7H5O2.Na for sodium benzoate.- Returns:
- the dot diconnected formula of the molecule
- Since:
- Marvin 4.0.5
-
dotDisconnectedIsotopeFormula
Calculates the dot-disconnected isotope formula of a multifragment molecule. For example, it returns C7D5O2.Na for the deuterated sodium benzoate.- Returns:
- the dot diconnected isotope formula of the molecule
- Since:
- Marvin 5.0
-
dotDisconnectedIsotopeFormula
Calculates the dot-disconnected isotope formula of a multifragment molecule. For example, it returns C7[2H]5O2.Na or C7D5O2.Na for the deuterated sodium benzoate depending on symbolD parameter.- Parameters:
symbolD
- uses the D symbol for Deuterium and T for Tritium if true, otherwise [2H] and [3H]- Returns:
- the dot diconnected isotope formula of the molecule
- Since:
- Marvin 5.0
-
composition
Gets the elemental analysis, the relative percent composition of a pure chemical substance by element (w/w%).- Returns:
- molecular composition
-
isotopeComposition
Gets the molecular composition (w/w%). Isotopes are separate atom types.- Parameters:
precision
- number of decimal digits- Returns:
- molecular composition
-
isotopeComposition
Gets the molecular composition (w/w%). Isotopes are separate atom types.- Parameters:
precision
- number of decimal digitssymbolD
- uses the D symbol for Deuterium and T for Tritium if true, otherwise [2H] and [3H]- Returns:
- molecular composition
-
setMolecule(MoleculeGraph mol)
.