closest | closestwaters

Retain only the specified number of solvent molecules closest to specified solute.

closest <# to keep> <mask> [noimage] [first | oxygen] [center][closestout <filename>] [name <setname>] [outprefix <parmprefix>][parmout <file>]

<# to keep> Number of solvent molecules to keep around <mask>
<mask> Mask of atoms to search for closest waters around.
[noimage] Do not perform imaging; only recommended if trajectory has previously been imaged.
[first | oxygen] Calculate distances between all atoms in <mask> and the first atom of solvent only (recommended for standard water models as it will increase speed of calculation).
[center] Search for waters closest to center of <mask> instead of each atom in <mask>.
[closestout <filename>] Write information on the closest solvent molecules to <filename>.
[outprefix <prefix>] Write corresponding topology to file with name prefix <prefix>.
[parmout <file>] Write corresponding topology to file with name <file>.

DataSet Aspects:

[Frame] Frame number.
[Mol] Original solvent molecule number.
[Dist] Solvent molecule distance in Å.
[FirstAtm] First atom number of original solvent molecule.

Similar to the strip command, but modify coordinate frame and topology by keeping only the specified number of closest solvent molecules to the region specified by the given mask. Solvent molecules can be determined automatically by cpptraj (by default residues named WAT, HOH, or TIP3) or can be specified prior via the solvent command .

The format of the closestout file is:

Frame      Molecule      Distance      FirstAtom#

For example, to obtain the 10 closest waters to residues 1-268 by distance to the first atom of the waters, write out which waters were closest for each frame to a file called “closestmols.dat”, and write out the stripped topology with prefix “closest” containing only the solute and 10 waters:

closest 10 :1-268 first closestout closestmols.dat outprefix closest

As of version 17 this command is CUDA-enabled in CUDA versions of CPPTRAJ.