Pair-specific parameter for nonbonded force

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
Yan Zhang
Posts: 38
Joined: Mon Dec 19, 2016 2:39 pm

Pair-specific parameter for nonbonded force

Post by Yan Zhang » Thu Sep 07, 2017 10:58 am

Suppose I have N particles and each pair has a LJ potential. At some point I want to remove the potential defined between particle i and j, but meanwhile leave the potential defined between, say, i and k intact. What is the best way to do this?

I guess I could create ~N^2 number of LJ potential objects for each pair, and each of the potential involves only two particles by adding other particles to the exclusion set. Then when I want to remove one of the potential I can set its epsilon to be zero. But I'm not sure if ~N^2 potentials is too many for a simulation (but each force only has 2 particles so it should be fast, right?), and if there's a better way to do this.

Thanks,
Yan

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

Re: Pair-specific parameter for nonbonded force

Post by Peter Eastman » Thu Sep 07, 2017 11:20 am

If all you want to do is turn off one pairwise interaction, make that one pair an exception. You can initially set the exception parameters to be the same as if it weren't an exception, but then later change its epsilon to 0 (and call updateParametersInContext() to copy it over to the context).

On the other hand, if there are many different pairs you might want to turn off, a different implementation might be more efficient. If that's the case, describe all the details of what you want to do, and we can suggest the best way of implementing it.

Peter

User avatar
Yan Zhang
Posts: 38
Joined: Mon Dec 19, 2016 2:39 pm

Re: Pair-specific parameter for nonbonded force

Post by Yan Zhang » Thu Sep 07, 2017 11:39 am

peastman wrote:If all you want to do is turn off one pairwise interaction, make that one pair an exception. You can initially set the exception parameters to be the same as if it weren't an exception, but then later change its epsilon to 0 (and call updateParametersInContext() to copy it over to the context).

On the other hand, if there are many different pairs you might want to turn off, a different implementation might be more efficient. If that's the case, describe all the details of what you want to do, and we can suggest the best way of implementing it.

Peter
What I have is a circular chain of N particles, and I want all the pairs to be able to be turned off, except for pairs whose two particles are adjacent to each other on the chain. At each, say, 1000 steps, I'll check which pairs of particles are close to each other, and then randomly turn off some of their LJ potentials and allow them to pass through each other. After some time steps I'll turn their LJ back on.

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

Re: Pair-specific parameter for nonbonded force

Post by Peter Eastman » Sat Sep 09, 2017 5:59 pm

I've been trying to think of a good solution to this, but I don't have anything that's fully satisfactory. If the number of particles is fairly small, you could just make every pair an exception (or even just make this a bonded force). Then you can easily turn each interaction on and off independently.

But if you have more than a few hundred particles, that will get very slow. The problem is that you basically want to have O(n^2) parameters (one for every pair of particles), but the nonbonded force only provides O(n) parameters. If the number of interactions is large, but only a small fraction are turned off at any time, you could have a fixed list of exceptions and change what particles they refer to. However, that requires you to reinitialize the context, which is an expensive operation.

POST REPLY