GROUP

Define a group of atoms so that a particular list of atoms can be referenced with a single label in definitions of CVs or virtual atoms.

Atoms can be listed as comma separated numbers (i.e. 1,2,3,10,45,7,9) , simple positive ranges (i.e. 20-40), ranges with a stride either positive or negative (i.e. 20-40:2 or 80-50:-2) or as comma separated combinations of all the former methods (1,2,4,5,10-20,21-40:2,80-50:-2).

Moreover, lists can be imported from ndx files (GROMACS format). Use NDX_FILE to set the name of the index file and NDX_GROUP to set the name of the group to be imported (default is first one). Notice that starting from version 2.10 it is possible to directly use an @ndx: selector (see Groups and Virtual Atoms).

It is also possible to remove atoms from a list and or sort them using keywords REMOVE, SORT, and UNIQUE. The flow is the following:

  • If ATOMS is present, then take the ordered list of atoms from the ATOMS keyword as a starting list.
  • Alternatively, if NDX_FILE is present, use the list obtained from the gromacs group.
  • If REMOVE is present, then remove the first occurrence of each of these atoms from the list. If one tries to remove an atom that was not listed plumed adds a notice in the output. An atom that is present twice in the original list might be removed twice.
  • If SORT is present, then the resulting list is sorted by increasing serial number.
  • If UNIQUE is present, then the resulting list is sorted by increasing serial number and duplicate elements are removed.

Notice that this command just creates a shortcut, and does not imply any real calculation. So, having a huge group defined does not slow down your calculation in any way. It is just convenient to better organize input files. Might be used in combination with the INCLUDE command so as to store long group definitions in a separate file.

Examples

This command create a group of atoms containing atoms 1, 4, 7, 11 and 14 (labeled 'o'), and another containing atoms 2, 3, 5, 6, 8, 9, 12, and 13 (labeled 'h'):

Click on the labels of the actions for more information on what each action computes
tested on master
o: GROUP 
ATOMS
the numerical indexes for the set of atoms in the group.
=1,4,7,11,14 h: GROUP
ATOMS
the numerical indexes for the set of atoms in the group.
=2,3,5,6,8,9,12,13 # compute the coordination among the two groups c: COORDINATION
GROUPA
First list of atoms.
=o
GROUPB
Second list of atoms (if empty, N*(N-1)/2 pairs in GROUPA are counted).
=h
R_0
could not find this keyword
=0.3 # same could have been obtained without GROUP, just writing: # c: COORDINATION GROUPA=1,4,7,11,14 GROUPB=2,3,5,6,8,9,12,13 # print the coordination on file 'colvar' PRINT
ARG
compulsory keyword the labels of the values that you would like to print to the file
=c
FILE
the name of the file on which to output these quantities
=colvar

Groups can be conveniently stored in a separate file. E.g. one could create a file named groups.dat which reads

Click on the labels of the actions for more information on what each action computes
tested on master
#SETTINGS FILENAME=groups.dat
# this is groups.dat
o: GROUP 
ATOMS
the numerical indexes for the set of atoms in the group.
=1,4,7,11,14 h: GROUP
ATOMS
the numerical indexes for the set of atoms in the group.
=2,3,5,6,8,9,12,13

and then include it in the main 'plumed.dat' file

Click on the labels of the actions for more information on what each action computes
tested on master
INCLUDE 
FILE
compulsory keyword file to be included
=groups.dat # compute the coordination among the two groups c: COORDINATION
GROUPA
First list of atoms.
=o
GROUPB
Second list of atoms (if empty, N*(N-1)/2 pairs in GROUPA are counted).
=h
R_0
could not find this keyword
=0.3 # print the coordination on file 'colvar' PRINT
ARG
compulsory keyword the labels of the values that you would like to print to the file
=c
FILE
the name of the file on which to output these quantities
=colvar

The groups.dat file could be very long and include lists of thousand atoms without cluttering the main plumed.dat file.

A GROMACS index file such as the one shown below:

[ Protein ]
1 3 5 7 9
2 4 6 8 10
[ Group2 ]
30 31 32 33 34 35 36 37 38 39 40
5

can also be imported by using the GROUP keyword as shown below

Click on the labels of the actions for more information on what each action computes
tested on master
# import group named 'Protein' from file index.ndx
pro: GROUP 
NDX_FILE
the name of index file (gromacs syntax)
=index.ndx
NDX_GROUP
the name of the group to be imported (gromacs syntax) - first group found is used by default
=Protein # dump all the atoms of the protein on a trajectory file DUMPATOMS
ATOMS
the atom indices whose positions you would like to print out.
=pro
FILE
compulsory keyword file on which to output coordinates; extension is automatically detected
=traj.gro

Notice that it is now possible to directly use the @ndx: selector in the definition of collective variables. Thus, the same result can be obtained with the following input:

Click on the labels of the actions for more information on what each action computes
tested on master
DUMPATOMS 
ATOMS
the atom indices whose positions you would like to print out.
={@ndx:{index.ndx Protein}}
FILE
compulsory keyword file on which to output coordinates; extension is automatically detected
=traj.gro

A list can be edited with REMOVE. For instance, if you are using a water model with three atoms per molecule, you can easily construct the list of hydrogen atoms in this manner

Click on the labels of the actions for more information on what each action computes
tested on master
# take one atom every three, that is oxygens
ox: GROUP 
ATOMS
the numerical indexes for the set of atoms in the group.
=1-90:3 # take the remaining atoms, that is hydrogens hy: GROUP
ATOMS
the numerical indexes for the set of atoms in the group.
=1-90
REMOVE
remove these atoms from the list.
=ox DUMPATOMS
ATOMS
the atom indices whose positions you would like to print out.
=ox
FILE
compulsory keyword file on which to output coordinates; extension is automatically detected
=ox.gro DUMPATOMS
ATOMS
the atom indices whose positions you would like to print out.
=hy
FILE
compulsory keyword file on which to output coordinates; extension is automatically detected
=hy.gro
Glossary of keywords and components
The atoms involved can be specified using
ATOMS the numerical indexes for the set of atoms in the group. For more information on how to specify lists of atoms see Groups and Virtual Atoms
REMOVE remove these atoms from the list. For more information on how to specify lists of atoms see Groups and Virtual Atoms
Options
SORT ( default=off ) sort the resulting list
UNIQUE

( default=off ) sort atoms and remove duplicated ones

NDX_FILE the name of index file (gromacs syntax)
NDX_GROUP the name of the group to be imported (gromacs syntax) - first group found is used by default