LOAD
This is part of the setup module

Loads a library, possibly defining new actions.

It is available only on systems allowing for dynamic loading. It can also be fed with a cpp file, in which case the file is compiled first.

Examples

If you have a shared object named extensions.so and want to use the functions implemented within it within PLUMED you can load it with the following syntax

Click on the labels of the actions for more information on what each action computes
tested on master
LOAD 
FILE
compulsory keyword file to be loaded
=extensions.so

As a more practical example, imagine that you want to make a small change to one collective variable that is already implemented in PLUMED, say DISTANCE . Copy the file src/colvar/Distance.cpp into your work directory, rename it as Distance2.cpp and edit it as you wish. It might be better to also replace any occurrence of the string DISTANCE within the file with DISTANCE2, so that both old and new implementation will be available with different names. Then you can compile it into a shared object using

> plumed mklib Distance2.cpp

This will generate a file Distance2.so (or Distance2.dylib on a mac) that can be loaded. Now you can use your new implementation with the following input

Click on the labels of the actions for more information on what each action computes
tested on master
# load the new library
LOAD 
FILE
compulsory keyword file to be loaded
=Distance2.so # compute standard distance d: DISTANCE
ATOMS
the pair of atom that we are calculating the distance between.
=1,10 # compute modified distance d2: DISTANCE2
ATOMS
could not find this keyword
=1,10 # print them on a file PRINT
ARG
compulsory keyword the labels of the values that you would like to print to the file
=d,d2
FILE
the name of the file on which to output these quantities
=compare-them

You can even skip the initial step and directly feed PLUMED with the Distance2.cpp file: it will be compiled on the fly.

Click on the labels of the actions for more information on what each action computes
tested on master
# load the new definition
# this is a cpp file so it will be compiled
LOAD 
FILE
compulsory keyword file to be loaded
=Distance2.cpp # compute standard distance d: DISTANCE
ATOMS
the pair of atom that we are calculating the distance between.
=1,10 # compute modified distance d2: DISTANCE2
ATOMS
could not find this keyword
=1,10 # print them on a file PRINT
ARG
compulsory keyword the labels of the values that you would like to print to the file
=d,d2
FILE
the name of the file on which to output these quantities
=compare-them

This will allow to make quick tests while developing your own variables. Of course, after your implementation is ready you might want to add it to the PLUMED source tree and recompile the whole PLUMED.

Starting with PLUMED 2.10, the LOAD action can be placed in any point of the input file, and will only affect commands that are placed after the LOAD action. In other words, you can create a file named Distance.cpp and that reimplement the DISTANCE action and use it like this:

Click on the labels of the actions for more information on what each action computes
tested on master
# compute standard distance
d: DISTANCE 
ATOMS
the pair of atom that we are calculating the distance between.
=1,10 # load the new definition LOAD
FILE
compulsory keyword file to be loaded
=Distance.so # compute modified distance d2: DISTANCE
ATOMS
the pair of atom that we are calculating the distance between.
=1,10 # print them on a file PRINT
ARG
compulsory keyword the labels of the values that you would like to print to the file
=d,d2
FILE
the name of the file on which to output these quantities
=compare-them

In addition, starting with PLUMED 2.10 the LOAD action can be used in contexts where multiple Plumed objects exist. A possible example is multithreading: loading an action from a Plumed object used in one thread will not affect other threads. Another example is if multiple Plumed objects are created in the C/C++ or Python interface. If a LOAD command is used in one of these objects, the loaded action will not affect the other objects.

Glossary of keywords and components
Compulsory keywords
FILE file to be loaded