Class ForceField

java.lang.Object
ffx.potential.parameters.ForceField

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

    • forceFieldURL

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

    • ForceField

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

    • getForceFieldURL

      public static URL getForceFieldURL(ForceField.ForceFieldName forceField)
      Get for the URL for the named force field.
      Parameters:
      forceField - a ForceField.ForceFieldName object.
      Returns:
      a URL object.
    • isForceFieldType

      public static boolean isForceFieldType(String keyword)
      Check if a keyword is a force field type.
      Parameters:
      keyword - The keyword to check.
      Returns:
      True if the keyword is a force field type.
    • 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 an 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.
    • getAngleTorsionType

      public AngleTorsionType getAngleTorsionType(String key)
      getAngleTorsionType
      Parameters:
      key - a String object.
      Returns:
      a AngleTorsionType object.
    • getAngleType

      public AngleType getAngleType(String key)
      getAngleType
      Parameters:
      key - a String object.
      Returns:
      a AngleType object.
    • getAngleType

      public AngleType getAngleType(AtomType a1, AtomType a2, AtomType a3)
      getAngleType
      Parameters:
      a1 - First AtomType.
      a2 - Second AtomType.
      a3 - Third AtomType.
      Returns:
      a AngleType object.
    • getAtomType

      public AtomType getAtomType(String key)
      getAtomType
      Parameters:
      key - a String object.
      Returns:
      a AtomType object.
    • getAtomType

      public AtomType getAtomType(String moleculeName, String atomName)
      getAtomType
      Parameters:
      moleculeName - a String object.
      atomName - a String object.
      Returns:
      a AtomType object.
    • getSimilarAtomTypes

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

      public HashMap<String,AtomType> getAtomTypes(String moleculeName)
      Getter for the field atomTypes.
      Parameters:
      moleculeName - a String object.
      Returns:
      a HashMap object.
    • getBioType

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

      public BioType getBioType(String key)
      getBioType
      Parameters:
      key - a String object.
      Returns:
      a BioType object.
    • getBioTypeMap

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

      public BondType getBondType(String key)
      getBondType
      Parameters:
      key - a String object.
      Returns:
      a BondType 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:
      The value of the property.
      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:
      The value of the property.
    • getForceFieldTypeCount

      public int getForceFieldTypeCount(ForceField.ForceFieldType type)
      getForceFieldTypeCount
      Parameters:
      type - a ForceField.ForceFieldType object.
      Returns:
      The number of ForceFieldTypes of the specified type.
    • getImproperType

      public ImproperTorsionType getImproperType(String key)
      getImproperType
      Parameters:
      key - a String object.
      Returns:
      a TorsionType object.
    • getImproperTypes

      public Collection<ImproperTorsionType> getImproperTypes()
      getImproperType
      Returns:
      a TorsionType object.
    • 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.
    • getMultipoleType

      public MultipoleType getMultipoleType(String key)
      getMultipoleType
      Parameters:
      key - a String object.
      Returns:
      a MultipoleType object.
    • 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.
    • getTypes

      public Map<String,? extends BaseType> getTypes(ForceField.ForceFieldType type)
      Return all force field types of a given type.
      Parameters:
      type - The type of force field type to clear.
      Returns:
      a Map object.
    • clearForceFieldType

      public void clearForceFieldType(ForceField.ForceFieldType type)
      Clear all force field types of a given type.
      Parameters:
      type - The type of force field type to clear.
    • getOutOfPlaneBendType

      public OutOfPlaneBendType getOutOfPlaneBendType(String key)
      getOutOfPlaneBendType
      Parameters:
      key - a String object.
      Returns:
      a OutOfPlaneBendType object.
    • 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.
    • getPiOrbitalTorsionType

      public PiOrbitalTorsionType getPiOrbitalTorsionType(String key)
      getPiOrbitalTorsionType
      Parameters:
      key - a String object.
      Returns:
      a PiOrbitalTorsionType object.
    • getPiOrbitalTorsionType

      public PiOrbitalTorsionType getPiOrbitalTorsionType(AtomType a1, AtomType a2)
      getPiOrbitalTorsionType
      Parameters:
      a1 - AtomType of atom 1.
      a2 - AtomType of atom 2.
      Returns:
      PiOrbitalTorsionType object.
    • getPolarizeType

      public PolarizeType getPolarizeType(String key)
      getPolarizeType
      Parameters:
      key - a String object.
      Returns:
      a PolarizeType object.
    • getProperties

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

      public HashMap<String,RelativeSolvationType> getRelativeSolvationTypes()
      Getter for the field relativeSolvationTypes.
      Returns:
      a HashMap object.
    • getSoluteType

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

      public Map<String,SoluteType> getSoluteTypes()
    • getStretchBendType

      public StretchBendType getStretchBendType(String key)
      getStretchBendType
      Parameters:
      key - a String object.
      Returns:
      a StretchBendType object.
    • getStretchBendType

      public StretchBendType getStretchBendType(AtomType a1, AtomType a2, AtomType a3)
      getStretchBendType
      Parameters:
      a1 - First AtomType.
      a2 - Second AtomType.
      a3 - Third AtomType.
      Returns:
      a StretchBendType object.
    • getStretchTorsionType

      public StretchTorsionType getStretchTorsionType(String key)
      getStretchTorsionType
      Parameters:
      key - a String object.
      Returns:
      a StretchTorsionType object.
    • 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.
    • getTorsionTorsionType

      public TorsionTorsionType getTorsionTorsionType(String key)
      getTorsionTorsionType
      Parameters:
      key - a String object.
      Returns:
      a TorsionTorsionType object.
    • getTorsionType

      public TorsionType getTorsionType(String key)
      getTorsionType
      Parameters:
      key - a String object.
      Returns:
      a TorsionType object.
    • getTorsionType

      public TorsionType getTorsionType(AtomType a0, AtomType a1, AtomType a2, AtomType a3)
      getTorsionType
      Parameters:
      a0 - First AtomType.
      a1 - Second AtomType.
      a2 - Third AtomType.
      a3 - Fourth AtomType.
      Returns:
      a TorsionType object.
    • getUreyBradleyType

      public UreyBradleyType getUreyBradleyType(String key)
      getUreyBradleyType
      Parameters:
      key - a String object.
      Returns:
      a UreyBradleyType object.
    • 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.
    • getVDWType

      public VDWType getVDWType(String key)
      getVDWType
      Parameters:
      key - a String object.
      Returns:
      a VDWType object.
    • getVDWPairType

      public VDWPairType getVDWPairType(String key)
      getVDWPairType
      Parameters:
      key - a String object.
      Returns:
      a VDWPairType object.
    • getVDWTypes

      public Map<String,VDWType> getVDWTypes()
      getVDWTypes
      Returns:
      a Map object.
    • getVDWPairTypes

      public Map<String,VDWPairType> getVDWPairTypes()
      getVDWPairTypes
      Returns:
      a Map object.
    • hasProperty

      public boolean hasProperty(String property)
      Checks if a property was specified.
      Parameters:
      property - String to check.
      Returns:
      Returns true if the property has been specified.
    • 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 - The class offset.
      typeOffset - The type offset.
      bioTypeOffset - The biotype offset.
    • 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.
    • toString

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

      public String toString()
      Overrides:
      toString in class Object
    • 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.