Class ForceField


  • @FFXKeyword(name="forcefield",
                clazz=java.lang.String.class,
                keywordGroup=PotentialFunctionParameter,
                description="[name] Provides a name for the force field to be used in the current calculation. Its value is usually set in the master force field parameter file for the calculation (see the PARAMETERS keyword) instead of in the property file.")
    public class ForceField
    extends Object
    The ForceField class organizes parameters for a molecular mechanics force field.
    Since:
    1.0
    Author:
    Michael J. Schnieders
    • Field Detail

      • forceFieldURL

        public URL forceFieldURL
        URL to the force field parameter file.
    • Constructor Detail

      • ForceField

        public ForceField​(org.apache.commons.configuration2.CompositeConfiguration properties)
        ForceField Constructor.
        Parameters:
        properties - a CompositeConfiguration object.
    • Method Detail

      • isForceFieldKeyword

        public static boolean isForceFieldKeyword​(String keyword)
        isForceFieldKeyword.
        Parameters:
        keyword - a String object.
        Returns:
        a boolean.
      • toEnumForm

        public static String toEnumForm​(String key)
        Enums are uppercase with underscores, but property files use lower case with dashes.
        Parameters:
        key - an input keyword
        Returns:
        the keyword in Enum form.
      • toPropertyForm

        public static String toPropertyForm​(String s)
        Enums are uppercase with underscores, but property files use lower case with dashes.
        Parameters:
        s - an input Enum string
        Returns:
        the normalized keyword
      • addForceFieldType

        public <T extends BaseType> void addForceFieldType​(T type)
        Add an instance of a force field type. Force Field types are more complicated than simple Strings or doubles, in that they have multiple fields and may occur multiple times.
        Type Parameters:
        T - ForceFieldType to add that extends BaseType
        Parameters:
        type - The ForceFieldType to add.
      • addProperty

        public void addProperty​(String property,
                                String value)
        Add a property from a external parameter file.
        Parameters:
        property - Property string.
        value - double
      • clearProperty

        public void clearProperty​(String property)
        Clear a property from the force field instance.
        Parameters:
        property - Property to clear.
      • append

        public void append​(ForceField patch)
        Append a 2nd ForceField "patch" to the current ForceField. Note that only the force field types are appended; properties are ignored.
        Parameters:
        patch - The force field patch to append.
      • getSimilarAtomTypes

        public List<AtomType> getSimilarAtomTypes​(AtomType atomType)
        Getter for the field atomTypes.
        Parameters:
        atomType - AtomType to find similar examples of.
        Returns:
        Similar atom types.
      • getBioType

        public BioType getBioType​(String moleculeName,
                                  String atomName)
        getBioType.
        Parameters:
        moleculeName - a String object.
        atomName - a String object.
        Returns:
        a BioType object.
      • getBioTypeMap

        public Map<String,​BioType> getBioTypeMap()
        getBioTypeMap.
        Returns:
        a Map object.
      • getBondType

        public BondType getBondType​(AtomType a1,
                                    AtomType a2)
        getBondType
        Parameters:
        a1 - First AtomType.
        a2 - Second AtomType.
        Returns:
        a BondType object.
      • getBonds

        public String[] getBonds​(String moleculeName,
                                 String atomName)
        getBonds
        Parameters:
        moleculeName - a String object.
        atomName - a String object.
        Returns:
        an array of String objects.
      • getBoolean

        public boolean getBoolean​(String property)
                           throws Exception
        getBoolean
        Parameters:
        property - The property to return.
        Returns:
        a boolean.
        Throws:
        Exception - if any.
      • getBoolean

        public boolean getBoolean​(String property,
                                  boolean defaultBoolean)
        getBoolean
        Parameters:
        property - The property to return.
        defaultBoolean - The default to return.
        Returns:
        a boolean.
      • getDouble

        public double getDouble​(String property)
                         throws Exception
        getDouble
        Parameters:
        property - The property to return.
        Returns:
        an double.
        Throws:
        Exception - if any.
      • getDouble

        public double getDouble​(String property,
                                Double defaultDouble)
        getDouble
        Parameters:
        property - The property to return.
        defaultDouble - The default to return.
        Returns:
        an double.
      • getInteger

        public int getInteger​(String property)
                       throws Exception
        getInteger
        Parameters:
        property - The property to return.
        Returns:
        an int.
        Throws:
        Exception - if any.
      • getInteger

        public int getInteger​(String property,
                              Integer defaultInteger)
        getInteger
        Parameters:
        property - The property to return.
        defaultInteger - The default to return.
        Returns:
        an int.
      • getMultipoleTypeBeginsWith

        public MultipoleType getMultipoleTypeBeginsWith​(String key)
        Find the MultipoleType whose key begins with the supplied String. If there are more than one MultipoleType that begins with the key, null is returned.
        Parameters:
        key - The key to search for.
        Returns:
        The MultipoleType if one and only one match is found.
      • getMultipoleTypes

        public List<MultipoleType> getMultipoleTypes​(String key)
        Find each MultipoleType whose key begins with the supplied String.
        Parameters:
        key - The key to search for.
        Returns:
        The MultipoleTypes found.
      • getOutOfPlaneBendType

        public OutOfPlaneBendType getOutOfPlaneBendType​(AtomType a4,
                                                        AtomType a0,
                                                        AtomType a1,
                                                        AtomType a2)
        getOutOfPlaneBendType
        Parameters:
        a4 - AtomType of fourth atom.
        a0 - AtomType of atom 0 of the angle.
        a1 - AtomType of atom 1 of the angle (the trigonal atom).
        a2 - AtomType of atom 2 of the angle.
        Returns:
        a OutOfPlaneBendType object.
      • getProperties

        public org.apache.commons.configuration2.CompositeConfiguration getProperties()
        Getter for the field properties.
        Returns:
        a CompositeConfiguration object.
      • getSoluteType

        public SoluteType getSoluteType​(String key)
        Get a SoluteType.
        Parameters:
        key - The class of the atom.
        Returns:
        The SoluteType if its present.
      • getString

        public String getString​(String property)
                         throws Exception
        getBoolean
        Parameters:
        property - The property to return.
        Returns:
        a String.
        Throws:
        Exception - if any.
      • getString

        public String getString​(String property,
                                String defaultString)
        getBoolean
        Parameters:
        property - The property to return.
        defaultString - The default to return.
        Returns:
        a boolean.
      • getVDW14Type

        public VDWType getVDW14Type​(String key)
        getVDW14Type
        Parameters:
        key - a String object.
        Returns:
        a VDWType object.
      • getVDW14Types

        public Map<String,​VDWType> getVDW14Types()
        getVDW14Types
        Returns:
        a Map object.
      • hasProperty

        public boolean hasProperty​(String property)
                            throws NullPointerException
        Checks if a property was specified.
        Parameters:
        property - String to check.
        Returns:
        Ever specified.
        Throws:
        NullPointerException - If forceFieldDouble is null.
      • log

        public void log()
        log
      • log

        public void log​(String key)
        Prints any force field keyword to Standard.out.
        Parameters:
        key - String
      • print

        public void print()
        print
      • print

        public void print​(String key)
        print
        Parameters:
        key - a String object.
      • renumberForceField

        public void renumberForceField​(int classOffset,
                                       int typeOffset,
                                       int bioTypeOffset)
        Renumber ForceField class, type and biotype values.
        Parameters:
        classOffset - a int.
        typeOffset - a int.
        bioTypeOffset - a int.
      • setAngleFunction

        public void setAngleFunction​(AngleType.AngleFunction angleFunction)
        The AngleFunction in use by this ForceField.
        Parameters:
        angleFunction - The AngleFunction to use.
      • setBondFunction

        public void setBondFunction​(BondType.BondFunction bondFunction)
        The BondFunction in use by this ForceField.
        Parameters:
        bondFunction - The BondFunction to use.
      • setTorsionScale

        public void setTorsionScale​(double scaleFactor)
        setTorsionScale.
        Parameters:
        scaleFactor - a double.
      • toString

        public String toString​(ForceField.ForceFieldType type)
        Return a String for any Force Field keyword.
        Parameters:
        type - ForceFieldType
        Returns:
        String
      • toString

        public String toString​(String key)
        toString
        Parameters:
        key - a String object.
        Returns:
        a String object.
      • toStringBuffer

        public StringBuffer toStringBuffer()
        toStringBuffer
        Returns:
        Returns a StringBuffer representation of the ForceField.