chemaxon.calculations
Class ElementalAnalyser

java.lang.Object
  extended bychemaxon.calculations.ElementalAnalyser

public class ElementalAnalyser
extends java.lang.Object

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 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...
	}
 

Version:
1.0, 11/03/2002
Author:
Gyorgy Pirok

Constructor Summary
ElementalAnalyser()
           
 
Method Summary
 int atomCount()
          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.
 java.lang.String composition(int precision)
          Gets the elemental analysis, the relative percent composition of a pure chemical substance by element (w/w%).
 java.lang.String dotDisconnectedFormula()
          Gets the dot-disconnected molecular formula of a multifragment molecule.
 double exactMass()
          Calculates the weight of the MS molecule ion using the mass of the most frequent natural isotope for element atoms.
 java.lang.String formula()
          Gets the molecular formula.
 MoleculeGraph getMolecule()
          Retrieves the input molecule
 java.lang.String isotopeComposition(int precision)
          Gets the molecular composition (w/w%).
 java.lang.String isotopeFormula()
          Gets the molecular formula (isotopes are separated).
 double mass()
          Calculates the molecular weight of the molecule.
 void setMolecule(MoleculeGraph mol)
          Specifies a molecule to calculate with.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementalAnalyser

public ElementalAnalyser()
Method Detail

getMolecule

public MoleculeGraph getMolecule()
Retrieves the input molecule

Returns:
the molecule to calculate with

setMolecule

public void setMolecule(MoleculeGraph mol)
Specifies a molecule to calculate with.

Parameters:
mol - the molecule to calculate with

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.

Returns:
molecular weigth of the molecule

exactMass

public double exactMass()
Calculates the weight of the MS molecule ion using the mass of the most frequent natural isotope for element atoms.

Returns:
weight of the molecule ion

formula

public java.lang.String formula()
Gets the molecular formula.

Returns:
molecular formula

isotopeFormula

public java.lang.String isotopeFormula()
Gets the molecular formula (isotopes are separated).

Returns:
molecular formula

dotDisconnectedFormula

public java.lang.String dotDisconnectedFormula()
Gets the dot-disconnected molecular formula of a multifragment molecule.

Returns:
molecular formula
Since:
Marvin 4.0.5

composition

public java.lang.String composition(int precision)
Gets the elemental analysis, the relative percent composition of a pure chemical substance by element (w/w%).

Returns:
molecular composition

isotopeComposition

public java.lang.String isotopeComposition(int precision)
Gets the molecular composition (w/w%). Isotopes are separate atom types.

Returns:
molecular composition