Read atom-IDs from a file (setforce)

Dear Lammps users,

I am trying to fix forces to some atoms using ‘setforce’ so the atoms don’t move during equilibrations. The atoms are not grouped by ‘region’ but by ‘group’ function with atom-IDs. (e.g., group sub id 10 25 50) I wonder if I can read the atom-IDs from a file instead of listing them within the input file. I looked up the ‘read_data’ but there’s no option for fixing force to each atom.

Thank you in advance,

You can read a file of IDs by variable command file keyword, then group command variable keyword to group them.

Ray Shan

The group variable command expects an atom-style variable
with the values set to 0 or 1. It puts the atoms with value = 1
into the group.

So to set that up, you could use an atomfile-style varaible,
which is a bit different than the atom-style variable, but can
be used interchangeably (e.g. by the group command).

The variable doc page explains atomfile-style vars. Basically
you could create a file that lists the IDs of the atoms you
want in the group, all with a value of 1.

Steve