Hi,
I’m using atom_style full and have defined molecules. I am needing to specify a group with the last 5 molecules but in each input, there is a different number of molecules. Is there a way to get the number of molecules, for instance like the thermo_style keywords atoms, bonds, angles, dihedrals, impropers.
Thanks for the help,
Frank
LAMMPS as such does not know anything about molecules. It just looks at pairs, bonds, angles, etc.
So you need something that identifies molecules as unique entities and then you can use that information with compute chunk/atom. If you assign molecule IDs to match molecules, then this is easy. Other than that, you may need to use something like compute fragment/atom.
Hi Axel,
I was able to get the number of molecules like this:
variable num_atoms_temp equal atoms
variable num_atoms equal ${num_atoms_temp}
variable num_mols equal mol[${num_atoms}]
Thanks,
Frank
Hmm… how about this?
variable num_mols equal mol[$(atoms)]
Should do the same with fewer evaluations.
Hi Axel and everyone else,
For future reference, your suggestion worked perfectly!
Thanks,
Frank