[lammps-users] putting the double well potential inside simulation box

Dear Lammps Users,

Lammps Version: September 2021

I would like to put the double well potential inside the simulation box and a dimer in one of the minima
and visualise the same using Ovito.This potential acts along the x direction of the dimer. The input
for dimer works properly.

However, the input for double well potential gives me an error (can be done by enabling the python package too),and

I read the documentation and the file1.txt has been stored as a numerical value. But the iteration fails with next f.
After storing the data in the form of string with next(f) also fails.

variable f file file1.txt

variable bheight equal 9.0
variable min1 equal 0.45
variable min2 equal 0.075
variable deriv equal (v_bheight/v_min2^4)((v_f-v_min1/2)^2-v_min1^2)^2
variable deriv1 equal (-v_bheight/v_min2^4)
(4*(v_f-(v_min1/2))-4*(v_min2^2)*(v_f-(v_min1/2)))

next f

From the mailing list, I found a reply that I need to find the derivative of the potential with fix add force command
to add the potential in the simulation box. As the iteration fails I am not able to proceed.

Kindly help me and sorry for raising the simple query.

Regards
Vanitha

file1.txt (155 Bytes)

Hi - you can’t use a file-style variable to define a potential that affects atom motion.

Instead you need to define 2 atom-style variables, one that defines the energy of an atom
in the double well as a function of the x coord of an atom. The other that defines the force (in the x direction)
that an atom feels as a function of its x coord. I.e. the negative derivative of the energy equation wrt x.

Then use those 2 variables as inputs to the fix addforce command.

Steve

That’s an elegant explanation steve.thank you