chemaxon.marvin.calculations
Class ConformerPlugin

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

public class ConformerPlugin
extends CalculatorPlugin

Plugin class for conformer calculation. Data types:

API usage example:

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

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

    // set target molecule
    plugin.setMolecule(mol);
    
    // set parameters for calculation
    plugin.setMaxNumberOfConformers(400);
    plugin.setTimelimit(900);

    // run the calculation
    plugin.run();

    // get results
    Molecule[] conformers = plugin.getConformers();
    int conformerCount = plugin.getConformerCount();
    Molecule m;
    for (int i = 0; i < conformerCount; ++i) {
    	m = conformers[i];   // same as m = plugin.getConformer(i);
    	// do something with molecule ...
    }

    // 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/07/2006
Version:
5.0.4, 04/25/2008
Author:
Zsolt Mohacsi

Field Summary
static int OPTIMIZATION_NORMAL
           
static int OPTIMIZATION_STRICT
           
static int OPTIMIZATION_VERY_LOOSE
           
static int OPTIMIZATION_VERY_STRICT
           
 
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
ConformerPlugin()
          Constructor.
 
Method Summary
 void checkMolecule(Molecule mol)
          Checks the input molecule.
 Molecule getConformer(int index)
          Returns a conformer.
 int getConformerCount()
          Returns the number of different conformers.
 Molecule[] getConformers()
          Returns all conformers in a Molecule[] array.
 double getEnergy()
          Returns the energy of the lowest energy conformer in kcal/mol.
 double getEnergy(int i)
          Returns the energy of the i-th conformer in kcal/mol.
 Molecule getLowestEnergyConformer()
          Returns the calculated lowest energy conformer.
 java.lang.Object getResult(java.lang.Object type, int index)
          Returns the result item for the specified key and index.
 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.
 chemaxon.marvin.plugin.PluginMDocSource getResultSource()
          Returns the result as a document source object.
 java.lang.Object[] getResultTypes()
          Returns the result types.
 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 there are no conformers, null otherwise.
 boolean handlesMultiFragmentMolecules()
          Returns true if the plugin handles multifragment molecules, false otherwise.
 boolean hasValidConformer()
          Returns true if the input molecule has a valid conformer (has a valid structure in 3D space).
 boolean isLicensed()
          Returns true if the plugin is licensed.
 boolean isMultiThreadedRunEnabled()
          For internal use only.
 boolean run()
          Runs the conformer calculation.
 void setDiversity(double limit)
          Sets the diversity limit for the calculation.
 void setHyperfine(boolean hyp)
          Sets the hyperfine option for calculation.
protected  void setInputMolecule(Molecule mol)
          Sets the input molecule.
 void setLowestEnergyConformerCalculation(boolean le)
          Switchs the lowest energy conformer calculation on/off.
 void setMaxNumberOfConformers(int n)
          Sets the maximum number of conformers to be calculated.
 void setOptimization(int optimization)
          Sets the optimization criteria for the calculation.
 void setParameters(java.util.Properties params)
          Sets the input parameters for the plugin.
 void setPrehydrogenize(boolean preH)
          Turns the prehydrogenization on/off.
 void setProgressMonitor(MProgressMonitor pmon)
          Sets a progress observer to be used in run() to display progress status.
 void setTimelimit(int sec)
          Sets the timelimit for the calculation.
 void standardize(Molecule mol)
          Prevents default standardization: does nothing.
 
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, getRemark, getResult, getResult, getResult, getResultAsRGB, getResultAsRGB, getResultAsString, getResultCount, getResultDomain, getResultMessage, getResultMolecule, getResultMolecules, getResultsAsRGB, getResultsAsRGB, getResultsAsString, getResultsAsString, isInputMoleculeAromatized, isMsCalc, isNegligibleResult, isOK, isRgrouped, loadClass, readAttribute, removeWhitespace, setDoublePrecision, setDoublePrecision, setDoublePrecision, setLicenseEnvironment, setMolecule, setMolecule, setMolecule, standardizeIonicGroups, standardizeNeutralGroups
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPTIMIZATION_VERY_LOOSE

public static final int OPTIMIZATION_VERY_LOOSE
See Also:
Constant Field Values

OPTIMIZATION_NORMAL

public static final int OPTIMIZATION_NORMAL
See Also:
Constant Field Values

OPTIMIZATION_STRICT

public static final int OPTIMIZATION_STRICT
See Also:
Constant Field Values

OPTIMIZATION_VERY_STRICT

public static final int OPTIMIZATION_VERY_STRICT
See Also:
Constant Field Values
Constructor Detail

ConformerPlugin

public ConformerPlugin()
Constructor.

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

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

setProgressMonitor

public void setProgressMonitor(MProgressMonitor pmon)
Sets a progress observer to be used in run() 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

setParameters

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

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

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

run

public boolean run()
            throws PluginException
Runs the conformer calculation.

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

setLowestEnergyConformerCalculation

public void setLowestEnergyConformerCalculation(boolean le)
Switchs the lowest energy conformer calculation on/off. If true lowest energy conformer calculation is done, if false conformers of the molecule are calculated.

Parameters:
le - switchs the lowest energy conformer calculation on/off

setMaxNumberOfConformers

public void setMaxNumberOfConformers(int n)
Sets the maximum number of conformers to be calculated. The number of calculated conformers is equal or lower then this number, and can be readed with method getConformerCount().

Parameters:
n - is the max number of conformers to be calculated
See Also:
getConformerCount()

setTimelimit

public void setTimelimit(int sec)
Sets the timelimit for the calculation.

Parameters:
sec - is the timelimit for the calculation

setDiversity

public void setDiversity(double limit)
Sets the diversity limit for the calculation. Diversity limit should be at least 0.1 (no upper limit).

Parameters:
limit - is the diversity limit for the calculation
Since:
Marvin 4.1.3

setOptimization

public void setOptimization(int optimization)
                     throws PluginException
Sets the optimization criteria for the calculation. Possible optimization values are:

Parameters:
optimization - is the optimization method for the calculation
Throws:
PluginException

setPrehydrogenize

public void setPrehydrogenize(boolean preH)
Turns the prehydrogenization on/off. If true prehydrogenization is done before calculation, if false no prehydrogenization is done before calculation.

Parameters:
preH - turns the prehydrogenization on/off

setHyperfine

public void setHyperfine(boolean hyp)
Sets the hyperfine option for calculation.

Parameters:
hyp - sets/unsets the hyperfine option for calculation

hasValidConformer

public boolean hasValidConformer()
                          throws PluginException
Returns true if the input molecule has a valid conformer (has a valid structure in 3D space). Otherwise returns false.

Returns:
true if the input molecule has a valid conformer
Throws:
PluginException

getLowestEnergyConformer

public Molecule getLowestEnergyConformer()
Returns the calculated lowest energy conformer.

Returns:
the lowest energy conformer

getEnergy

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

Returns:
the energy of the lowest energy conformer
Since:
Marvin 4.1.4 12/04/2006
See Also:
setLowestEnergyConformerCalculation(boolean)

getEnergy

public double getEnergy(int i)
Returns the energy of the i-th conformer in kcal/mol.

Returns:
the energy of the i-th conformer
Since:
Marvin 4.1.4 12/04/2006
See Also:
getConformerCount()

getResultSource

public chemaxon.marvin.plugin.PluginMDocSource getResultSource()
                                                        throws PluginException
Returns the result as a document source object. This is useful for displaying the molecules in a viewer dynamically as they become available instead of collecting all results before display.

Overrides:
getResultSource in class CalculatorPlugin
Returns:
the document source interface
Throws:
PluginException - on error
Since:
Marvin 5.0

getConformerCount

public int getConformerCount()
Returns the number of different conformers.

Returns:
the number of different conformers

getConformer

public Molecule getConformer(int index)
Returns a conformer.

Parameters:
index - is the conformer index
Returns:
the conformer

getConformers

public Molecule[] getConformers()
Returns all conformers in a Molecule[] array.

Returns:
all conformers

getResultTypes

public java.lang.Object[] getResultTypes()
Returns the 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

getResultDomain

public int getResultDomain(java.lang.Object type)
Returns the calculation domain.

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

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()

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()

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

getWarningMessage

public java.lang.String getWarningMessage()
Returns a warning message if there are no conformers, null otherwise.

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

standardize

public void standardize(Molecule mol)
Prevents default standardization: does nothing. ConformerPlugin does not need standardization.

Overrides:
standardize in class CalculatorPlugin
Parameters:
mol - is the molecule to be standardized

isMultiThreadedRunEnabled

public boolean isMultiThreadedRunEnabled()
For internal use only.

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