Class ForceFieldMMFF


  • public class ForceFieldMMFF
    extends ForceField
    MMFF94 implementation 5/14/2012 - fully validated for atom types and charges - reasonably well validated for energies (see below) - TODO: add UFF for preliminary/backup calculation
    Author:
    Bob Hanson hansonr@stolaf.edu Java implementation by Bob Hanson 5/2012 based loosely on chemKit code by Kyle Lutz and OpenBabel code by Tim Vandermeersch but primarily from what is described in T. A. Halgren; "Merck Molecular Force Field. V. Extension of MMFF94 Using Experimental Data, Additional Computational Data, and Empirical Rules", J. Comp. Chem. 5 & 6 616-641 (1996). Parameter files are clipped from the original Wiley FTP site supplemental material: ftp://ftp.wiley.com/public/journals/jcc/suppmat/17/490/MMFF-I_AppendixB.ascii Original work, as listed at http://towhee.sourceforge.net/forcefields/mmff94.html: T. A. Halgren; "Merck Molecular Force Field. I. Basis, Form, Scope, Parameterization, and Performance of MMFF94", J. Comp. Chem. 5 & 6 490-519 (1996). T. A. Halgren; "Merck Molecular Force Field. II. MMFF94 van der Waals and Electrostatic Parameters for Intermolecular Interactions", J. Comp. Chem. 5 & 6 520-552 (1996). T. A. Halgren; "Merck Molecular Force Field. III. Molecular Geometries and Vibrational Frequencies for MMFF94", J. Comp. Chem. 5 & 6 553-586 (1996). T. A. Halgren; R. B. Nachbar; "Merck Molecular Force Field. IV. Conformational Energies and Geometries for MMFF94", J. Comp. Chem. 5 & 6 587-615 (1996). T. A. Halgren; "Merck Molecular Force Field. V. Extension of MMFF94 Using Experimental Data, Additional Computational Data, and Empirical Rules", J. Comp. Chem. 5 & 6 616-641 (1996). T. A. Halgren; "MMFF VII. Characterization of MMFF94, MMFF94s, and Other Widely Available Force Fields for Conformational Energies and for Intermolecular-Interaction Energies and Geometries", J. Comp. Chem. 7 730-748 (1999). Validation carried out using MMFF94_opti.log and MMFF94_dative.mol2 (or MMFF94_hypervalent.mol2) including 761 models using org/jmol/minimize/forcefield/mmff/validate/checkmm.spt (checkAllEnergies) All typical compounds validate. The following 7 structures do not validate to within 0.1 kcal/mol total energy; version=12.3.26_dev # code: adding empirical rules to MMFF94 calculation # # checkmm.spt;checkAllEnergies # # checking calculated energies for 761 models # 1 COMKAQ E= -7.3250003 Eref= -7.6177 diff= 0.2926998 # 2 DUVHUX10 E= 64.759995 Eref= 64.082855 diff= 0.6771393 # 3 FORJIF E= 35.978 Eref= 35.833878 diff= 0.14412308 # 4 JADLIJ E= 25.104 Eref= 24.7038 diff= 0.4001999 # 5 PHOSLA10 E= 111.232994 Eref= 112.07078 diff= 0.8377838 # 6 PHOSLB10 E= -93.479004 Eref= -92.64081 diff= 0.8381958 # # for 761 atoms, 6 have energy differences outside the range -0.1 to 0.1 # with a standard deviation of 0.05309403 # # a comment about empirical bond parameter calculation: # # // Well, guess what? As far as I can tell, in Eqn 18 on page 625, # // the reduction term and delta are zero. # # // -- at least in the program run that is at the validation site: # // OPTIMOL: Molecular and Macromolecular Optimization Package 17-Nov-98 16:01:23 # // SGI double-precision version ... Updated 5/6/98 # // # // This calculation is run only for the following three structures. In each case the # // reported validation values and values from Jmol 12.3.26_dev are shown. Clearly # // the r0 calculated and final energies are very good. subtracting off 0.008 from # // r0 would certainly not give the reported values. Something is odd there. # // # // bond red* r0(here/valid) kb(here/valid) Etotal(here/valid) # // --------------------------------------------------------------------------------------- # // OHWM1 H1-O1 0.03 0.978/0.978 7.510/7.51 -21.727/-21.72690 # // ERULE_03 Si1-P1 0.0 2.223/2.224 1.614/1.609 -2.983/ -2.93518 # // ERULE_06 N1-F1 0.0 1.381/1.379 5.372/5.438 1.582/ 1.58172 # // # // *reduction and delta terms not used in Jmol's calculation # # COMKAQ -- BATCHMIN ignores 1 of 5-membered ring torsions for a 1-oxo-2-oxa-bicyclo[3.2.0]heptane -- MMFF94_bmin.log: WARNING - Conformational Energies May Not Be Accurate DUVHUX10 -- BATCHMIN ignores 5-membered ring issue for S-S-containing ring -- MMFF94_bmin.log: WARNING - Conformational Energies May Not Be Accurate FORJIF -- BATCHMIN misses four standard 5-membered C-C ring bonds -- MMFF94_bmin.log: WARNING - Conformational Energies May Not Be Accurate JADLIJ -- BATCHMIN ignores 5-membered ring for S (note, however, this is not the case in BODKOU) -- MMFF94_bmin.log: WARNING - Conformational Energies May Not Be Accurate PHOSLA10 -- BATCHMIN ignores all 5-membered ring torsions in ring with P -- (note, however, this is not the case in CUVGAB) -- MMFF94_bmin.log: WARNING - Conformational Energies May Not Be Accurate PHOSLB10 -- BATCHMIN ignores all 5-membered ring torsions in ring with P -- (note, however, this is not the case in CUVGAB) -- MMFF94_bmin.log: WARNING - Conformational Energies May Not Be Accurate OHMW1 -- H2O complexed with hydroxide OH(-) -- I don't understand (a) why the OH(-) bond has mltb=1, and even with that I am not getting the correct ro/kb for that bond from empirical rules. Still working on that....
    • Method Detail

      • getAtomTypeDescriptions

        public java.lang.String[] getAtomTypeDescriptions()
      • getPartialCharges

        public float[] getPartialCharges()
      • setModel

        public boolean setModel​(javajs.util.BS bsElements,
                                int elemnoMax)
        Specified by:
        setModel in class ForceField
      • setArrays

        public boolean setArrays​(Atom[] atoms,
                                 javajs.util.BS bsAtoms,
                                 Bond[] bonds,
                                 int rawBondCount,
                                 boolean doRound,
                                 boolean allowUnknowns)
      • readParams

        private void readParams​(java.io.BufferedReader br,
                                int dataType,
                                java.util.Map<java.lang.Object,​java.lang.Object> data)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • ival

        private int ival​(int i,
                         int j)
      • fval

        private float fval​(int i,
                           int j)
      • dval

        private double dval​(int i,
                            int j)
      • setFlags

        private static void setFlags​(AtomType at)
      • calculatePartialCharges

        public float[] calculatePartialCharges​(Bond[] bonds,
                                               int[] bTypes,
                                               Atom[] atoms,
                                               int[] aTypes,
                                               javajs.util.BS bsAtoms,
                                               boolean doRound)
        assign partial charges ala MMFF94
        Parameters:
        bonds -
        bTypes -
        atoms -
        aTypes -
        bsAtoms -
        doRound -
        Returns:
        full array of partial charges
      • isSpecialBondType

        private static boolean isSpecialBondType​(AtomType at1,
                                                 AtomType at2)
        From forcefieldmmff94.cpp (flag BTij) a) single bond between atoms i and j, both i and j are not aromatic and both types have sbmb set in mmffprop.par, or b) between two aromatic atoms, but the bond is not aromatic (e.g. connecting bond in biphenyl) (sbmb is 2, 3, 4, 9, 30, 37, 39, 54, 57, 58, 63, 64, 67, 75, 78, 80, 81)
        Parameters:
        at1 -
        at2 -
        Returns:
        0 or 1
      • getBondType

        private int getBondType​(Bond bond,
                                AtomType at1,
                                AtomType at2,
                                int index1,
                                int index2)
        Get the bond type: 1 biphenyl or 0 any other
        Parameters:
        bond -
        at1 -
        at2 -
        index1 -
        index2 -
        Returns:
        0 or 1
      • isAromaticBond

        private boolean isAromaticBond​(int a1,
                                       int a2)
      • getAtomTypeDescs

        public static java.lang.String[] getAtomTypeDescs​(int[] types)
      • setAtomTypes

        private static int[] setAtomTypes​(Atom[] atoms,
                                          javajs.util.BS bsAtoms,
                                          SmilesMatcherInterface smartsMatcher,
                                          javajs.util.Lst<javajs.util.BS>[] vRings,
                                          boolean allowUnknowns)
        The file MMFF94-smarts.txt is derived from MMFF94-smarts.xlsx. This file contains records for unique atom type/formal charge sharing/H atom type. For example, the MMFF94 type 6 is distributed over eight AtomTypes, each with a different SMARTS match. H atom types are given in the file as properties of other atom types, not as their own individual SMARTS searches. H atom types are determined based on their attached atom's atom type.
        Parameters:
        atoms -
        bsAtoms -
        smartsMatcher -
        vRings -
        allowUnknowns -
        Returns:
        array of indexes into AtomTypes or, for H, negative of mmType
      • setBondTypes

        private int[] setBondTypes​(Bond[] bonds,
                                   int bondCount,
                                   javajs.util.BS bsAtoms)
      • fixTypes

        private boolean fixTypes()
      • setAngleType

        private int setAngleType​(MinAngle angle)
        Get the angle type: 0 The angle i-j-k is a "normal" bond angle 1 Either bond i-j or bond j-k has a bond type of 1 2 Bonds i-j and j-k each have bond types of 1; the sum is 2. 3 The angle occurs in a three-membered ring 4 The angle occurs in a four-membered ring 5 Is in a three-membered ring and the sum of the bond types is 1 6 Is in a three-membered ring and the sum of the bond types is 2 7 Is in a four-membered ring and the sum of the bond types is 1 8 Is in a four-membered ring and the sum of the bond types is 2
        Parameters:
        angle -
        Returns:
        type (0-8)
      • setTorsionType

        private int setTorsionType​(MinTorsion t)
        Get the torsion type for [a,b,c,d], also called "FF class". One of the following, determined in this order: 4: 4-membered ring 1: ab-cd 0: biphenyl and not 5-membered ring 5: 5-membered ring 2: a-x=x-b
        Parameters:
        t -
        Returns:
        type (0, 1, 2, 4, or 5)
      • typeOf

        private int typeOf​(int iAtom)
      • checkRings

        private boolean checkRings​(javajs.util.Lst<javajs.util.BS> v,
                                   int[] minlist,
                                   int n)
      • getKey

        private java.lang.Integer getKey​(java.lang.Object obj,
                                         int type,
                                         int ktype)
      • getTorsionKey

        private java.lang.Integer getTorsionKey​(int type,
                                                int i,
                                                int j)
      • applyEmpiricalRules

        private java.lang.Integer applyEmpiricalRules​(MinObject o,
                                                      double[] ddata,
                                                      int ktype)
      • getR0

        private double getR0​(MinBond b)
      • getRowFor

        private int getRowFor​(int i)
      • getOutOfPlaneParameter

        double getOutOfPlaneParameter​(int[] data)
      • sortOop

        private static void sortOop​(int[] typeData)
      • fixTypeOrder

        private static boolean fixTypeOrder​(int[] a,
                                            int i,
                                            int j)
        Parameters:
        a -
        i -
        j -
        Returns:
        true if swapped; false if not
      • fixOrder

        private int fixOrder​(int[] a,
                             int i,
                             int j)
        Parameters:
        a -
        i -
        j -
        Returns:
        1 if in order, 0 if same, -1 if reversed
      • swap

        private static void swap​(int[] a,
                                 int i,
                                 int j)
      • getEquivalentType

        private static int getEquivalentType​(int type,
                                             int level)
        equivalent types for OOP and torsions
        Parameters:
        type - mmFF94 atom type
        level - 0, 1, or 2.
        Returns:
        equivalent type or 0
      • getZParam

        private static double getZParam​(int elemno)
      • getCParam

        private static double getCParam​(int elemno)
      • getUParam

        private static double getUParam​(int elemno)
      • getVParam

        private static double getVParam​(int elemno)
      • getCovalentRadius

        private static double getCovalentRadius​(int elemno)
      • getRuleBondLength

        private static double getRuleBondLength​(MinAtom a,
                                                MinAtom b,
                                                int boAB,
                                                boolean isAromatic)