plumed / plumed2

Development version of plumed 2
https://www.plumed.org
GNU Lesser General Public License v3.0
357 stars 284 forks source link

Issues with multiple degenerate groups using PBMetaD with PF #1005

Open ruz088 opened 9 months ago

ruz088 commented 9 months ago

Hi developers,

I'm trying to use the PF keyword with PBMetaD using Lammps compiled with Plumed 2.9. And it seems to be giving some issues when dealing with multiple PFs containing degenerate groups.

Here's my sample input:

UNITS LENGTH=A ENERGY=kcal/mol

# ave bond type 1
bond11: DISTANCE ATOMS=2,5
bond12: DISTANCE ATOMS=2,6
# ave bond type 2
bond21: DISTANCE ATOMS=1,8
bond22: DISTANCE ATOMS=1,9

# pbmetad
PBMETAD ...
     ARG=bond11,bond12,bond22,bond23
     SIGMA=0.2,0.2
     HEIGHT=0.3
     PF0=bond11,bond12
     PF1=bond22,bond23
    PACE=500
    TEMP=300
    BIASFACTOR=8
    LABEL=pb
    FILE=HILLS_1,HILLS_2
... PBMETAD

PRINT STRIDE=500 ARG=bond11,bond12,bond22,bond23,pb.bias FILE=COLVAR

which gives me the following error from Lammps

WARNING: internal inconsistency in allocated PlumedMain instances (1)
ruz088 commented 9 months ago

I have tested by modifying the PF groups and it looks like it's having problem dealing with multiple degenerate groups.

The following tests I've done that are able to run:

# one degenerate PF
PF0=cv1
PF1=cv2,cv3
# one degenerate PF
PF0=cv1,cv2
PF1=cv3
# one degenerate PF
PF0=cv1,cv2,cv3

And the following tests I've done that doesn't seem to run, the simulation stopped at the step when it tries to add gaussians:

# one degenerate PF
PF0=cv1,cv2
PF1=cv3
PF2=cv4
# one degenerate PF
PF0=cv1
PF1=cv2,cv3,cv4
# two degenerate PFs
PF0=cv1,cv2
PF1=cv3,cv4
GiovanniBussi commented 9 months ago

WARNING: internal inconsistency in allocated PlumedMain instances (1)

This is a warning about the way LAMMPS calls plumed, likely implying that LAMMPS is creating a PLUMED instance and not deallocating it at the end. It should be kind of harmless, and independent of your input file.

Which exact LAMMPS and PLUMED versions are you using?

And the following tests I've done that doesn't seem to run, the simulation stopped at the step when it tries to add gaussians:

This is strange.

ruz088 commented 9 months ago

Hi, thank you for taking a look. I'm using the stable branch of LAMMPS and v2.9 of plumed. The plumed log didn't give me any obvious error message. The lammps output has returned the following before the warning I mentioned.

somepath/lmp_mpi_plumed2.9(_ZN4PLMD4bias7PBMetaD16evaluateGaussianEjRKSt6vectorIdSaIdEERKNS1_8GaussianEPd+0x48)[0xe33f78]
somepath/lmp_mpi_plumed2.9(_ZN4PLMD4bias7PBMetaD21getBiasAndDerivativesEjRKSt6vectorIdSaIdEEPd+0x12a)[0xe317aa]
somepath/lmp_mpi_plumed2.9(_ZN4PLMD4bias7PBMetaD9calculateEv+0x109)[0xe30e29]
somepath/lmp_mpi_plumed2.9(_ZN4PLMD10PlumedMain13justCalculateEv+0x1f3)[0xf7d8e3]
somepath/lmp_mpi_plumed2.9(_ZN4PLMD10PlumedMain11performCalcEv+0x12)[0xf819a2]
somepath/lmp_mpi_plumed2.9(_ZN4PLMD10PlumedMain3cmdERKSsRKNS_11TypesafePtrE+0x2ba1)[0xf67151]
somepath/lmp_mpi_plumed2.9[0xf939d5]
somepath/lmp_mpi_plumed2.9(plumed_cmd_safe_nothrow+0x8e)[0xd5703e]
somepath/lmp_mpi_plumed2.9(_ZN9LAMMPS_NS9FixPlumed10post_forceEi+0x1004)[0xaede74]
somepath/lmp_mpi_plumed2.9(_ZN9LAMMPS_NS6Modify10post_forceEi+0x88)[0x9c9df8]
somepath/lmp_mpi_plumed2.9(_ZN9LAMMPS_NS6Verlet3runEi+0x5a1)[0x9b5701]
somepath/lmp_mpi_plumed2.9(_ZN9LAMMPS_NS3Run7commandEiPPc+0xd95)[0x6be855]
somepath/lmp_mpi_plumed2.9(_ZN9LAMMPS_NS5Input15execute_commandEv+0xbf9)[0x65eb79]
somepath/lmp_mpi_plumed2.9(_ZN9LAMMPS_NS5Input4fileEv+0x205)[0x6604a5]
somepath/lmp_mpi_plumed2.9(main+0x48)[0x64f148]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7f11bad6f555]
somepath/lmp_mpi_plumed2.9[0x65063c]
GiovanniBussi commented 9 months ago

I see. My guess is that there is some problem related to your input file that results in an error. When the error happens, LAMMPS terminates in a non standard way (namely: by stopping the execution with a regular exit without deallocating the plumed object). The correct procedure would be to either deallocate the plumed object or terminate with abort. So, the warning in the output is not your fault and is irrelevant in the current context.

Given this, perhaps you can search in the LAMMPS and PLUMED log for more context. If an error was raised within PLUMED, you should find a message in the PLUMED log file, perhaps also echoed on the LAMMPS log file.

carlocamilloni commented 9 months ago

I can add that I tested your combinations in the regtest (regtest/basic/rt-pbmetadpf1) and they all work fine, you could try the same using your specific inputs to see if you can get more info

ruz088 commented 9 months ago

Hi, thank you for the help. I tried adding the GRID specifications and I think that solves my problem.

Just something to be noted that could be potential issues for plumed2.9 when using with LAMMPS.

  1. When not doing well-tempered metadynamics with PBMetaD (not specifying the BIASFACTOR and TEMP), PBMetaD is giving me '-nan' in the initialized pressure (I'm running in NVT of a gas molecule).
  2. When doing multiple PF, GRID specifications might be needed.