Use of CustomNonbondedForce XML for Buckingham

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
Greg Smith
Posts: 6
Joined: Sat Aug 17, 2024 2:33 pm

Use of CustomNonbondedForce XML for Buckingham

Post by Greg Smith » Sat Aug 17, 2024 3:00 pm

Greetings, I'm an OpenMM rookie and this looks like one of the best places I've found to ask questions about it.

I was hoping to make a custom nonbonded force field involving Buckingham potentials and there are a couple things from the documentation that I don't understand.

The regular nonbondedforce XML tag seems to collect coulombic forces together with Lennard-Jones and add both a dispersion correction and fudge factors for 1-4 interactions. It also would presumably directly connect the charges written in this force with a PME introduced for long range electrostatics.

How do I add all of these things to a customNonbondedForce tag? From the documentation I could find, given my currently ignorant position, there don't seem to be enough clear specifications to do this. I can see adding coulombic forces in the energy with an L-J potential and then giving a cut-off of 3 bonds, but how do you add in a sensitivity to fudge factors and introduce the dispersion correction?

Further, how does the system know what charges to count up for PME? The atomtypes tags don't specify charge, only mass. If I include a custom force for Buckingham and nothing else, does the PME fail without my adding an explicit coulombic custom force? How do I add a dispersion correction specific to Buckingham? The theory later in the manual seems to imply this is possible, but I'm not clear how.

If I need to go back into the programming to building appropriate generators, where do I look for good, thorough examples of how to write this code?

Thank you!
Greg Smith

User avatar
Peter Eastman
Posts: 2593
Joined: Thu Aug 09, 2007 1:25 pm

Re: Use of CustomNonbondedForce XML for Buckingham

Post by Peter Eastman » Sat Aug 17, 2024 8:01 pm

CustomNonbondedForce can't do PME. It supports arbitrary functional forms. PME can only be applied to a very small class of specific functional forms, specifically inverse integer powers of distance.

Presumably you want to use the Buckingham potential in place of Lennard-Jones, while still using a standard Coulomb interaction with PME? In that case, you should include both a NonbondedForce and a CustomNonbondedForce. The former will compute the Coulomb interaction. Set epsilon to 0 for all particles so it will omit the LJ interaction. Then you can add a CustomNonbondedForce to compute the Buckingham potential.

CustomNonbondedForce can compute the dispersion correction for you. It calls it a "long range correction", since it can represent any type of interaction, not just dispersion. Call setUseLongRangeCorrection(True) on the CustomNonbondedForce object.

User avatar
Greg Smith
Posts: 6
Joined: Sat Aug 17, 2024 2:33 pm

Re: Use of CustomNonbondedForce XML for Buckingham

Post by Greg Smith » Tue Aug 20, 2024 10:08 am

Ok, thank you! This helps a lot.

I have one additional question about the customNonbondedForce objects. If I'm specifying atom directives in the rule for each individual atom, it looks like I need to include my combining rule directly into the form of the potential. The Buckingham potential that I'm using has a pretty complicated combining rule. Does it penalize my simulation rate to allow open-mm to do these calculations together, or is there some way to specify one set of coefficients for each possible atom pair and do the calculation while setting up the force field rather than leaving it to the program? I assume that open-mm is smart enough to just have a table of these rather than calculating them each time, but I just thought I would check.

Thanks!
Greg

User avatar
Peter Eastman
Posts: 2593
Joined: Thu Aug 09, 2007 1:25 pm

Re: Use of CustomNonbondedForce XML for Buckingham

Post by Peter Eastman » Tue Aug 20, 2024 10:19 am

It's possible to do that, though it may not be faster, especially if you're running on a GPU. The cost of memory access versus computation is much higher on a GPU than on a typical CPU. But you can try it and see how it works. To do that, you precompute the combined parameters for each pair of atom types and store them in lookup tables, represented with Discrete2DFunction. Then you assign a "type" parameter to each particle with its integer atom type index, and write the energy expression to get the parameters from the tables.

That's what the <LennardJonesForce> tag does when using NBFIX terms. The code is at https://github.com/openmm/openmm/blob/7 ... 2654-L2657.

User avatar
Greg Smith
Posts: 6
Joined: Sat Aug 17, 2024 2:33 pm

Re: Use of CustomNonbondedForce XML for Buckingham

Post by Greg Smith » Tue Aug 20, 2024 10:27 am

Ok, this makes sense. I will be using a GPU, so I'll try without doing anything special to see how it works to start with.

Thanks for your help!
Greg

User avatar
Greg Smith
Posts: 6
Joined: Sat Aug 17, 2024 2:33 pm

Re: Use of CustomNonbondedForce XML for Buckingham

Post by Greg Smith » Tue Aug 20, 2024 2:04 pm

Forgive me, one additional question I have here.

In Gromacs, it's possible to designate any charge freely to an atom in the topology regardless of the underlying nonbonding type.

If I were to use nonBondedForce, it seems like I'm restrained to using either the type or the class of the atom as listed in the <atomtypes>, but not the atom name from a residue. Some of the charges I'm trying to port in the field I'm using are not specified by the type, but by the name of the atom in the geometry. Is there some way to use these freely? If not, it's pretty clear I can get around this with some renaming in the types, but it will make the block more complicated.

Thanks!
Greg

POST REPLY