some problem about ‘adding a new collective variable’

187 views
Skip to first unread message

yy z

unread,
May 15, 2023, 3:13:50 AM5/15/23
to PLUMED users
  • I want to write a new cv myself and add it to Plumed. 

    The CPP file is written using this link, 
https://www.plumed.org/doc-master/developer-doc/html/_adding_a_colvar.htmlThen put the CPP file in the path \plumed-2.7.2\src\colvar.  And then I recompiled lmp_mpi according to the following command, 

cd /mnt/d/lammps/lammps-7Aug19/src

sudo make lib-plumed args="-b"

sudo make yes-USER-PLUMED

sudo make mpi -j 100

sudo cp lmp_mpi /usr/local/bin

the plumed.dat file shows:11.png

  • An error is reported after running,

  • 222.png

  •   

    • Do you have any opinion on this problem?

       





Gareth Tribello

unread,
May 15, 2023, 3:42:50 AM5/15/23
to plumed...@googlegroups.com
Are you sure LAMMPS is not downloading its own version of PLUMED?  Check out the instructions page for installing LAMMPS and PLUMED here:



and make sure you are linking with the version you want.  I would use the cmake build system for LAMMPS and the -D DOWNLOAD_PLUMED=no option.

Alternatively, move your new cpp file to the directory your are running in and use the LOAD command to compile it into PLUMED at runtime.  See:


Good luck
Gareth

On 15 May 2023, at 08:13, yy z <yanyanz...@gmail.com> wrote:

  • I want to write a new cv myself and add it to Plumed. 

    The CPP file is written using this link, 
https://www.plumed.org/doc-master/developer-doc/html/_adding_a_colvar.htmlThen put the CPP file in the path \plumed-2.7.2\src\colvar.  And then I recompiled lmp_mpi according to the following command, 

cd /mnt/d/lammps/lammps-7Aug19/src

sudo make lib-plumed args="-b"

sudo make yes-USER-PLUMED

sudo make mpi -j 100


sudo cp lmp_mpi /usr/local/bin

the plumed.dat file shows:<11.png>

    • An error is reported after running,

    • <222.png>

    •   
      • Do you have any opinion on this problem?

         






      --
      You received this message because you are subscribed to the Google Groups "PLUMED users" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to plumed-users...@googlegroups.com.
      To view this discussion on the web visit https://groups.google.com/d/msgid/plumed-users/1fd79361-057b-4838-88a9-719f50d3a22dn%40googlegroups.com.
      <222.png><11.png>

      Carlos Huang (cahz1307)

      unread,
      Oct 9, 2023, 12:02:52 PM10/9/23
      to PLUMED users
      Hi Gareth,

      I've been trying to load a new cv Distance2.cpp using the LOAD command, but it's also not working for me. I'm getting the following error:

      Distance2.cpp:22:10: fatal error: Colvar.h: No such file or directory
         22 | #include "Colvar.h"
            |          ^~~~~~~~~~
      compilation terminated.

      The Distance2.cpp is placed inside the directory I'm running the -plumed plumed.dat flag. I have also tried placing the Distance2.cpp in the /usr/local/plumed2.8.0/lib/plumed/src/colvar directory but it's empty with only the Template.cpp file inside. 

      Best,
      Carlos

      Giovanni Bussi

      unread,
      Oct 9, 2023, 3:00:28 PM10/9/23
      to plumed...@googlegroups.com
      You should replace

      #include "Colvar.h"

      with

      #include "colvar/Colvar.h"

      See how we do things in this regression test:


      Giovanni

      Carlos Huang (cahz1307)

      unread,
      Oct 9, 2023, 4:53:39 PM10/9/23
      to PLUMED users
      Thanks Giovanni, that worked flawlessly.

      Best,
      Carlos

      Reply all
      Reply to author
      Forward
      0 new messages