This is part of the generic module |
Embed a separate PLUMED instance.
This command can be used to embed a separate PLUMED instance. Only required atoms will be passed to that instance, using an interface that is similar to the one used when calling PLUMED from the NAMD engine.
Notice that the two instances are running in the same UNIX process, so that they cannot be perfectly isolated. However, most of the features are expected to work correctly.
Notes:
CHDIR
is not thread safe. However, in most implementations there will be a single process running PLUMED, with perhaps multiple OpenMP threads spawn in order to parallelize the calculation of individual variables. So, this is likely not a problem.As an advanced feature, one can use the option KERNEL
to select the version of the guest PLUMED instance. In particular, an empty KERNEL
(default) implies that the guest PLUMED instance is the same as the host one (no library is loaded). On the other hand, KERNEL=/path/to/libplumedKernel.so
will allow specifying a library to be loaded for the guest instance. In addition to those mentioned above, this feature has limitations mostly related to clashes in the symbols defined in the different instances of the PLUMED library:
--runtime
and you should export PLUMED_LOAD_NAMESPACE=LOCAL
before starting the MD engine.plumed-runtime
executable (contained in the prefix/lib/plumed/
directory), export PLUMED_KERNEL
equal to the path of the host kernel library (as usual in runtime loading) and export PLUMED_LOAD_NAMESPACE=LOCAL
before launching plumed-runtime driver
.KERNEL
should in principle work correctly. To achieve namespace separation we are loading the guest kernel with RTLD_DEEPBIND
. However, this might create difficult to track problems in other linked libraries.RTLD_DEEPBIND
is not available kernels will not load correctly.A possible solution for the symbol clashes (not tested) could be to recompile the alternative PLUMED versions using separate C++ namespaces (e.g. ./configure CPPFLAGS=-DPLMD=PLMD_2_3
).
STRIDE
different from 1).DataFetchingObject
class.Here an example plumed file:
# plumed.dat p: PLUMEDFILE=plumed2.dat PRINTinput file for the guest PLUMED instanceARG=p.biasthe input for this action is the scalar output from one or more other actions.FILE=COLVARthe name of the file on which to output these quantities
plumed2.dat
can be an arbitrary plumed input file, for instance
#SETTINGS FILENAME=plumed2.dat # plumed2.dat d: DISTANCEATOMS=1,10 RESTRAINTthe pair of atom that we are calculating the distance between.ARG=dthe input for this action is the scalar output from one or more other actions.KAPPA=10compulsory keyword ( default=0.0 ) specifies that the restraint is harmonic and what the values of the force constants on each of the variables areAT=2compulsory keyword the position of the restraint
Now a more useful example. Imagine that you ran simulations using two different PLUMED input files. The files are long and complex and there are some clashes in the name of the variables (that is: same names are used in both files, same files are written, etc). In addition, files might have been written using different units (see UNITS`). If you want to run a single simulation with a bias potential that is the sum of the two bias potentials, you can:
directory1
and directory2
.# plumed.dat PLUMEDFILE=plumed.datinput file for the guest PLUMED instanceCHDIR=directory1 PLUMEDrun guest in a separate directoryFILE=plumed.datinput file for the guest PLUMED instanceCHDIR=directory2run guest in a separate directory
Quantity | Description |
bias | the instantaneous value of the bias potential |
STRIDE | ( default=1 ) stride different from 1 are not supported yet |
NOREPLICAS | ( default=off ) run multiple replicas as isolated ones, without letting them know that the host has multiple replicas |
FILE | input file for the guest PLUMED instance |
KERNEL | kernel to be used for the guest PLUMED instance (USE WITH CAUTION!) |
LOG | log file for the guest PLUMED instance. By default the host log is used |
CHDIR | run guest in a separate directory |