# Potential energy associated with a molecule

I am trying to simuate ring polymers in lammps. I want to put constraint on its area by associating a potential energy porpotional to its area .The area can be calculated from all its positions of beads if provided in a serial manner .
I am trying it by creating a ring polymer molecule .I am stuck how to associate potential energy to a molecule and adding force due to it on individual atoms in lammps ?

If I understand your message correctly, you want to impose a position dependent force to your atoms. You can do it using fix addforce with the energy keyword. For instance, the following lines are the commands I use to impose an arctan-like potential:

``````variable U0 equal 1.5*\${epsilon} # Kcal/mol
variable dlt equal 1.0 # Angstrom
variable x0 equal 10.0  # Angstrom

variable U atom \${U0}*atan((x+\${x0})/\${dlt})-\${U0}*atan((x-\${x0})/\${dlt})
variable F atom \${U0}/((x-\${x0})^2/\${dlt}^2+1)/\${dlt}-\${U0}/((x+\${x0})^2/\${dlt}^2+1)/\${dlt}
``````

Where the force F is the derivative of U.

Simon

Thanks Simon ,
But I am simulating with a molecule where the potential energy of one atom is dependent on position of other atoms as welll, here your potential energy of the atom dependent on position of itself only.
Deepak

Can you write the equation of what you want to impose? I would say that if it can be written, it should be doable.

Here (xi,yi) means the position of i_th bead of my polymer

I don’t think that this is enough, you need to write it in terms of force like I did in the example before. Then, convert it in “LAMMPS-readable” format and try to apply it to your system. As it is, I see no reason for it not to work but I am may be missing something.

From my intuition and a quick glance, this will essentially work out to be an angle force, but where some parameters entering the force at each step must first be “collected” over the whole molecule. I think you will need to program this in C++ as a new angle style.