Giter VIP home page Giter VIP logo

Comments (26)

mikemhenry avatar mikemhenry commented on July 18, 2024 1

So I was was able to create a usable forcefield.xml file by feeding this file into parmed:

#define _FF_OPLS
#define _FF_OPLSAA

; This force field uses a format that requires Gromacs 3.1.4 or later.
;
; References for the OPLS-AA force field: 
;
; W. L. Jorgensen, D. S. Maxwell, and J. Tirado-Rives,
; J. Am. Chem. Soc. 118, 11225-11236 (1996).
; W. L. Jorgensen and N. A. McDonald, Theochem 424, 145-155 (1998).
; W. L. Jorgensen and N. A. McDonald, J. Phys. Chem. B 102, 8049-8059 (1998).
; R. C. Rizzo and W. L. Jorgensen, J. Am. Chem. Soc. 121, 4827-4836 (1999).
; M. L. Price, D. Ostrovsky, and W. L. Jorgensen, J. Comp. Chem. (2001).
; E. K. Watkins and W. L. Jorgensen, J. Phys. Chem. A 105, 4118-4125 (2001).
; G. A. Kaminski, R.A. Friesner, J.Tirado-Rives and W.L. Jorgensen, J. Phys. Chem. B 105, 6474 (2001).
;
[ defaults ]
; nbfunc	comb-rule	gen-pairs	fudgeLJ	fudgeQQ
1		3		yes		0.5	0.5

#include "ffnonbonded.itp"
#include "lps-nb.itp"
#include "lighthavestingcofactors-nb.itp"
#include "ffoplsaa-add-nb.itp"
#include "ffbonded.itp"
#include "ffoplsaa-add-bon.itp"
#include "gbsa.itp"
#include "lighthavestingcofactors-bon.itp"

I'll then pull out the parameters I need and merge them into the oplsaa parameters from foyer (to take advantage of the atom typing work that's already done).

from foyer.

mikemhenry avatar mikemhenry commented on July 18, 2024

I tried checking out a few older releases and got the same error so it is not an obvious regression.

from foyer.

summeraz avatar summeraz commented on July 18, 2024

The CH2 defined in your class is under-coordinated which is why Foyer isn't finding any atom types. The alkane CH2 in the OPLS force field in Foyer is defined as being bonded to both two hydrogens and two carbons.

from foyer.

mikemhenry avatar mikemhenry commented on July 18, 2024

So the issue is that the atoms are not bonded?

from foyer.

mikemhenry avatar mikemhenry commented on July 18, 2024

So this is the actual problem I'm working with:

class P3HT_Mon(mb.Compound):
    def __init__(self):
        super(P3HT_Mon, self).__init__()

        mb.load('p3ht.pdb', compound=self)
        # I used VMD to figure out what index to remove
        self.remove([self[8],
                 self[26],
                 self[27],
                 self[28],
                 self[12],
                 self[30],
                 self[31],
                 self[32]])
        # Now we need to add the ports
        # Add ports anchored to the correct carbons
        self.add(mb.Port(anchor=self[9]), label='up')
        self.add(mb.Port(anchor=self[7]), label='down')
        
        # Move the ports approximately half a C-C bond length away from the carbon
        mb.translate(self['up'], [0, 0.154/2, 0]) 
        mb.translate(self['down'], [0, -0.154/2, 0]) 
        

p3ht_mon = P3HT_Mon()
#p3ht_mon.visualize(show_ports=True)

p3ht_mon.save("p3ht_mon.hoomdxml", overwrite=True, forcefield_name="oplsaa")

(I had to add .txt to the pdb file)
If I save p3ht_mon as a hoomdxml without applying the force field the file looks good. Bonds are defined and hoomd can load it. When I try and apply the force field I get this error:

FoyerError: Found no types for atom 7 (carbon).
p3ht.pdb.txt

from foyer.

summeraz avatar summeraz commented on July 18, 2024

Oh right, I hadn't even noticed the molecule didn't have bonds. So then right, Foyer will look for a carbon without bonds and since there aren't any carbons of that type defined in the OPLS force field you will get that error.

In the case of your P3HT_Mon class, SMARTS for atoms in thiophenes are not yet included in the OPLS force field XML in Foyer (we've been adding SMARTS for various atom types as we go, but the force field remains incomplete...). A quick glance at the atom type descriptions for OPLS shipped with Gromacs suggests those parameters might not exist in OPLS, but I'm not positive about that. If you have/find those OPLS parameters, adding SMARTS to the OPLS force field in Foyer would likely be the best option.

from foyer.

mikemhenry avatar mikemhenry commented on July 18, 2024

Thanks! I'm sure I will be back with some more questions. I can track down what we use for thiophenes and see if I can add the to the force field correctly.

from foyer.

mikemhenry avatar mikemhenry commented on July 18, 2024

I just want to make sure I'm on the right track,
I found this website that will help type atoms using OPLSAA
http://erg.biophys.msu.ru/tpp/

It created this file
output000.itp.txt
which has some opls_t* types for the thiophene.

So do I just need to add missing opls types and the bond, angle, dihedral parameters?

I'll have to add the SMARTS stuff as well so foyer can type things correctly

from foyer.

summeraz avatar summeraz commented on July 18, 2024

Ah okay, so those atom types are not included in the OPLS force field in Foyer (which features the same atom types as the force field shipped with Gromacs). This is a similar issue to what I have run into with the OPLS parameters for silica, in that the parameters do exist but are not part of the standard OPLS force field. I'm not sure if we want to add in these additional parameters (i.e. those for silica and thiophenes) to the OPLS force field in Foyer or just have these be cases where the user creates their own force field XML file. @ctk3b any ideas on this?

from foyer.

ctk3b avatar ctk3b commented on July 18, 2024

If we do add them, we should definitely add the appropriate DOIs for where the parameters came from. Depending on where they come from we can discuss adding them to the main force field or not.

from foyer.

mikemhenry avatar mikemhenry commented on July 18, 2024

from foyer.

ctk3b avatar ctk3b commented on July 18, 2024

The .xml files were generated with ParmEd. Something along the lines of the following should work:

import parmed as pmd
from parmed.openmm.parameters import OpenMMParameterSet

oplsaa = pmd.load_file('my_gromacs_forcefield.itp')
xml = OpenMMParameterSet.from_parameterset(oplsaa.parameterset)
xml.write('foo.xml')

The caveat here is that RB-torsions aren't being written right now - we need to commit our modification to ParmEd that fixes this.

from foyer.

summeraz avatar summeraz commented on July 18, 2024

There were a few edits we had to make to the parameters.py file in the parmed/openmm directory in the parmed source code to get this to work. I've attached below the edited parameters.py file we used as well as a file showing the changes that were made.

parameters.py.txt
git-diff.txt

from foyer.

mikemhenry avatar mikemhenry commented on July 18, 2024

Depending how long it takes for those edits to get incorporated it might be worth forking parmed and just using git submodules

from foyer.

mikemhenry avatar mikemhenry commented on July 18, 2024

I feel like I'm close but still missing something.
If I use the code posted by @ctk3b with this itp file, I get an error:
withimporpoutput000.itp.txt

ValueError: invalid literal for int() with base 10: 'improper_Z_CA_X_Y'

Since I don't care about impropers, I deleted them creating this file:
output000.itp.txt

Which when I used the code above worked, except this is the contents of foo.xml

<ForceField>
 <Info>
  <DateGenerated>2017-03-23</DateGenerated>
 </Info>
</ForceField>

I did use the file provided by @summeraz to patch ParmEd. While I'm sure that I could edit the oplsaa.xml file by hand, I'd rather exhaust automatic methods first.

from foyer.

ctk3b avatar ctk3b commented on July 18, 2024

Do you have a corresponding .gro or other structure file that would be used with this?

from foyer.

mikemhenry avatar mikemhenry commented on July 18, 2024

from foyer.

ctk3b avatar ctk3b commented on July 18, 2024

Looks like the links broke. Can you attach just the .pdb? What I think the problem is is that the .itp file produced by this service defines a [ moleculetype ]. In order for parmed to know what to do with it, it needs a concrete instance of that moleculetype. So you need a .gro file and a [ system ] and [ molecules ] section in the .itp file.

So far when converting force fields we had always been converting files that defined [ atomtypes ], [ bondtypes ] etc. which parmed reads and creates types for.

from foyer.

mikemhenry avatar mikemhenry commented on July 18, 2024

here is the pdb file:
p3ht.pdb.txt

from foyer.

ctk3b avatar ctk3b commented on July 18, 2024

Do you have a full, runnable set of gromacs input files? I've created an overarching .top file which should help but it's missing all of the opls_t* types which I haven't seen before.

output.top:

#include "output.itp"
#include "oplsaa.ff/forcefield.itp"

[ defaults ]
1 3 yes 0.5 0.5

[ system ]
p3ht

[ molecules ]
RES 1

from foyer.

mikemhenry avatar mikemhenry commented on July 18, 2024

I don't have have a gromacs file. What I'm working with is a pdb file for P3HT that I've loaded into mbuild. Since foyer didn't have those oplsaa types for the thiophenes I went looking for something that could help type them and generate force field parameters.

from foyer.

ctk3b avatar ctk3b commented on July 18, 2024

Right I was just wondering if that service you were trying out generated a full set of gromacs input files (I just tried it out and the answer appears to be no). It was unclear to me at this point where some of the parameter values are defined and apparently the answer is here but I can't immediately see if those parameters were derived by this group or are from some paper. Just from reading the comments, most of them are just furan parameters but I don't know about opls_t566.

from foyer.

mikemhenry avatar mikemhenry commented on July 18, 2024

from foyer.

ctk3b avatar ctk3b commented on July 18, 2024

Right now though I'm more interested in a path of least resistance that
will let me have foyer generate a forcefeild for P3HT

If opls_t566 is the only custom atomtype and all of the bonded parameters can just come from the furan types (which I would be surprised by), then I would just manually add that atomtype to a copy of our oplsaa.xml. Otherwise to avoid doing too much manual copy pasting:

  • download the ERG group's gromacs formatted OPLS files
  • convert them to .xml using parmed with our patch
  • add the relevant SMARTS strings for the atom types you need
    • you can probably copy almost all of these from our oplsaa.xml
  • use your build/save script as is with your customized .xml file

I'm happy to help smooth out any pain points that you encounter here as we're in the process of working on this type of documentation #102

Longer term, I would like to collect the proper publication history of the various parameters before making any decisions about including them with foyer or as a separate "opls extension".

from foyer.

mikemhenry avatar mikemhenry commented on July 18, 2024

I'm on board with the long term plan! I think curating the foyer oplsaa parameters is the right way to go. In the readme or some wiki, people could link their own forcefield parameter files that might not be general or documented well enough to make it into the foyer mainline but could be useful for others.

Going back to the issue at hand, there 8 opls_t* atom types that the service suggests using so I'll go the route of taking the gromacs file. I might not be able to touch this until next week but I'll tweak the example I'm working on to approach it as a user who has a gromacs + pdb file and they want to use mbuild to initialize their system and foyer to make the forcefield. That way it's useful for our lab and can help with #102 for documentation.

from foyer.

mikemhenry avatar mikemhenry commented on July 18, 2024

Thanks everyone for helping me out with this issue. I was able to get things working by just adding 2 new atom types.

from foyer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.