TinkerTools / poltype2

Poltype 2: Automated Parameterization and Free Energy Prediction for AMOEBA
Other
41 stars 12 forks source link

Multiple conformers in ESP fitting does not work #47

Closed ghost closed 5 months ago

ghost commented 5 months ago

When specifying espextraconflist, the current ReadCoordinates function reads len(espextraconflist) replicates of the structure=foo.sdf specified in the poltype.ini file instead of using the extra conformer coordinates.

A suggested fix, (in STEP 1):

        def ReadCoordinates(self,filename):
            """
            Intent: Read coordinates from .mol file generated by GenerateExtendedConformer, then save in dictionary to later be used by QM geometry optimization
            Input: .mol filename
            Output: Dictionary of atomic index to coordinates
            Referenced By: GenerateExtendedConformer
            Description:
            1. Read in .mol file to openbabel mol object
            2. Iterate over mol object atoms
            3. Save atom index and coordinates in dictionary
            """
            # STEP 1
            indextocoordinates={}
            obConversion = openbabel.OBConversion()
            mol = openbabel.OBMol()
            inFormat = obConversion.FormatFromExt(filename) # self.molstructfname)
            obConversion.SetInFormat(inFormat)
            obConversion.ReadFile(mol, filename) # self.molstructfname)
            # STEP 2
            iteratombab = openbabel.OBMolAtomIter(mol)
            for atm in iteratombab:
                atmindex=atm.GetIdx()
                coords=[atm.GetX(),atm.GetY(),atm.GetZ()]
                # STEP 3
                indextocoordinates[atmindex-1]=coords

            return indextocoordinates

With the fix in place, here's an example output from the fitting logfile for a species with 23 conformers, which now correctly uses the extra conformers.

   Structure   Atom      Points      Potential        Target        RMS Diff
... (break) ...
       22        1         645         4.3779         4.2385         0.2267
       22        2         643       -10.2089       -10.3069         0.4561
       22        3         308        -6.0887        -5.4022         0.8753
       22        4        1276       -15.9100       -15.6805         0.5568
       22        5         119         5.4512         5.6995         0.3552
       22        6         224         6.0627         6.0800         0.2707
       22        7         265         6.8441         6.7300         0.1718
       22        8        1192        -7.8923        -7.9248         0.1671
       22        9         745         5.8614         5.8361         0.1477
       22       10         589         5.1461         5.0216         0.1454
       22       11         921         3.0797         2.9833         0.1484
       22       12         863         9.1204         9.1366         0.1784
       22       13         468        -0.6654        -0.3826         0.3444
       22       14         730         8.2696         8.1063         0.2120
       22       15         881         6.9053         7.0064         0.1839
       23        1         657         1.7189         1.6859         0.1591
       23        2         614        -6.5373        -6.5216         0.2755
       23        3         226        -2.8630        -2.0892         0.8352
       23        4         873       -10.4951       -10.5249         0.4046
       23        5         465        -5.3206        -5.0710         0.4029
       23        6         227         4.8927         4.9174         0.2292
       23        7         262         4.9101         4.7408         0.1954
       23        8        1210        -7.8849        -7.9499         0.1540
       23        9         726        -1.3162        -1.4456         0.1652
       23       10         919         2.5968         2.5843         0.1725
       23       11         746         0.5566         0.7114         0.1995
       23       12         491        -0.0566         0.0780         0.2028
       23       13         861         6.3595         6.4696         0.2151
       23       14         814         3.0254         2.8754         0.1844
       23       15         886         5.8934         5.9393         0.1375
leucinw commented 5 months ago

Thanks for looking at the code. This has been implemented.