add group cutoff energy function in openmm

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
qian jiaqiang
Posts: 2
Joined: Tue Oct 24, 2017 9:58 am

add group cutoff energy function in openmm

Post by qian jiaqiang » Wed Oct 25, 2017 9:54 am

Dear users and developers:
Hello,
Can i add custon force in openmm ike below?:
f(x) = :
aaaaa 0 < x <= 1
bbbbb 1 < x <= 2
ccccc 2 < x <= 3
I want to use my customed L-J energy function in simulation.

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

Re: add group cutoff energy function in openmm

Post by Peter Eastman » Wed Oct 25, 2017 11:14 am

Sure, this can be done in a few different ways. The simplest is probably to use the step() function, which equals 0 for x<0, 1 for x>=0. You could write something like this:

Code: Select all

aaaa*inrange1 + bbbb*inrange2 + cccc*inrange3;
inrange1=step(1-x);
inrange2=(1-inrange1)*step(2-x);
inrange3=(1-inrange1)*(1-inrange2)
Another option would be to use a tabulated function.

Peter

User avatar
qian jiaqiang
Posts: 2
Joined: Tue Oct 24, 2017 9:58 am

Re: add group cutoff energy function in openmm

Post by qian jiaqiang » Thu Oct 26, 2017 10:12 am

Thank you,Peter。

POST REPLY