DUMPMASSCHARGE
This is part of the generic module

Dump masses and charges on a selected file.

This command dumps a file containing charges and masses. It does so only once in the simulation (at first step). File can be recycled in the driver tool.

Notice that masses and charges are only written once at the beginning of the simulation. In case no atom list is provided, charges and masses for all atoms are written.

Examples

You can add the DUMPMASSCHARGE action at the end of the plumed.dat file that you use during an MD simulations:

Click on the labels of the actions for more information on what each action computes
tested on v2.7
c1: COM 
ATOMS
the list of atoms which are involved the virtual atom's definition.
=1-10 c2: COM
ATOMS
the list of atoms which are involved the virtual atom's definition.
=11-20 DUMPATOMS
ATOMS
the atom indices whose positions you would like to print out.
=c1,c2
FILE
compulsory keyword file on which to output coordinates; extension is automatically detected
=coms.xyz
STRIDE
compulsory keyword ( default=1 ) the frequency with which the atoms should be output
=100 DUMPMASSCHARGE
FILE
compulsory keyword file on which to output charges and masses.
=mcfile

In this way, you will be able to use the same masses while processing a trajectory from the driver . To do so, you need to add the –mc flag on the driver command line, e.g.

plumed driver --mc mcfile --plumed plumed.dat --ixyz traj.xyz

With the following input you can dump only the charges for a specific group.

Click on the labels of the actions for more information on what each action computes
tested on v2.7
solute_ions: GROUP 
ATOMS
the numerical indexes for the set of atoms in the group.
=1-121,200-2012 DUMPATOMS
FILE
compulsory keyword file on which to output coordinates; extension is automatically detected
=traj.gro
ATOMS
the atom indices whose positions you would like to print out.
=solute_ions
STRIDE
compulsory keyword ( default=1 ) the frequency with which the atoms should be output
=100 DUMPMASSCHARGE
FILE
compulsory keyword file on which to output charges and masses.
=mcfile
ATOMS
the atom indices whose charges and masses you would like to print out.
=solute_ions

Notice however that if you want to process the charges with the driver (e.g. reading traj.gro) you have to fix atom numbers first, e.g. with the script

awk 'BEGIN{c=0}{
  if(match($0,"#")) print ; else {print c,$2,$3; c++}
}' < mc > newmc
}'

then

plumed driver --mc newmc --plumed plumed.dat --ixyz traj.gro
Glossary of keywords and components
The atoms involved can be specified using
ATOMS the atom indices whose charges and masses you would like to print out. For more information on how to specify lists of atoms see Groups and Virtual Atoms
Compulsory keywords
STRIDE ( default=1 ) the frequency with which the atoms should be output
FILE file on which to output charges and masses.
Options
ONLY_MASSES ( default=off ) Only output masses to file
ONLY_CHARGES

( default=off ) Only output charges to file