chemaxon.marvin.calculations
Class GeometryPlugin

java.lang.Object
  extended by chemaxon.marvin.plugin.CalculatorPlugin
      extended by chemaxon.marvin.calculations.GeometryPlugin
All Implemented Interfaces:
chemaxon.license.Licensable

public class GeometryPlugin
extends CalculatorPlugin

Plugin class for geometrical properties calculations. Data types:

API usage example:

    // read input molecule
    MolImporter mi = new MolImporter("test.mol");
    Molecule mol = mi.read();
    mi.close();

    // create plugin
    GeometryPlugin plugin = new GeometryPlugin();

    // set target molecule
    plugin.setMolecule(mol);
    
    // set parameters for calculation
    plugin.setCalculateForLEConformer("if2D");
    plugin.setCalculateEnergy(true); // sets the energy calculation
    plugin.setCalculateMoleculeProjections(true); // sets the calculation of molecule projections

    // run the calculation
    plugin.run();

    // get results
    double energy = plugin.getDreidingEnergy();
    double distance = plugin.getDistance(2,4);
    double angle = plugin.getAngle(4,2,6);
    int[] atoms = { 2, 1, 4, 6 };
    double dihedral = plugin.getDihedral(atoms);
    double hindrance = plugin.getStericHindrance(5); // steric hindrance of 5th atom
    double minimalProjectionArea = plugin.getMinimalProjectionArea();
    double maximalProjectionArea = plugin.getMaximalProjectionArea();
    double minimalProjectionRadius = plugin.getMinimalProjectionRadius();
    double maximalProjectionRadius = plugin.getMaximalProjectionRadius();

    // do something with the results ...
 

For concurrent plugin example applications using ChemAxon's concurrent framework, refer to the Concurrent plugin examples.

Since:
Marvin 4.1 02/21/2006
Version:
5.1, 07/28/2008
Author:
Zsolt Mohacsi

Field Summary
 
Fields inherited from class chemaxon.marvin.plugin.CalculatorPlugin
ATOM, BLUE, CALCRGB_OFF, COVALENT_HYDRATION_ERROR_REMARK, CRITICAL_ERROR_MSG, EPSILON, INCORRECT_AROMATIC_NITROGEN_REMARK, INSTABLE_TAUTOMERIC_FORM_REMARK, licenseEnvironment, MOLECULE, NAN, PLUGIN_CLASS_KEY, PLUGIN_DIR, RED
 
Constructor Summary
GeometryPlugin()
          Constructor.
 
Method Summary
 void checkMolecule(Molecule mol)
          Checks the input molecule.
 double getAngle(int[] atoms)
          Returns the angle of 3 atoms.
 double getAngle(int atom1, int atom2, int atom3)
          Returns the angle of 3 atoms.
 double getDihedral(int[] atoms)
          Returns the dihedral of 4 atoms.
 double getDihedral(int atom1, int atom2, int atom3, int atom4)
          Returns the dihedral of 4 atoms.
 double getDistance(int[] atoms)
          Returns the distance of 2 atoms.
 double getDistance(int atom1, int atom2)
          Returns the distance of 2 atoms.
 double getDreidingEnergy()
          Returns the energy of the conformer in kcal/mol.
 Molecule getLowestEnergyConformer()
          Returns the lowest energy conformer of the molecule.
 double getMaximalProjectionArea()
          Returns the maximal projection area in Angstrom^2.
 double getMaximalProjectionRadius()
          Returns the radius of the circle surrounding the maximal projection in Angstrom.
 double getMinimalProjectionArea()
          Returns the minimal projection area in Angstrom^2.
 double getMinimalProjectionRadius()
          Returns the radius of the circle surrounding the minimal projection in Angstrom.
 java.lang.String getRemark()
          Returns the calculation remark: if no results (no result types) then returns remark, otherwise returns null.
 java.lang.Object getResult(java.lang.Object type, int index)
          Returns the result item for the specified key and index.
 java.lang.Object getResult(java.lang.Object type, java.lang.String arg)
          Returns the distance, angle or dihedral of 2, 3 or 4 atoms if type is set to "distance", "angle" or "diheral".
 java.lang.String getResultAsString(java.lang.Object type, int index, java.lang.Object result)
          Returns the specified result in String format.
 int getResultCount(java.lang.Object type)
          Returns the number of result items for the given result key.
 int getResultDomain(java.lang.Object type)
          Returns the calculation domain CalculatorPlugin.ATOM or CalculatorPlugin.MOLECULE.
 Molecule getResultMolecule()
          Returns the result molecule for display.
 Molecule[] getResultMolecules()
          Returns the result molecules, molecular results are set in the first molecule, atomic results are set in subsequent molecules as atom labels.
 java.lang.Object[] getResultTypes()
          Returns the result types.
 double getStericHindrance(int atom)
          Calculates hindrance of an atom from covalent radii values and distances.
 java.lang.String getTypeString(java.lang.Object type)
          Returns a string representation of the given type.
 java.lang.String getWarningMessage()
          Returns a warning message if lowest energy conformer calculation was unsuccessful or aborted by user, null otherwise.
 boolean handlesMultiFragmentMolecules()
          Returns true if the plugin handles multifragment molecules, false otherwise.
 boolean isLicensed()
          Returns true if the plugin is licensed.
 boolean isMultiThreadedRunEnabled()
          For internal use only.
 boolean run()
          Runs the tool.
 void setCalculateEnergy(boolean e)
          Sets the calculation of dreiding energy.
 void setCalculateForLEConformer(java.lang.String condition)
          Sets the condition for lowest energy conformer calcuation before geometry calculations are processed.
 void setCalculateMoleculeProjections(boolean c)
          Sets the calculation of molecule projections.
protected  void setInputMolecule(Molecule mol)
          Sets the input molecule.
 void setOptimization(int opt)
          Sets the optimization criteria for lowest energy conformer calculation.
 void setParameters(java.util.Properties params)
          Sets the input parameters for the plugin.
 void setProgressMonitor(MProgressMonitor pmon)
          Sets a progress observer to be used to display progress status.
 void setRadiusScaleFactor(double sc)
          Sets the atomic radius scale factor.
 
Methods inherited from class chemaxon.marvin.plugin.CalculatorPlugin
checkType, containsCoordinateBond, containsMulticenterSgroup, containsPseudoAtom, containsSRUSgroup, create, createModifiedInputMolecule, createStandardizedMolecule, createStandardizedMolecule, dehydrogenize, format, format, format, format, getAtomCount, getAtomIndex, getCalcMolecule, getDisplayMolecule, getDocument, getDoublePrecision, getErrorMessage, getInputMolDim, getMainMolecule, getpH, getPluginResource, getResult, getResult, getResultAsRGB, getResultAsRGB, getResultAsString, getResultCount, getResultDomain, getResultMessage, getResultsAsRGB, getResultsAsRGB, getResultsAsString, getResultsAsString, getResultSource, isInputMoleculeAromatized, isMsCalc, isNegligibleResult, isOK, isRgrouped, loadClass, readAttribute, removeWhitespace, setDoublePrecision, setDoublePrecision, setDoublePrecision, setLicenseEnvironment, setMolecule, setMolecule, setMolecule, standardize, standardizeIonicGroups, standardizeNeutralGroups
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeometryPlugin

public GeometryPlugin()
Constructor. Creates the geometry analyser object.

Method Detail

isLicensed

public boolean isLicensed()
Description copied from class: CalculatorPlugin
Returns true if the plugin is licensed. Implement this only if you want to sell your plugin and protect it with a license key. The default implementation always returns true which means that the plugin is free: no license key is required. This method returns only information about the licensing, license checking has to be implemented separately.

Specified by:
isLicensed in interface chemaxon.license.Licensable
Overrides:
isLicensed in class CalculatorPlugin
Returns:
true if the plugin is licensed

setParameters

public void setParameters(java.util.Properties params)
                   throws PluginException
Sets the input parameters for the plugin. Parameters:

Overrides:
setParameters in class CalculatorPlugin
Parameters:
params - is the parameter table
Throws:
PluginException - on error

setProgressMonitor

public void setProgressMonitor(MProgressMonitor pmon)
Sets a progress observer to be used to display progress status. Short calculations may ignore the observer object. The default implementation does nothing.

Overrides:
setProgressMonitor in class CalculatorPlugin
Parameters:
pmon - is the progress observer object, may be null

handlesMultiFragmentMolecules

public boolean handlesMultiFragmentMolecules()
Returns true if the plugin handles multifragment molecules, false otherwise. In the latter case the plugin takes the fragment with more atoms if a multifragment molecule is given as input.

Overrides:
handlesMultiFragmentMolecules in class CalculatorPlugin
Returns:
true if the plugin handles multifragment molecules, false otherwise

checkMolecule

public void checkMolecule(Molecule mol)
                   throws PluginException
Checks the input molecule. Throws exception if the molecule is RxnMolecule or if the molecule contains R-groups.

Overrides:
checkMolecule in class CalculatorPlugin
Parameters:
mol - is the input molecule
Throws:
PluginException - with error message for the user if the molecule is refused

setInputMolecule

protected void setInputMolecule(Molecule mol)
                         throws PluginException
Sets the input molecule.

Specified by:
setInputMolecule in class CalculatorPlugin
Parameters:
mol - is the input molecule
Throws:
PluginException - on error

setCalculateEnergy

public void setCalculateEnergy(boolean e)
Sets the calculation of dreiding energy.


setCalculateForLEConformer

public void setCalculateForLEConformer(java.lang.String condition)
Sets the condition for lowest energy conformer calcuation before geometry calculations are processed. Possible values:

Parameters:
condition - is the condition for lowest energy conformer calculation

setOptimization

public void setOptimization(int opt)
Sets the optimization criteria for lowest energy conformer calculation.

Parameters:
opt - is the optimization limit for the calculation

getLowestEnergyConformer

public Molecule getLowestEnergyConformer()
Returns the lowest energy conformer of the molecule.

Returns:
the lowest energy conformer

getDreidingEnergy

public double getDreidingEnergy()
Returns the energy of the conformer in kcal/mol.

Returns:
the energy of the conformer

getDistance

public double getDistance(int atom1,
                          int atom2)
Returns the distance of 2 atoms.

Parameters:
atom1 - is the (1-based) index of the 1st atom
atom2 - is the (1-based) index of the 2nd atom
Returns:
the distance of 2 atoms

getDistance

public double getDistance(int[] atoms)
                   throws PluginException
Returns the distance of 2 atoms.

Parameters:
atoms - is the array containing (1-based) indexes of 2 atoms
Returns:
the distance of 2 atoms
Throws:
PluginException

getAngle

public double getAngle(int atom1,
                       int atom2,
                       int atom3)
Returns the angle of 3 atoms.

Parameters:
atom1 - is the (1-based) index of the 1st atom
atom2 - is the (1-based) index of the 2nd atom
atom3 - is the (1-based) index of the 3rd atom
Returns:
the angle of 3 atoms

getAngle

public double getAngle(int[] atoms)
                throws PluginException
Returns the angle of 3 atoms.

Parameters:
atoms - is the array containing (1-based) indexes of 3 atoms
Returns:
the angle of 3 atoms
Throws:
PluginException

getDihedral

public double getDihedral(int atom1,
                          int atom2,
                          int atom3,
                          int atom4)
Returns the dihedral of 4 atoms.

Parameters:
atom1 - is the (1-based) index of the 1st atom
atom2 - is the (1-based) index of the 2nd atom
atom3 - is the (1-based) index of the 3rd atom
atom4 - is the (1-based) index of the 4th atom
Returns:
the dihedral of 4 atoms

getDihedral

public double getDihedral(int[] atoms)
                   throws PluginException
Returns the dihedral of 4 atoms.

Parameters:
atoms - is the array containing (1-based) indexes of 4 atoms
Returns:
the dihedral of 4 atoms
Throws:
PluginException

getStericHindrance

public double getStericHindrance(int atom)
Calculates hindrance of an atom from covalent radii values and distances. The stericHindrance is related to the steric hindrance of the given atom.

Parameters:
atom - index of the atom
Returns:
the steric hindrance of the atom

setCalculateMoleculeProjections

public void setCalculateMoleculeProjections(boolean c)
Sets the calculation of molecule projections. Default: false

Parameters:
c - if true then molecule projection calculations are run.
See Also:
getMinimalProjectionArea(), getMaximalProjectionArea(), getMinimalProjectionRadius(), getMaximalProjectionRadius()

getMinimalProjectionArea

public double getMinimalProjectionArea()
Returns the minimal projection area in Angstrom^2.

Returns:
the minimal projection area
See Also:
setCalculateMoleculeProjections(boolean)

getMaximalProjectionArea

public double getMaximalProjectionArea()
Returns the maximal projection area in Angstrom^2.

Returns:
the maximal projection area
See Also:
setCalculateMoleculeProjections(boolean)

getMinimalProjectionRadius

public double getMinimalProjectionRadius()
Returns the radius of the circle surrounding the minimal projection in Angstrom.

Returns:
the radius of the circle surrounding the minimal projection
See Also:
setCalculateMoleculeProjections(boolean)

getMaximalProjectionRadius

public double getMaximalProjectionRadius()
Returns the radius of the circle surrounding the maximal projection in Angstrom.

Returns:
the radius of the circle surrounding the maximal projection
See Also:
setCalculateMoleculeProjections(boolean)

setRadiusScaleFactor

public void setRadiusScaleFactor(double sc)
Sets the atomic radius scale factor. The scale factor is used in molecule projection calculations. Default: 1.0

Parameters:
sc - is the scale factor

run

public boolean run()
            throws PluginException
Runs the tool.

Specified by:
run in class CalculatorPlugin
Returns:
true if the calculation was successful, false if unsuccesful
Throws:
PluginException - on error
See Also:
CalculatorPlugin.getErrorMessage()

getResult

public java.lang.Object getResult(java.lang.Object type,
                                  int index)
                           throws PluginException
Returns the result item for the specified key and index.

Overrides:
getResult in class CalculatorPlugin
Parameters:
type - is the result type
index - is the result index
Returns:
the result item for the specified key and index
Throws:
PluginException - if the result cannot be returned
See Also:
CalculatorPlugin.getResultTypes()

getResult

public java.lang.Object getResult(java.lang.Object type,
                                  java.lang.String arg)
                           throws PluginException
Returns the distance, angle or dihedral of 2, 3 or 4 atoms if type is set to "distance", "angle" or "diheral". For internal use only.

Overrides:
getResult in class CalculatorPlugin
Parameters:
type - is the result type ("distance", "angle" or "dihedral")
arg - is the atom string as atom1-atom2 (e.g. "2-3")
Returns:
the result item
Throws:
PluginException - on error
See Also:
CalculatorPlugin.getResultTypes()

getResultAsString

public java.lang.String getResultAsString(java.lang.Object type,
                                          int index,
                                          java.lang.Object result)
                                   throws PluginException
Returns the specified result in String format.

Overrides:
getResultAsString in class CalculatorPlugin
Parameters:
type - is the result type
index - is the result index
result - is the result item
Returns:
the specified result in String format
Throws:
PluginException - if an invalid result item is given

getResultCount

public int getResultCount(java.lang.Object type)
Returns the number of result items for the given result key.

Overrides:
getResultCount in class CalculatorPlugin
Parameters:
type - is the result type
Returns:
the number of result items
See Also:
getResultTypes()

getResultDomain

public int getResultDomain(java.lang.Object type)
Returns the calculation domain CalculatorPlugin.ATOM or CalculatorPlugin.MOLECULE.

Overrides:
getResultDomain in class CalculatorPlugin
Parameters:
type - is the result key
Returns:
the calculation domain
See Also:
getResultTypes()

getResultTypes

public java.lang.Object[] getResultTypes()
Returns the result types. Possible result types:

Overrides:
getResultTypes in class CalculatorPlugin
Returns:
the result types

getTypeString

public java.lang.String getTypeString(java.lang.Object type)
Returns a string representation of the given type.

Overrides:
getTypeString in class CalculatorPlugin
Parameters:
type - is the type object
Returns:
the type string

getResultMolecule

public Molecule getResultMolecule()
                           throws PluginException
Returns the result molecule for display. Atomic results are stored in atom extra labels (MolAtom.getExtraLabel()). Molecular results are stored in molecule properties with keys being the result types (Molecule.getProperty(String)).

Overrides:
getResultMolecule in class CalculatorPlugin
Returns:
the result molecule
Throws:
PluginException - on error

getResultMolecules

public Molecule[] getResultMolecules()
                              throws PluginException
Returns the result molecules, molecular results are set in the first molecule, atomic results are set in subsequent molecules as atom labels.

Overrides:
getResultMolecules in class CalculatorPlugin
Returns:
the result molecules
Throws:
PluginException - on error

getRemark

public java.lang.String getRemark()
Returns the calculation remark: if no results (no result types) then returns remark, otherwise returns null.

Overrides:
getRemark in class CalculatorPlugin
Returns:
the calculation remark

getWarningMessage

public java.lang.String getWarningMessage()
Returns a warning message if lowest energy conformer calculation was unsuccessful or aborted by user, null otherwise.

Overrides:
getWarningMessage in class CalculatorPlugin
Returns:
a warning message if conformercalculation aborted

isMultiThreadedRunEnabled

public boolean isMultiThreadedRunEnabled()
For internal use only.

Overrides:
isMultiThreadedRunEnabled in class CalculatorPlugin
Returns:
true if multi-threaded run is enabled