Class ResonancePlugin

  • All Implemented Interfaces:
    chemaxon.license.Licensable

    @PublicAPI
    public class ResonancePlugin
    extends CalculatorPlugin
    Plugin class for finding resonant structures.

    API usage example:

        // read input molecule
        MolImporter mi = new MolImporter("test.mol");
        Molecule mol = mi.read();
        mi.close();
    
        // 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 concurrent plugin example applications using ChemAxon's concurrent framework, refer to the Concurrent plugin examples.

    Since:
    Marvin 4.0
    • Constructor Detail

      • ResonancePlugin

        public ResonancePlugin()
        Constructor.
    • Method Detail

      • 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. Returns true if parameter "single" is set to "false", false otherwise (default: false).
        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 monitor, may be null
      • setParameters

        public void setParameters​(Properties params)
                           throws PluginException
        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:
        setParameters in class CalculatorPlugin
        Parameters:
        params - is the parameter table
        Throws:
        PluginException - on error
      • setCleanResultStructures

        public void setCleanResultStructures​(boolean clean)
        Sets 2D cleaning of the result structures: if true then resonants returned by getStructure(int) and getStructures() methods are cleaned in 2D. Default: false.
        Parameters:
        clean - if true then result structures are cleaned in 2D
        Since:
        Marvin 5.2
      • setSymmetryFiltering

        public void setSymmetryFiltering​(boolean filtering)
        Sets symmetry fitlering: if true then symmetrical structures are filtered out, otherwise symmetrical structures are returned as duplicates. Default: true.
        Parameters:
        filtering - is true if 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
      • setpH

        @Deprecated
        public void setpH​(double pH)
        Deprecated.
        As of Marvin 5.0 pH effect is not considered
        Sets the pH to be considered in calculation. By default, no pH effect considered (Double.NaN).
        Parameters:
        pH - is the pH value
      • setInputMoleculeModified

        @Deprecated
        public void setInputMoleculeModified​(boolean inputMoleculeModified)
        Deprecated.
        Not used.
        Sets whether the input molecule should be modified and returned as calculation result. Default: false.
        Parameters:
        inputMoleculeModified - is true if input molecule should be modified, false if it should be preserved
        Since:
        Marvin 4.1
      • checkMolecule

        public void checkMolecule​(Molecule mol)
                           throws PluginException
        Checks the input molecule. Throws exception 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
      • setTakeCanonicalForm

        public void setTakeCanonicalForm​(boolean canonical)
        Sets whether canonical form should be taken. Default: false.
        Parameters:
        canonical - is true if canonical form should be taken
        Since:
        Marvin 4.1
        See Also:
        getStructure(int), getStructures(), getStructureCount()
      • setTakeMajorContributors

        public void setTakeMajorContributors​(boolean mcontrib)
        Sets whether major contributors should be taken. Default: true.
        Parameters:
        mcontrib - is true if major contributors should be taken
        See Also:
        getStructure(int), getStructures(), getStructureCount()
      • 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
      • getResultCount

        public int getResultCount​(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()
      • getResultAsString

        public String getResultAsString​(Object type,
                                        int index,
                                        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
      • getRemark

        public String getRemark()
        Returns a warning message if there are no resonants, null otherwise.
        Overrides:
        getRemark in class CalculatorPlugin
        Returns:
        a warning message if there are no resonants
      • getErrorMessage

        public String getErrorMessage()
        Returns the calculation error information message or the empty string if there is no error.
        Overrides:
        getErrorMessage in class CalculatorPlugin
        Returns:
        the calculation error information message
      • standardize

        public void standardize​(Molecule mol)
        Standardizes the molecule. This is the same as the default standardization, but performs daylight aromatization.
        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