| 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. Clashes might be due by synonymous symbols from the PLUMED library or synonymous symbols from libraries linked to PLUMED, and would differ depending on the operating system you are using:
--runtime.plumed-runtime executable (contained in the prefix/lib/plumed/ directory) and export PLUMED_KERNEL equal to the path of the host kernel library (as usual in runtime loading). Notice that as of PLUMED 2.10 we load kernels with RTLD_LOCAL by default.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.In general, there might be unexpected crashes. Particularly difficult are situations where different kernels were compiled with different libraries.
Here an example plumed file:
# plumed.dat p: PLUMED FILEinput file for the guest PLUMED instance =plumed2.dat PRINT ARGthe input for this action is the scalar output from one or more other actions. =p.bias FILEthe name of the file on which to output these quantities =COLVAR
plumed2.dat can be an arbitrary plumed input file, for instance
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 PLUMED FILEinput file for the guest PLUMED instance =plumed.dat CHDIRrun guest in a separate directory =directory1 PLUMED FILEinput file for the guest PLUMED instance =plumed.dat CHDIRrun guest in a separate directory =directory2
By default this Action calculates the following quantities. These quantities can be referenced elsewhere in the input by using this Action's label followed by a dot and the name of the quantity required from the list below.
| 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 |