In LAMMPS, the set command is used to modify atom-specific properties in your simulation, such as velocities, forces, molecule IDs (mol), charges, and more. Your command:
set group gpCTmob mol 1
What does this do?
set: The command used to modify atom properties.
group gpCTmob: Specifies the group of atoms on which this operation will be applied. The group name is gpCTmob.
mol 1: Assigns the molecule ID (mol) of all atoms in the group gpCTmob to 1.
Purpose:
This command is effectively setting the molecule ID (mol) for all atoms in the group gpCTmob to 1. Assigning molecule IDs is useful in simulations where atoms are grouped into molecules, and operations (such as rigid body dynamics, center-of-mass calculations, or group-specific fixes) require molecule IDs.
When should this command be used?
- For grouping molecules: When you are assigning molecule IDs to atoms that belong to a specific molecule, e.g., in a simulation of water, protein, or other multi-atom molecules.
- To enable certain LAMMPS features: Features such as
fix rigid, compute com/molecule, or fix gcmc require molecule IDs. Without molecule IDs, these commands will not function properly.
An example use case would be assigning molecule IDs to atoms in a rigid body (e.g., a protein or aggregate), or labeling sections of a larger molecule or system.
Example Use Case in a LAMMPS Script:
1. Assign a Molecule ID to Specific Atoms:
For instance, given that gpCTmob is a predefined group of atoms, we can assign them all the same molecule ID. This happens after defining a group:
# Define a group of atoms (e.g., via group or region commands)
group gpCTmob id 100:200
# Assign molecule ID = 1 to all atoms in the gpCTmob group
set group gpCTmob mol 1
Here, all atoms with IDs from 100 to 200 (inside gpCTmob) will now have a molecule ID of 1.
How to Confirm mol Values?
To verify that the mol values have been correctly assigned, you can use the dump command:
dump mol_dump gpCTmob custom 100 mol_dump.txt id type mol x y z
This will output the following:
id: Atom ID
type: Atom type
mol: Molecule ID
x y z: Atom coordinates
Check the mol column in the output file (mol_dump.txt) to confirm that all atoms in the gpCTmob group have the molecule ID 1.
Other Important Details:
-
Preconditions:
- The
mol property must already exist.
- Without defining
mol, LAMMPS may throw an error if it's not already present within the atoms' properties.
-
Idempotent Behavior:
- When using
set group ... mol, it will overwrite the molecule ID for all atoms in the specified group. Make sure you don’t inadvertently overwrite other molecule IDs if you're simulating multiple molecules in your system.
-
Multiple Groups:
Final Thought:
Assigning molecule IDs is often crucial for simulations that involve molecular or rigid-body dynamics. Your command is doing exactly that for the group gpCTmob. Make sure you define this group (e.g., via group or region-based commands) and that the mol property is either initialized in your data file or has been added using fix property/atom mol.
Feel free to ask if you want to clarify or expand on this further!