PLUMED¶
The thread count comes from PLUMED_NUM_THREADS. Set that variable
before PLUMED starts. OMP_NUM_THREADS does not change the PLUMED team.
SEAMS is a collective variable with five components.
seams.q6is the mean local q6. Its derivatives are a central difference, soRESTRAINTcan bias it. APRINTleaves that derivative array empty, and the difference runs only after aRESTRAINThas allocated it.seams.iceis the fraction of atoms published CHILL+ calls cubic. The label is discrete, so the component has no derivatives and is not biasable.seams.ringis the fraction of atoms on a primitive six-ring. It is not biasable either: aRESTRAINTonseams.iceorseams.ringis rejected because those components carry no derivatives.seams.hexagonalis the CHILL+ hexagonal count.seams.sixis the primitive six-ring count.
MODE=q6 computes only the mean local q6 and MODE=q6bar only the
mean Lechner-Dellago q6-bar, which has no derivatives. Neither runs CHILL+
or the ring search, and neither has the other four components. DUMP=file
appends one LAMMPS dump frame per call with the coordinates handed to
d-SEAMS, in angstroms, the per-atom q6 or q6-bar, and under MODE=all the
CHILL+ label. seams chill-plus reads that dump back.
meson test plumed_driver runs engines/plumed/plumed.dat, and
meson test docs_engine_plumed runs the same SEAMS line on
input/traj/ice1h.lammpstrj. meson test plumed_e2e runs LAMMPS
fix plumed on mW ice and liquid and compares every dumped label with
the CLI. It loads the libplumedKernel.so named by PLUMED_KERNEL, or the
one beside plumed on PATH when that is unset. The collective variable calls seams_q4q6, seams_chill_plus
and seams_rings_find after scaling PLUMED lengths to angstroms. The q6
derivative uses a 0.001 angstrom step and is converted to PLUMED’s length
unit.
LOAD FILE=./libSeamsPlumed.so
seams: SEAMS ATOMS=1-64 CUTOFF=3.5
RESTRAINT ARG=seams.q6 AT=0.5 KAPPA=10.0
PRINT ARG=seams.q6,seams.ice,seams.ring FILE=colvar STRIDE=1
bool SeamsCV::score(const std::vector<double> &xyz, const double box9[9], Score &out, bool keep) {
const int n = static_cast<int>(xyz.size() / 3);
seams_system *sys = seams_system_create();
if (sys == nullptr || seams_system_set_frame(sys, xyz.data(), n, box9, nullptr, nullptr) != SEAMS_OK) {
seams_system_destroy(sys);
return false;
}
peratom_.resize(static_cast<std::size_t>(n));
bool ok = true;
if (mode_ == Mode::q6bar) {
double mean = 0.0;
ok = seams_q6bar(sys, cutoff_, 0, 0.36, peratom_.data(), peratom_.size(), &mean, nullptr,
nullptr) == SEAMS_OK;
double sum = 0.0;
for (double value : peratom_) sum += value;
out.q6 = sum / static_cast<double>(n);
} else {
ok = seams_q4q6(sys, cutoff_, 0, nullptr, peratom_.data()) == SEAMS_OK;
double sum = 0.0;
for (double value : peratom_) sum += value;
out.q6 = sum / static_cast<double>(n);
}
if (ok && mode_ == Mode::all && keep) {
labels_.resize(static_cast<std::size_t>(n));
int counts[9] = {};
seams_rings *rings = nullptr;
int hist[7] = {};
ok = seams_chill_plus(sys, cutoff_, 0, SEAMS_GRAPH_CUTOFF, SEAMS_CHILL_PUBLISHED,
labels_.data(), counts) == SEAMS_OK &&
seams_rings_find(sys, cutoff_, 0, SEAMS_GRAPH_CUTOFF, 6, &rings) == SEAMS_OK &&
seams_rings_fraction(rings, 6, &out.ring) == SEAMS_OK &&
seams_rings_histogram(rings, hist, 7) == SEAMS_OK;
seams_rings_destroy(rings);
out.ice = static_cast<double>(counts[SEAMS_LABEL_CUBIC]) / static_cast<double>(n);
out.hexagonal = counts[SEAMS_LABEL_HEXAGONAL];
out.six = hist[6];
}
seams_system_destroy(sys);
return ok;
}
getPosition and getBox are in PLUMED’s internal length unit, nanometers
unless UNITS LENGTH changes it. The plugin reads that unit and converts
both to angstroms before calling d-SEAMS, so UNITS LENGTH=A and the
default give the same result; meson test plumed_units checks that on
ice.xyz. CUTOFF is always angstroms. ice.xyz is the cubic cell in
nanometers, so the driver reads it in the default MD length unit. Load
libSeamsPlumed.so with LOAD before SEAMS.
On the ideal cell q6 is high, the ice fraction is 1, and the ring fraction is
positive. The restraint biases seams.q6 only.