# this is for a neutral group:
mu1: DIPOLE GROUP=1-10
mu1n: DIPOLE GROUP=1-10 NUMERICAL_DERIVATIVES

# this is for a non-neutral group, which implies neutralization
mu2: DIPOLE GROUP=1-6
mu2n: DIPOLE GROUP=1-6 NUMERICAL_DERIVATIVES

# this is to test components
mu3: DIPOLE GROUP=1-6 COMPONENTS
mu3n: DIPOLE GROUP=1-6 COMPONENTS NUMERICAL_DERIVATIVES

DUMPDERIVATIVES FILE=mu1 ARG=mu1,mu1n FMT=%6.5f
DUMPDERIVATIVES FILE=mu2 ARG=mu2,mu2n FMT=%6.5f
DUMPDERIVATIVES FILE=mu3 ARG=mu3.*,mu3n.* FMT=%6.5f

# here I explicitly code the calculation of the dipole
# in alternative manners, as a test
c1: CENTER ATOMS=1-5
c2: CENTER ATOMS=6-10
xx1: DISTANCE ATOMS=c1,c2
mu1alt: COMBINE ARG=xx1 COEFFICIENTS=2.5 PERIODIC=NO
xx2: DISTANCE ATOMS=6,c1
mu2alt: COMBINE ARG=xx2 COEFFICIENTS=0.833333333 PERIODIC=NO

xx3: DISTANCE ATOMS=6,c1 COMPONENTS
mu3altx: COMBINE ARG=xx3.x COEFFICIENTS=0.833333333 PERIODIC=NO
mu3alty: COMBINE ARG=xx3.y COEFFICIENTS=0.833333333 PERIODIC=NO
mu3altz: COMBINE ARG=xx3.z COEFFICIENTS=0.833333333 PERIODIC=NO

PRINT ...
  STRIDE=2
  ARG=mu1,mu2,mu1alt,mu2alt,mu3.*,mu3altx,mu3alty,mu3altz
  FILE=COLVAR FMT=%6.5f
... PRINT

# this writes all physical atoms
DUMPMASSCHARGE FILE=mc
# this writes selected atoms (including two virtuals)
DUMPMASSCHARGE FILE=mc2 ATOMS=1-10,c1,c2

ENDPLUMED

