Class GeometryPlugin

  • All Implemented Interfaces:
    chemaxon.license.Licensable

    @PublicAPI
    public class GeometryPlugin
    extends CalculatorPlugin
    Plugin class for geometric properties calculations. Data types:
    • "dreidingenergy"
    • "distance"
    • "angle"
    • "dihedral"
    • "hindrance",
    • "minimalprojectionarea"
    • "maximalprojectionarea"
    • "minimalprojectionradius"
    • "maximalprojectionradius"
    • "volume",
    • "minz",
    • "maxz",

    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
    • Constructor Detail

      • GeometryPlugin

        public GeometryPlugin()
        Constructor.
    • Method Detail

      • setParameters

        public void setParameters​(Properties params)
                           throws PluginException
        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",
          (default: all molecular types)
        • atoms: <atom1-...-atomn> valid for type="distance" (n=2), "angle" (n=3) and "dihedral" (n=4) calculations only, sets the atoms used by cxcalc, for internal use only; API usage: call getDistance(int,int) or getDistance(int[]).
        • optimizeprojection: [true|false] sets projection optimization (default: false)
        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
      • setCalculateVolume

        public void setCalculateVolume​(boolean calculateVolume)
      • 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
      • setCalculateEnergy

        public void setCalculateEnergy​(boolean e)
        Sets the calculation of dreiding energy.
        Parameters:
        e - if true then dreiding energy is calculated
      • setCalculateMMFF94Energy

        public void setCalculateMMFF94Energy​(boolean mmffe)
        Sets the calculation of MMFF94 energy.
        Parameters:
        mmffe - if true then MMFF94 energy is calculated
        Since:
        Marvin 5.4
        See Also:
        setMMFF94Optimization(boolean)
      • setMMFF94Optimization

        public void setMMFF94Optimization​(boolean opt)
        Sets MMFF94 optimization.
        Parameters:
        opt - if true then MMFF94 optimization is performed
        Since:
        Marvin 5.4
        See Also:
        setCalculateMMFF94Energy(boolean)
      • setCalculateForLEConformer

        public void setCalculateForLEConformer​(String condition)
        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

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

        public void setLicenseEnvironment​(String env)
        Description copied from class: CalculatorPlugin
        Sets license environment to be stored.
        Specified by:
        setLicenseEnvironment in interface chemaxon.license.Licensable
        Overrides:
        setLicenseEnvironment in class CalculatorPlugin
        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 atom
        atom2 - is the (0-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 (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 atom
        atom2 - is the (0-based) index of the 2nd atom
        atom3 - is the (0-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 (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 atom
        atom2 - is the (0-based) index of the 2nd atom
        atom3 - is the (0-based) index of the 3rd atom
        atom4 - is the (0-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 (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
      • 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)
      • 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
      • getMaxZ

        public double getMaxZ()
      • getMinZ

        public double getMinZ()
      • 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
      • 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()
      • getResultTypes

        public Object[] 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:
        getResultTypes in class CalculatorPlugin
        Returns:
        the result types
      • getTypeString

        public String getTypeString​(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
      • getRemark

        public 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 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 conformer calculation aborted
      • isMultiThreadedRunEnabled

        public boolean isMultiThreadedRunEnabled()
        For internal use only.
        Overrides:
        isMultiThreadedRunEnabled in class CalculatorPlugin
        Returns:
        true if multi-threaded run is enabled
      • standardize

        public void standardize​(Molecule mol)
        Expands sgroups.
        Overrides:
        standardize in class CalculatorPlugin
        Parameters:
        mol - is the molecule to be standardized