[lammps-users] Fix Twist?

Hi,

I can see that there are several options in lammps to do twisting of the particles. Is anyone aware whether the following proposed fix (fix twist) in the links below is available in the latest version of lammps? Can “fix twist” be replaced with another name?

https://www.youtube.com/watch?v=tnhUKxsAaqw

or
https://www.youtube.com/watch?v=TzCJ4BTUQ20

Thanks,
Hadi

This fix seems to add a torque to a group of atoms. That can be done with the existing fix addtorque command.

This fix seems to add a torque to a group of atoms. That can be done with the existing fix addtorque command.

Hi Axel and Hadi

Sorry. Those aren’t official LAMMPS features. I wrote “fix_twist” and made those videos.

Fix addtorque applies torque to a group of atoms around a predetermined axis. For comparison, “fix_twist” is very similar to fix restrain, but it works for dihedral interactions. It implements a fictitious dihedral interaction between 4 atoms. The axis around which the torque is applied is the axis between the 2nd and 3rd atom. The dihedral interaction can be either a constant torque or a harmonic potential with a minima angle which can increase at a constant rate (demonstrated here). (This will attempt to spin the “motor” at a constant rate.)

The two files that implement this feature (“fix_twist.cpp” and “fix_twist.h”) are available here. If you want to try this out, download the LAMMPS source code, for example using:
git clone https://github.com/lammps/lammps ~/lammps
Then copy those two files to the “src” subdirectly and build LAMMPS (either using make or cmake).

“fix twist” works, but it hasn’t been submitted to LAMMPS and you can only find documentation for it online. In particular, those youtube videos (see below) have a pretty detailed description explaining how to use this feature. Click on the “Show More” button to see the full description below each video to get the instructions how to use “fix twist”.

Constant torque:
https://www.youtube.com/watch?v=TzCJ4BTUQ20

https://www.youtube.com/watch?v=tnhUKxsAaqw
(There’s a complete usage example here and here which explains how to build the polymers in these videos and run the simulations.)

Constant rate of twist:
https://www.youtube.com/watch?v=xU2QzDDmuyA

Alternatively, you can apply a constant torque between 4 atoms by using the existing “dihedral_style table” feature in LAMMPS:

  1. Use “dihedral_style table linear 2” (or “dihedral_style hybrid table…” if other dihedral styles are in use)
  2. Create a dihedral interaction between the same 4 atoms, and setting the 2 numbers in the 4th column to the same non-zero value. (By default this non-zero value should be the torque, in units of energy-per-degree. Alternatively, you can also use units of radians if the “RADIANS” keyword was used in the tabular file.)

The documentation for dihedral_style table is located here. I realize this is confusing so feel free to email me if you get stuck. I should mention that if you use this approach (using dihedral_style table), you can only apply static forces (ie constant torque) to the 4 atoms. You won’t be able to force the motor to spin at a constant rate (which you can do using fix twist). And when using this approach, the potential energy will not be calculated correctly since the force is not conservative.

After several years, this is the first time anyone has expressed interest in “fix twist”, so I never bothered to submit the code for inclusion in LAMMPS. I’m flattered that anyone is interested. If other people actually want this added to LAMMPS, I can submit a pull request with the fix_twist code and add some documentation in .rst file format.

Andrew
P.S. The code for this fix is very simple except for the fact that “fix twist” attempts to keep track of the work done while twisting so that the potential energy can be calculated. This complicated the code significantly because I have to keep track of the torsion angle for every twist motor (which no longer necessarily lies in the range from 0 to 360 degrees). Furthermore, the ownership of that torsion angle can migrate from processor to processor as those atoms move during the simulation. I’m not sure if it was worth the effort to implement this. If trying to keep track of the work done by each twist motor makes the code too ugly, I’m happy to remove that capability.