Page 1 of 1

add group cutoff energy function in openmm

Posted: Wed Oct 25, 2017 9:54 am
by qianjiaqiang
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.

Re: add group cutoff energy function in openmm

Posted: Wed Oct 25, 2017 11:14 am
by peastman
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

Re: add group cutoff energy function in openmm

Posted: Thu Oct 26, 2017 10:12 am
by qianjiaqiang
Thank you,Peter。