foyer
foyer copied to clipboard
Apply multiple force fields simultaneously
Often when dealing with interesting physical systems, there are multiple heterogeneous components and it is necessary to apply different force fields to portions of a system. I've done this a couple times, but always in a hacky way
-
Separate the input structure. Make two or more compounds from one by cloning children into new compounds) and apply separate force fields to each. Then, add together in parmed.
-
Combine the force field file by hand and apply it to the whole system. Only feasible for simple cases with small force fields and no common atom types, such as a system of water on graphene.
Ideally we could do this in one pass, maybe based off of residue name, like
aotmtyped_structure = foyer.apply_multiple(forcefield=[TIP3P, AMBER], resnames=['SOL', 'METH'])
There are plenty of tricky details to figure out, such as deciding which force field has priority, and probably a handful more that we would encounter down the road.
I think we've discussed this before, but I can't find an issue. This sort of thing would be a nice feature, but might also require a rework on the scale of a 1.0 release.
We point out to users in openforcefield that approach (1) is simple, and give an example highlighting how to apply a conventional AMBER forcefield for a protein in combination with our SMIRNOFF force field for a small molecule. As you point out, with ParmEd this is straightforward.