Action: GROUP
| Module | core |
|---|---|
| Description | Usage |
| 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. | |
| This action outputs data to a file. You can read more about how PLUMED manages output files here |
Details and examples
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.
The GROUP command can be used to define a list of atoms so that the group can be referenced in the definitions of other CVs or virtual atoms as shown below:
o: GROUPDefine 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. More details ATOMSthe numerical indexes for the set of atoms in the group=1,4,7,11,14 h: GROUPDefine 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. More details ATOMSthe 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: COORDINATIONCalculate coordination numbers. This action has hidden defaults. More details GROUPAFirst list of atoms=o GROUPBSecond list of atoms (if empty, N*(N-1)/2 pairs in GROUPA are counted)=h R_0The r_0 parameter of the switching function=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' PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=c FILEthe name of the file on which to output these quantities=colvar
The first group command here creates a group of atoms called o containing atoms 1, 4, 7, 11 and 14.
The second group command here creates a group of toms called h containing atoms 2, 3, 5, 6, 8, 9, 12, and 13.
As discussed on this page atoms in groups 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).
Oftentime people will store the definitions in a separate file as has been done in the following example input.
INCLUDEIncludes an external input file, similar to #include in C preprocessor. More details. Show included file FILEfile to be included=extras/groups.dat # compute the coordination among the two groups c: COORDINATIONCalculate coordination numbers. This action has hidden defaults. More details GROUPAFirst list of atoms=groupa GROUPBSecond list of atoms (if empty, N*(N-1)/2 pairs in GROUPA are counted)=groupb R_0The r_0 parameter of the switching function=0.3 # print the coordination on file 'colvar' PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=c FILEthe name of the file on which to output these quantities=colvar
Storing the groups in the extra file is particularly useful if the groups include list of thousand atoms. Putting these definitions in a separate file ensures that the main plumed.dat file is not cluttered. You can even use a GROMACS index file to hold the groups as illustrated in the input below:
# import group named 'Protein' from file index.ndx pro: GROUPDefine 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. More details NDX_FILEthe name of index file (gromacs syntax)=extras/index.ndx NDX_GROUPthe 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 DUMPATOMSDump selected atoms on a file. More details ATOMSthe atom indices whose positions you would like to print out=pro FILEfile on which to output coordinates; extension is automatically detected=traj.gro
Notice that you use the keyword 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).
Further notice that starting from version 2.10 it is possible to directly use an @ndx: selector in the input to an action as shwn below:
DUMPATOMSDump selected atoms on a file. More details ATOMSthe atom indices whose positions you would like to print out={@ndx:load a group from a GROMACS index file. Click here for more information. {extras/index.ndx Protein}} FILEfile on which to output coordinates; extension is automatically detected=traj.gro
Notice that it is possible to remove atoms from the list of atoms specified in a GROUP by using the keyword REMOVE as shown below:
# take one atom every three, that is oxygens ox: GROUPDefine 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. More details ATOMSthe numerical indexes for the set of atoms in the group=1-90:3 # take the remaining atoms, that is hydrogens hy: GROUPDefine 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. More details ATOMSthe numerical indexes for the set of atoms in the group=1-90 REMOVEremove these atoms from the list=ox DUMPATOMSDump selected atoms on a file. More details ATOMSthe atom indices whose positions you would like to print out=ox FILEfile on which to output coordinates; extension is automatically detected=ox.gro DUMPATOMSDump selected atoms on a file. More details ATOMSthe atom indices whose positions you would like to print out=hy FILEfile on which to output coordinates; extension is automatically detected=hy.gro
You can also SORT the atoms in a group into ascending order by using the SORT keyword as shown below:
# If you ask for this group in the input to another action the atoms will be # in ascending order i.e. the specified atoms will be 2,3,4,4,5,6 g: GROUPDefine 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. More details ATOMSthe numerical indexes for the set of atoms in the group=5,4,6,3,4,2 SORT sort the resulting list
or you can sort the atoms and remove duplicated atoms by using the UNIQUE flag
# If you ask for this group in the input to another action the duplicate atom specifications will be removed # and the atoms will be ascending order i.e. the specified atoms will be 2,3,4,5,6 g: GROUPDefine 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. More details ATOMSthe numerical indexes for the set of atoms in the group=5,4,6,3,4,2 UNIQUE sort atoms and remove duplicated ones
When you used the GROUP command the flow as follows:
- If
ATOMSis present, then take the ordered list of atoms from theATOMSkeyword as a starting list. - Alternatively, if
NDX_FILEis present, use the list obtained from the gromacs group. - If
REMOVEis 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
SORTis present, then the resulting list is sorted by increasing serial number. - If
UNIQUEis 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.
Input
The atoms that serve as the input for this action are specified using one or more of the keywords in the following table.
| Keyword | Type | Description |
|---|---|---|
| ATOMS | atoms | the numerical indexes for the set of atoms in the group |
| REMOVE | atoms | remove these atoms from the list |
Full list of keywords
The following table describes the keywords and options that can be used with this action
| Keyword | Type | Default | Description |
|---|---|---|---|
| ATOMS | input | none | the numerical indexes for the set of atoms in the group |
| REMOVE | input | none | remove these atoms from the list |
| SORT | optional | false | sort the resulting list |
| UNIQUE | optional | false | sort atoms and remove duplicated ones |
| NDX_FILE | optional | not used | the name of index file (gromacs syntax) |
| NDX_GROUP | optional | not used | the name of the group to be imported (gromacs syntax) - first group found is used by default |