Package chemaxon.marvin.calculations
Class GeometryPlugin
java.lang.Object
chemaxon.marvin.plugin.CalculatorPlugin
chemaxon.marvin.calculations.GeometryPlugin
- All Implemented Interfaces:
TaggedCalculator,chemaxon.license.Licensable
Plugin class for geometric properties calculations. Data types:
- "dreidingenergy"
- "distance"
- "angle"
- "dihedral"
- "hindrance",
- "minimalprojectionarea"
- "maximalprojectionarea"
- "minimalprojectionradius"
- "maximalprojectionradius"
- "volume",
- "minz",
- "maxz",
API usage example:
try (MolImporter mi = new MolImporter("test.mol")) {
// read input molecule
Molecule mol = mi.read();
// 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
-
Nested Class Summary
Nested classes/interfaces inherited from class chemaxon.marvin.plugin.CalculatorPlugin
CalculatorPlugin.HydrogenData -
Field Summary
Fields inherited from class chemaxon.marvin.plugin.CalculatorPlugin
ATOM, BLUE, CALCRGB_OFF, COVALENT_HYDRATION_ERROR_REMARK, CRITICAL_ERROR_MSG, EPSILON, explicitHydrogens, INCORRECT_AROMATIC_NITROGEN_REMARK, INSTABLE_TAUTOMERIC_FORM_REMARK, KEEP_HYDROGENS, keepHydrogens, licenseEnvironment, MOLECULE, MOLECULES, NAN, PLUGIN_CLASS_KEY, PLUGIN_DIR, RED, TRUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckMolecule(Molecule mol) Checks the input molecule.doublegetAngle(int[] atoms) Returns the angle of 3 atoms.doublegetAngle(int atom1, int atom2, int atom3) Returns the angle of 3 atoms.doublegetDihedral(int[] atoms) Returns the dihedral of 4 atoms.doublegetDihedral(int atom1, int atom2, int atom3, int atom4) Returns the dihedral of 4 atoms.doublegetDistance(int[] atoms) Returns the distance of 2 atoms.doublegetDistance(int atom1, int atom2) Returns the distance of 2 atoms.doubleReturns the energy of the conformer.int[]getHBond(int bondIndex) Returns a hydrogen bond.intReturns the number of intramolecular hydrogen bonds.Returns the lowest energy conformer of the molecule.doubleReturns the maximal projection area in Angstrom^2.doubleReturns the radius of the circle surrounding the maximal projection in Angstrom.doublegetMaxZ()doubleReturns the minimal projection area in Angstrom^2.doubleReturns the radius of the circle surrounding the minimal projection in Angstrom.doublegetMinZ()doubleReturns the MMFF94 energy of the structure (default: kcal/mol).Returns the product identifier of the plugin as given byLicenseManager.Returns the calculation remark: if no results (no result types) then returns remark, otherwise returnsnull.Returns the result item for the specified key and index.Deprecated, for removal: This API element is subject to removal in a future version.Some implementations of this method modify the state of the plugin, which is a very confusing behavior, so the method is now deprecated and should no longer be used.getResultAsString(Object type, int index, Object result) Returns the specified result in String format.intgetResultCount(Object type) Returns the number of result items for the given result key.intgetResultDomain(Object type) Returns the calculation domainCalculatorPlugin.ATOMorCalculatorPlugin.MOLECULE.Returns the result molecule for display.Molecule[]Returns the result molecules, molecular results are set in the first molecule, atomic results are set in subsequent molecules as atom labels.Object[]Returns the result types.doublegetStericHindrance(int atom) Calculates hindrance of an atom from covalent radii values and distances.getTypeString(Object type) Returns a string representation of the given type.doubleReturns a warning message if lowest energy conformer calculation was unsuccessful or aborted by user,nullotherwise.booleanReturnstrueif the plugin handles multifragment molecules,falseotherwise.booleanFor internal use only.booleanrun()Runs the tool.voidsetCalculateEnergy(boolean e) Sets the calculation of dreiding energy.voidsetCalculateForLEConformer(String condition) Sets the condition for lowest energy conformer calculation before geometry calculations are processed.voidsetCalculateMMFF94Energy(boolean mmffe) Sets the calculation of MMFF94 energy.voidsetCalculateMoleculeProjections(boolean c) Sets the calculation of molecule projections.voidsetCalculateVolume(boolean calculateVolume) protected voidDeprecated.For internal use only.protected voidsetInputMolecule(Molecule mol) Sets the input molecule.voidSets license environment to be stored.voidsetMMFF94Optimization(boolean opt) Sets MMFF94 optimization.voidsetOptimization(int opt) Sets the optimization criteria for lowest energy conformer calculation.voidsetOptimizeProjection(boolean optimize) voidsetParameters(Properties params) Sets the input parameters for the plugin.voidSets a progress observer to be used to display progress status.voidstandardize(Molecule mol) Expands sgroups.tags()Returns the set of tags reported by this calculator.Methods inherited from class chemaxon.marvin.plugin.CalculatorPlugin
addHeavyAtomLimitChecker, addInputChecker, arrangeHydrogenIncerments, canRepeat, checkLicense, checkType, containsCoordinateBond, containsMulticenterSgroup, containsPseudoAtom, containsSRUSgroup, create, create, createModifiedInputMolecule, createStandardizedMolecule, createStandardizedMolecule, dehydrogenize, format, format, format, format, getAtomCount, getAtomIndex, getAtomIndexMap, getAtomIndexMapping, getCalcMolecule, getDisplayMolecule, getDocument, getDoublePrecision, getErrorMessage, getExplicitHydrogenData, getInputMolDim, getMainMolecule, getOriginalMolecule, getpH, getPluginResource, getQueryMoleculeErrorMessage, getResult, getResult, getResultAsRGB, getResultAsRGB, getResultAsString, getResultCount, getResultDomain, getResultMessage, getResultsAsRGB, getResultsAsRGB, getResultsAsString, getResultsAsString, getResultSource, isInputMoleculeAromatized, isLicensed, isMsCalc, isNegligibleResult, isOK, isRgrouped, loadClass, loadPluginClass, loadPluginClass, readAttribute, removeWhitespace, restoreExplicitHydrogens, setAtomIndexMap, setChemicalTermsParameters, setDoublePrecision, setDoublePrecision, setDoublePrecision, setKeepHydrogens, setMolecule, setMolecule, setMolecule, setMolecule, standardizeIonicGroups
-
Constructor Details
-
GeometryPlugin
public GeometryPlugin()Constructor.
-
-
Method Details
-
getProductName
Returns the product identifier of the plugin as given byLicenseManager.- Specified by:
getProductNamein classCalculatorPlugin- Returns:
- The identifier
LicenseManager.GEOMETRY_PLUGIN_GROUP
-
setParameters
Sets the input parameters for the plugin. Parameters:- type: result types, separated by ',', possible values:
- "dreidingenergy",
- "mmff94energy",
- "distance" (atomic)
- "angle" (atomic)
- "dihedral" (atomic)
- "hindrance" (atomic)
- "minimalprojectionarea"
- "maximalprojectionarea"
- "minimalprojectionradius"
- "maximalprojectionradius"
- "volume",
- "minz",
- "maxz",
- atoms: <atom1-...-atomn> valid for
type="distance"(n=2),"angle"(n=3) and"dihedral"(n=4) calculations only, sets the atoms used bycxcalc, for internal use only; API usage: callgetDistance(int, int)orgetDistance(int[]). - optimizeprojection: [true|false] sets projection optimization (default: false)
- Overrides:
setParametersin classCalculatorPlugin- Parameters:
params- is the parameter table- Throws:
PluginException- on error
- type: result types, separated by ',', possible values:
-
setChemicalTermsArgument
Deprecated.For internal use only.Sets the argument string as specified in Chemical Terms expressions.- Overrides:
setChemicalTermsArgumentin classCalculatorPlugin- Parameters:
arg- is the atom string as atom1-atom2 (e.g. "2-3")- Throws:
PluginException- on error
-
setProgressMonitor
Sets a progress observer to be used to display progress status. Short calculations may ignore the observer object. The default implementation does nothing.- Overrides:
setProgressMonitorin classCalculatorPlugin- Parameters:
pmon- is the progress observer object, may benull
-
setCalculateVolume
public void setCalculateVolume(boolean calculateVolume) -
handlesMultiFragmentMolecules
public boolean handlesMultiFragmentMolecules()Returnstrueif the plugin handles multifragment molecules,falseotherwise. In the latter case the plugin takes the fragment with more atoms if a multifragment molecule is given as input.- Overrides:
handlesMultiFragmentMoleculesin classCalculatorPlugin- Returns:
- true if the plugin handles multifragment molecules, false otherwise
-
checkMolecule
Checks the input molecule. Throws exception if the molecule isRxnMoleculeor if the molecule contains R-groups.- Overrides:
checkMoleculein classCalculatorPlugin- Parameters:
mol- is the input molecule- Throws:
PluginException- with error message for the user if the molecule is refused
-
setInputMolecule
Sets the input molecule.- Specified by:
setInputMoleculein classCalculatorPlugin- Parameters:
mol- is the input molecule- Throws:
PluginException- on error
-
setCalculateEnergy
public void setCalculateEnergy(boolean e) Sets the calculation of dreiding energy.- Parameters:
e- iftruethen dreiding energy is calculated
-
setCalculateMMFF94Energy
public void setCalculateMMFF94Energy(boolean mmffe) Sets the calculation of MMFF94 energy.- Parameters:
mmffe- iftruethen MMFF94 energy is calculated- Since:
- Marvin 5.4
- See Also:
-
setMMFF94Optimization
public void setMMFF94Optimization(boolean opt) Sets MMFF94 optimization.- Parameters:
opt- iftruethen MMFF94 optimization is performed- Since:
- Marvin 5.4
- See Also:
-
setCalculateForLEConformer
Sets the condition for lowest energy conformer calculation before geometry calculations are processed.Possible values:
- "if2D" - if molecule is in 2D
- "never" - never, always use the input molecule for calculations
- "always" - always calculate with the lowest energy conformer
- 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
Returns the lowest energy conformer of the molecule.- Returns:
- the lowest energy conformer
-
setLicenseEnvironment
Description copied from class:CalculatorPluginSets license environment to be stored.- Specified by:
setLicenseEnvironmentin interfacechemaxon.license.Licensable- Overrides:
setLicenseEnvironmentin classCalculatorPlugin- Parameters:
env- environment String to be stored and passed to the LicenseHandler in the isLicensed method
-
getDreidingEnergy
public double getDreidingEnergy()Returns the energy of the conformer.- Returns:
- the energy of the conformer
-
getMMFF94Energy
public double getMMFF94Energy()Returns the MMFF94 energy of the structure (default: kcal/mol).- Returns:
- the MMFF94 energy of the conformer
- Since:
- Marvin 5.4
-
getDistance
public double getDistance(int atom1, int atom2) Returns the distance of 2 atoms.- Parameters:
atom1- is the (0-based) index of the 1st atomatom2- is the (0-based) index of the 2nd atom- Returns:
- the distance of 2 atoms
-
getDistance
Returns the distance of 2 atoms.- Parameters:
atoms- is the array containing (0-based) indexes of 2 atoms- Returns:
- the distance of 2 atoms
- Throws:
PluginException- if atoms are not set properly
-
getAngle
public double getAngle(int atom1, int atom2, int atom3) Returns the angle of 3 atoms.- Parameters:
atom1- is the (0-based) index of the 1st atomatom2- is the (0-based) index of the 2nd atomatom3- is the (0-based) index of the 3rd atom- Returns:
- the angle of 3 atoms
-
getAngle
Returns the angle of 3 atoms.- Parameters:
atoms- is the array containing (0-based) indexes of 3 atoms- Returns:
- the angle of 3 atoms
- Throws:
PluginException- if atoms are not set properly
-
getDihedral
public double getDihedral(int atom1, int atom2, int atom3, int atom4) Returns the dihedral of 4 atoms.- Parameters:
atom1- is the (0-based) index of the 1st atomatom2- is the (0-based) index of the 2nd atomatom3- is the (0-based) index of the 3rd atomatom4- is the (0-based) index of the 4th atom- Returns:
- the dihedral of 4 atoms
-
getDihedral
Returns the dihedral of 4 atoms.- Parameters:
atoms- is the array containing (0-based) indexes of 4 atoms- Returns:
- the dihedral of 4 atoms
- Throws:
PluginException- if atoms are not set properly
-
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- iftruethen molecule projection calculations are run.- See Also:
-
getMinimalProjectionArea
public double getMinimalProjectionArea()Returns the minimal projection area in Angstrom^2.- Returns:
- the minimal projection area
- See Also:
-
getMaximalProjectionArea
public double getMaximalProjectionArea()Returns the maximal projection area in Angstrom^2.- Returns:
- the maximal projection area
- See Also:
-
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:
-
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:
-
getVolume
public double getVolume() -
setOptimizeProjection
public void setOptimizeProjection(boolean optimize) -
getHBondCount
public int getHBondCount()Returns the number of intramolecular hydrogen bonds.- Returns:
- the number of intramolecular hydrogen bonds
-
getHBond
public int[] getHBond(int bondIndex) Returns a hydrogen bond.- Parameters:
bondIndex- is the hydrogen bond index- Returns:
- the end-atom indexes of the hydrogen bond
in a 2-length
int[]array
-
run
Runs the tool.- Specified by:
runin classCalculatorPlugin- Returns:
- true if the calculation was successful, false if unsuccessful
- Throws:
PluginException- on error- See Also:
-
getResult
Returns the result item for the specified key and index.- Overrides:
getResultin classCalculatorPlugin- Parameters:
type- is the result typeindex- is the result index- Returns:
- the result item for the specified key and index
- Throws:
PluginException- if the result cannot be returned- See Also:
-
getMaxZ
public double getMaxZ() -
getMinZ
public double getMinZ() -
getResult
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public Object getResult(Object type, String arg) throws PluginException Deprecated, for removal: This API element is subject to removal in a future version.Some implementations of this method modify the state of the plugin, which is a very confusing behavior, so the method is now deprecated and should no longer be used. If you used this method with an index argument, parse the index instead, and callgetResult(Object, int). Otherwise, call the appropriate setter method of the plugin to configure it with the argument, and callgetResult(Object, int)with a 0 index.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:
getResultin classCalculatorPlugin- 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:
-
getResultAsString
Returns the specified result in String format.- Overrides:
getResultAsStringin classCalculatorPlugin- Parameters:
type- is the result typeindex- is the result indexresult- is the result item- Returns:
- the specified result in String format
- Throws:
PluginException- if an invalid result item is given
-
getResultCount
Returns the number of result items for the given result key.- Overrides:
getResultCountin classCalculatorPlugin- Parameters:
type- is the result type- Returns:
- the number of result items
- See Also:
-
getResultDomain
Returns the calculation domainCalculatorPlugin.ATOMorCalculatorPlugin.MOLECULE.- Overrides:
getResultDomainin classCalculatorPlugin- Parameters:
type- is the result key- Returns:
- the calculation domain
- See Also:
-
getResultTypes
Returns the result types. Possible result types:- "dreidingenergy",
- "mmff94energy",
- "distance" (atomic)
- "angle" (atomic)
- "dihedral" (atomic)
- "hindrance" (atomic)
- "minimalprojectionarea"
- "maximalprojectionarea"
- "minimalprojectionradius"
- "maximalprojectionradius"
- "volume",
- "minz",
- "maxz",
- Overrides:
getResultTypesin classCalculatorPlugin- Returns:
- the result types
-
getTypeString
Returns a string representation of the given type.- Overrides:
getTypeStringin classCalculatorPlugin- Parameters:
type- is the type object- Returns:
- the type string
-
getResultMolecule
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 (MPropHandler.convertToString(MPropertyContainer, String)).- Overrides:
getResultMoleculein classCalculatorPlugin- Returns:
- the result molecule
- Throws:
PluginException- on error
-
getResultMolecules
Returns the result molecules, molecular results are set in the first molecule, atomic results are set in subsequent molecules as atom labels.- Overrides:
getResultMoleculesin classCalculatorPlugin- Returns:
- the result molecules
- Throws:
PluginException- on error
-
getRemark
Returns the calculation remark: if no results (no result types) then returns remark, otherwise returnsnull.- Overrides:
getRemarkin classCalculatorPlugin- Returns:
- the calculation remark
-
getWarningMessage
Returns a warning message if lowest energy conformer calculation was unsuccessful or aborted by user,nullotherwise.- Overrides:
getWarningMessagein classCalculatorPlugin- Returns:
- a warning message if conformer calculation aborted
-
isMultiThreadedRunEnabled
public boolean isMultiThreadedRunEnabled()For internal use only.- Overrides:
isMultiThreadedRunEnabledin classCalculatorPlugin- Returns:
trueif multi-threaded run is enabled
-
standardize
Expands sgroups.- Overrides:
standardizein classCalculatorPlugin- Parameters:
mol- is the molecule to be standardized
-
tags
Description copied from interface:TaggedCalculatorReturns the set of tags reported by this calculator. The same tags should be returned unless the calculator is modified using a mutator method, e.g. if some settings are changed.New tags can be introduced and reported in the future by existing calculators, so do not depend on the exact set of reported tags, only check for the presence of certain tags.
- Returns:
- the tags
-