WRAPAROUND
This is part of the generic module

Rebuild periodic boundary conditions around chosen atoms.

Modify position of atoms indicated by ATOMS by shifting them by lattice vectors so that they are as close as possible to the atoms indicated by AROUND. More precisely, for every atom i in the ATOMS list the following procedure is performed:

  • The atom j among those in the AROUND list is searched that is closest to atom i.
  • The atom i is replaced with its periodic image that is closest to atom j.

This action works similarly to WHOLEMOLECULES in that it replaces atoms coordinate. Notice that only atoms specified with ATOMS are replaced, and that, at variance with WHOLEMOLECULES, the order in which atoms are specified is irrelevant.

This is often convenient at a post processing stage (using the driver), but sometime it is required during the simulation if collective variables need atoms to be in a specific periodic image.

Attention
This directive modifies the stored position at the precise moment it is executed. This means that only collective variables which are below it in the input script will see the corrected positions. As a general rule, put it at the top of the input file. Also, unless you know exactly what you are doing, leave the default stride (1), so that this action is performed at every MD step.

Consider that the computational cost grows with the product of the size of the two lists (ATOMS and AROUND), so that this action can become very expensive. If you are using it to analyze a trajectory this is usually not a big problem. If you use it to analyze a simulation on the fly, e.g. with DUMPATOMS to store a properly wrapped trajectory, consider the possibility of using the STRIDE keyword here (with great care).

Examples

This command instructs plumed to move all the ions to their periodic image that is as close as possible to the rna group.

Click on the labels of the actions for more information on what each action computes
tested on v2.9
rna: GROUP ATOMSthe numerical indexes for the set of atoms in the group. =1-100 
ions: GROUP ATOMSthe numerical indexes for the set of atoms in the group. =101-110 
# first make the rna molecule whole
WHOLEMOLECULES ENTITY0the atoms that make up a molecule that you wish to align. =rna 
WRAPAROUND ATOMSwrapped atoms. =ions AROUNDreference atoms. =rna 
DUMPATOMS FILEcompulsory keyword 
file on which to output coordinates; extension is automatically detected =dump.xyz ATOMSthe atom indices whose positions you would like to print out. =rna,ions 

In case you want to do it during a simulation and you only care about wrapping the ions in the dump.xyz file, you can use the following:

Click on the labels of the actions for more information on what each action computes
tested on v2.9
# add some restraint that do not require molecules to be whole:
a: TORSION ATOMSthe four atoms involved in the torsional angle =1,2,10,11 
RESTRAINT ARGthe input for this action is the scalar output from one or more other actions. =a ATcompulsory keyword 
the position of the restraint =0.0 KAPPAcompulsory keyword ( default=0.0 )
specifies that the restraint is harmonic and what the values of the force constants
on each of the variables are =5 
# then do the things that are required for dumping the trajectory
# notice that they are all done every 100 steps, so as not to
# unnecessarily overload the calculation
rna: GROUP ATOMSthe numerical indexes for the set of atoms in the group. =1-100 
ions: GROUP ATOMSthe numerical indexes for the set of atoms in the group. =101-110 
# first make the rna molecule whole
WHOLEMOLECULES ENTITY0the atoms that make up a molecule that you wish to align. =rna STRIDEcompulsory keyword ( default=1 )
the frequency with which molecules are reassembled. =100 
WRAPAROUND ATOMSwrapped atoms. =ions AROUNDreference atoms. =rna STRIDEcompulsory keyword ( default=1 )
the frequency with which molecules are reassembled. =100 
DUMPATOMS FILEcompulsory keyword 
file on which to output coordinates; extension is automatically detected =dump.xyz ATOMSthe atom indices whose positions you would like to print out. =rna,ions STRIDEcompulsory keyword ( default=1 )
the frequency with which the atoms should be output =100 

Notice that if the biased variable requires a molecule to be whole, you might have to put just the WHOLEMOLECULES command before computing that variable and leave the default STRIDE=1.

This command instructs plumed to center all atoms around the center of mass of a solute molecule.

Click on the labels of the actions for more information on what each action computes
tested on v2.9
solute: GROUP ATOMSthe numerical indexes for the set of atoms in the group. =1-100 
all: GROUP ATOMSthe numerical indexes for the set of atoms in the group. =1-1000 
# center of the solute:
# notice that since plumed 2.2 this also works if the
# solute molecule is broken
com: COM ATOMSthe list of atoms which are involved the virtual atom's definition. =solute 
# notice that we wrap around a single atom. this should be fast
WRAPAROUND ATOMSwrapped atoms. =all AROUNDreference atoms. =com 
DUMPATOMS FILEcompulsory keyword 
file on which to output coordinates; extension is automatically detected =dump.xyz ATOMSthe atom indices whose positions you would like to print out. =all 

Notice that whereas WHOLEMOLECULES is designed to make molecules whole, WRAPAROUND can easily break molecules. In the last example, if solvent (atoms 101-1000) is made e.g. of water, then water molecules could be broken by WRAPAROUND (hydrogen could end up in an image and oxygen in another one). One solution is to use WHOLEMOLECULES on all the water molecules after WRAPAROUND. This is tedious. A better solution is to use the GROUPBY option which is going to consider the atoms listed in ATOMS as a list of groups each of size GROUPBY. The first atom of the group will be brought close to the AROUND atoms. The following atoms of the group will be just brought close to the first atom of the group. Assuming that oxygen is the first atom of each water molecules, in the following examples all the water oxygen atoms will be brought close to the solute, and all the hydrogen atoms will be kept close to their related oxygen.

Click on the labels of the actions for more information on what each action computes
tested on v2.9
solute: GROUP ATOMSthe numerical indexes for the set of atoms in the group. =1-100 
water: GROUP ATOMSthe numerical indexes for the set of atoms in the group. =101-1000 
com: COM ATOMSthe list of atoms which are involved the virtual atom's definition. =solute 
# notice that we wrap around a single atom. this should be fast
WRAPAROUND ATOMSwrapped atoms. =solute AROUNDreference atoms. =com 
# notice that we wrap around a single atom. this should be fast
WRAPAROUND ATOMSwrapped atoms. =water AROUNDreference atoms. =com GROUPBYcompulsory keyword ( default=1 )
group atoms so as not to break molecules =3 
DUMPATOMS FILEcompulsory keyword 
file on which to output coordinates; extension is automatically detected =dump.xyz ATOMSthe atom indices whose positions you would like to print out. =solute,water 
Glossary of keywords and components
The atoms involved can be specified using
AROUND reference atoms. For more information on how to specify lists of atoms see Groups and Virtual Atoms
ATOMS wrapped atoms. For more information on how to specify lists of atoms see Groups and Virtual Atoms
Compulsory keywords
STRIDE ( default=1 ) the frequency with which molecules are reassembled. Unless you are completely certain about what you are doing leave this set equal to 1!
GROUPBY ( default=1 ) group atoms so as not to break molecules
Options
PAIR

( default=off ) Pair atoms in AROUND and ATOMS groups