I am trying to create an interface between the metadynamics and the LAMMPS code. Both the codes are written in two different languages. How can I proceed to create an interface.

Thank you

  • 1
    $\begingroup$ I suggest to use Python as it is good manipulating text. $\endgroup$
    – Camps
    Commented Dec 20, 2022 at 17:52
  • 1
    $\begingroup$ I echo @Camps comment, but it might be helpful to know something about the metadynamics code you want to use. $\endgroup$ Commented Dec 21, 2022 at 0:36
  • 2
    $\begingroup$ Is your goal to use metadynamics (as a method) in LAMMPS, or to interface some specific metadynamics code with LAMMPS? If you just want to use it, is there a reason not to just use the PLUMED fix? If you have a specific code you want to interface, more details about that code would be useful. $\endgroup$
    – dwhswenson
    Commented Dec 24, 2022 at 2:53
  • $\begingroup$ You can already use metadynamics in LAMMPS using the COLVARS package. There is an extensive manual on how to do it. To use metadynamics sampling in LAMMPS, first build LAMMPS with the COLVARS package included, then use the command "fix metad Colvars..." $\endgroup$
    – Ardalan
    Commented Jan 22, 2023 at 21:24
  • $\begingroup$ +1 and welcome to our new community! Thank you for contributing your question here and we hope to see much more of you in the future!! Sorry for not welcoming you earlier. @Ardalan why not write an answer? $\endgroup$ Commented Feb 7, 2023 at 20:12

1 Answer 1


Colvars package is required to use collective variables and various methods of sampling such as metadynamics, umbrella sampling, ABF, etc. The package can be called using the fix colvars command. However, it does not come with LAMMPS and must be installed separately.

1- Based on your OS, To install LAMMPS and Colvars, carefully follow the instructions at Build lammps.

1.1. If using cmake, use the flag -D PKG_COLVARS=yes. For make, use make lib-colvars args="-m g++-debug”. You may need to modify Makefile.serial and Makefile.mpi to include the following, for example:

CC =        clang++
CCFLAGS =   -std=c++11 -stdlib=libc++

1.2. Additional packages, such as reaxff or molecules, may also be required. See here for the appropriate flags.

  1. After installing Colvars, you can use it in LAMMPS by calling fix colvars. Colvars provides well-written manuals for different MD packages, including LAMMPS. Find the manual for LAMMPS here. From the manual (P. 75), to perform metadynamics, a colvar must be defined, for example:
colvar {
  name r
  distance { ... }
  upperBoundary 15.0
  width 0.2
metadynamics {
  name meta_r
  colvars r
  hillWeight 0.001
  hillWidth 2.0
harmonicWalls {
  name wall_r
  colvars r
  upperWalls 13.0
  upperWallConstant 2.0
  1. The core functionality of Colvars is consistent across different MD packages. For questions related to Colvars, the NAMD Mailing List is a good resource.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .