Package chemaxon.calculations
Class ResonancePlugin
java.lang.Object
chemaxon.calculations.CalculatorPlugin
chemaxon.calculations.ResonancePlugin
- All Implemented Interfaces:
TaggedCalculator,Licensable
Plugin class for finding resonant structures.
API usage example:
// Read molecule
Molecule mol = MolImporter.importMol("CC(=O)OC1=CC=CC=C1C(O)=O");
// Create plugin
ResonancePlugin plugin = new ResonancePlugin();
// Set target molecule
plugin.setMolecule(mol);
// Run the calculation
plugin.run();
// Get the resonant structures
System.out.println("Resonant structures");
int count = plugin.getStructureCount();
for (int i=0; i < count; ++i) {
Molecule structure = plugin.getStructure(i);
System.out.println(structure.toFormat("smiles"));
}
For calculator plugin example applications using Chemaxon's concurrent framework, refer to the Calculator Plugins Developer's Guide.
- Since:
- Marvin 4.0
-
Nested Class Summary
Nested classes/interfaces inherited from class chemaxon.calculations.CalculatorPlugin
CalculatorPlugin.HydrogenData -
Field Summary
Fields inherited from class chemaxon.calculations.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.protected MoleculeCreates standardized molecule, the original input molecule is cloned.Returns the calculation error information message or the empty string if there is no error.Returns the product identifier of the plugin.Returns a warning message if there are no resonants,nullotherwise.Returns the result item for the specified key and index.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 domain.Returns the result as a document source object.Object[]Returns the result types.getStructure(int index) Returns a resonant structure.intReturns the number of different resonant structures.Molecule[]Returns resonant structures inMolecule[]array.booleanReturnstrueif the plugin handles multifragment molecules,falseotherwise.booleanFor internal use only.booleanrun()Calculates the resonant structures.voidsetCleanResultStructures(boolean clean) Sets 2D cleaning of the result structures: iftruethen resonants returned bygetStructure(int)andgetStructures()methods are cleaned in 2D.protected voidsetInputMolecule(Molecule mol) Sets the input molecule.voidsetMaxStructureCount(int max) Sets the maximum number of structures to be generated.voidsetParameters(Properties params) Sets the input parameters for the plugin.voidSets a progress observer to be used inrun()to display progress status.voidsetSymmetryFiltering(boolean filtering) Sets symmetry fitlering: iftruethen symmetrical structures are filtered out, otherwise symmetrical structures are returned as duplicates.voidsetTakeCanonicalForm(boolean canonical) Sets whether canonical form should be taken.voidsetTakeMajorContributors(boolean mcontrib) Sets whether major contributors should be taken.voidstandardize(Molecule mol) Standardizes the molecule.tags()Returns the set of tags reported by this calculator.Methods inherited from class chemaxon.calculations.CalculatorPlugin
addHeavyAtomLimitChecker, addInputChecker, arrangeHydrogenIncerments, canRepeat, checkLicense, checkType, containsCoordinateBond, containsMulticenterSgroup, containsPseudoAtom, containsSRUSgroup, create, createModifiedInputMolecule, format, format, format, format, getAtomCount, getAtomIndex, getAtomIndexMap, getAtomIndexMapping, getCalcMolecule, getDisplayMolecule, getDocument, getDoublePrecision, getExplicitHydrogenData, getInputMolDim, getOriginalMolecule, getpH, getPh, getQueryMoleculeErrorMessage, getResult, getResultAsRGB, getResultAsRGB, getResultAsString, getResultCount, getResultDomain, getResultMessage, getResultMolecule, getResultMolecules, getResultsAsRGB, getResultsAsRGB, getResultsAsString, getResultsAsString, getTypeString, getWarningMessage, isInputMoleculeAromatized, isLicensed, isMsCalc, isNegligibleResult, isOK, isRgrouped, loadPluginClass, removeWhitespace, restoreExplicitHydrogens, setAtomIndexMap, setChemicalTermsArgument, setChemicalTermsParameters, setDoublePrecision, setDoublePrecision, setDoublePrecision, setKeepHydrogens, setLicenseEnvironment, setMolecule, setMolecule, setMolecule, setMolecule, standardizeIonicGroups
-
Constructor Details
-
ResonancePlugin
public ResonancePlugin()Constructor.
-
-
Method Details
-
getProductName
Description copied from class:CalculatorPluginReturns the product identifier of the plugin. For internal use only!- Specified by:
getProductNamein classCalculatorPlugin
-
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. Returnstrueif parameter "single" is set to "false",falseotherwise (default:false).- Overrides:
handlesMultiFragmentMoleculesin classCalculatorPlugin- Returns:
- true if the plugin handles multifragment molecules, false otherwise
-
setProgressMonitor
Sets a progress observer to be used inrun()to display progress status. Short calculations may ignore the observer object. The default implementation does nothing.- Overrides:
setProgressMonitorin classCalculatorPlugin- Parameters:
pmon- is the progress monitor, may benull
-
setParameters
Sets the input parameters for the plugin. Parameters and value ranges:- single: "true" if single fragment mode (calculation is performed separately for each fragment) (default: "false")
- type: structure,structures,count
- max: max structure count
- pH: consider pH effect at this pH
(default:
Double.NaN- do not consider pH effect) - symfilter: true if filter symmetrical structures, false if allow duplicates (default: true)
- canonical: "true" if canonical form should be taken (default: "false")
- mcontrib: "true" if take major contributors (default: "true")
- Overrides:
setParametersin classCalculatorPlugin- Parameters:
params- is the parameter table- Throws:
CalculatorPluginException- on error
-
setCleanResultStructures
public void setCleanResultStructures(boolean clean) Sets 2D cleaning of the result structures: iftruethen resonants returned bygetStructure(int)andgetStructures()methods are cleaned in 2D. Default:false.- Parameters:
clean- iftruethen result structures are cleaned in 2D- Since:
- Marvin 5.2
-
setSymmetryFiltering
public void setSymmetryFiltering(boolean filtering) Sets symmetry fitlering: iftruethen symmetrical structures are filtered out, otherwise symmetrical structures are returned as duplicates. Default:true.- Parameters:
filtering- istrueif symmetrical structures should be filtered out
-
setMaxStructureCount
public void setMaxStructureCount(int max) Sets the maximum number of structures to be generated. Default:1000.- Parameters:
max- is the maximum number of structures to be generated- Since:
- Marvin 4.1
-
checkMolecule
Checks the input molecule. Throws exception if the molecule contains R-groups.- Overrides:
checkMoleculein classCalculatorPlugin- Parameters:
mol- is the input molecule- Throws:
CalculatorPluginException- with error message for the user if the molecule is refused
-
createStandardizedMolecule
Creates standardized molecule, the original input molecule is cloned.- Overrides:
createStandardizedMoleculein classCalculatorPlugin- Parameters:
mol- is the input molecule- Returns:
- the standardized molecule
- Throws:
CalculatorPluginException- on error
-
setInputMolecule
Sets the input molecule.- Specified by:
setInputMoleculein classCalculatorPlugin- Parameters:
mol- is the input molecule- Throws:
CalculatorPluginException- on error
-
setTakeCanonicalForm
public void setTakeCanonicalForm(boolean canonical) Sets whether canonical form should be taken. Default:false.- Parameters:
canonical- istrueif canonical form should be taken- Since:
- Marvin 4.1
- See Also:
-
setTakeMajorContributors
public void setTakeMajorContributors(boolean mcontrib) Sets whether major contributors should be taken. Default:true.- Parameters:
mcontrib- istrueif major contributors should be taken- See Also:
-
run
Calculates the resonant structures.- Specified by:
runin classCalculatorPlugin- Returns:
- true if the calculation was successful, false if the number of ionizable atoms exceeds the specified limit
- Throws:
CalculatorPluginException- on error- See Also:
-
getResultSource
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:
getResultSourcein classCalculatorPlugin- Returns:
- the document source interface
- Throws:
CalculatorPluginException- on error- Since:
- Marvin 5.0
-
getStructureCount
public int getStructureCount()Returns the number of different resonant structures.- Returns:
- the number of different resonant structures
- See Also:
-
getStructure
Returns a resonant structure.- Parameters:
index- is the structure index- Returns:
- the resonant structure
- See Also:
-
getStructures
Returns resonant structures inMolecule[]array.- Returns:
- resonant structures
- See Also:
-
getResultTypes
Returns the result types.- Overrides:
getResultTypesin classCalculatorPlugin- Returns:
- the result types
-
getResultDomain
Returns the calculation domain.- Overrides:
getResultDomainin classCalculatorPlugin- Parameters:
type- is the result type- Returns:
- the calculation domain
- See Also:
-
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:
-
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:
CalculatorPluginException- if the result cannot be returned- See Also:
-
getResultAsString
public String getResultAsString(Object type, int index, Object result) throws CalculatorPluginException 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:
CalculatorPluginException- if an invalid result item is given
-
getRemark
Returns a warning message if there are no resonants,nullotherwise.- Overrides:
getRemarkin classCalculatorPlugin- Returns:
- a warning message if there are no resonants
-
getErrorMessage
Returns the calculation error information message or the empty string if there is no error.- Overrides:
getErrorMessagein classCalculatorPlugin- Returns:
- the calculation error information message
-
standardize
Standardizes the molecule. This is the same as the default standardization, but performs daylight aromatization.- Overrides:
standardizein classCalculatorPlugin- Parameters:
mol- is the molecule to be standardized
-
isMultiThreadedRunEnabled
public boolean isMultiThreadedRunEnabled()For internal use only.- Overrides:
isMultiThreadedRunEnabledin classCalculatorPlugin- Returns:
trueif multi-threaded run is enabled
-
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
-