Based on Xiangda's legacy codes, I've cleaned and added initial support for PLUMED.
A comparison between upside and PLUMED is done by example/14.Plumed/compare_plumed_upside.py: basically we have identical coordinates and radius of gyrations:
However, there are a few caveats:
Type conversion issues: I've add the command to source_sh: export PLUMED_TYPESAFE_IGNORE=yes. Otherwise plumed will throw this error:
PLUMED: +++ PLUMED error
PLUMED: +++ message follows +++
PLUMED: This command expects a floating point type. Received a void instead
PLUMED: If you are sure your code is correct you can disable this check with export PLUMED_TYPESAFE_IGNORE=yes
PLUMED: In case this is necessary, please report an issue to developers of PLUMED and of the MD code
PLUMED: See also https://github.com/plumed/plumed2/pull/653
And the full stack can be traced by gdb:
Catchpoint 1 (exception thrown), __cxxabiv1::__cxa_throw (obj=0xf25920, tinfo=0x7ffff6afd368 <typeinfo for PLMD::ExceptionTypeError>, dest=0x7ffff6424990 <PLMD::ExceptionTypeError::~ExceptionTypeError()>)
at /home/builder/ktietz/cos6/ci_cos6/ctng-compilers_1622658800915/work/.build/x86_64-conda-linux-gnu/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc:80
80 /home/builder/ktietz/cos6/ci_cos6/ctng-compilers_1622658800915/work/.build/x86_64-conda-linux-gnu/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc: No such file or directory.
(gdb) bt
#0 __cxxabiv1::__cxa_throw (obj=0xf25920, tinfo=0x7ffff6afd368 <typeinfo for PLMD::ExceptionTypeError>, dest=0x7ffff6424990 <PLMD::ExceptionTypeError::~ExceptionTypeError()>)
at /home/builder/ktietz/cos6/ci_cos6/ctng-compilers_1622658800915/work/.build/x86_64-conda-linux-gnu/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc:80
#1 0x00007ffff6442604 in float* PLMD::TypesafePtr::get_priv<float>(unsigned long, unsigned long const*, bool) const () from /home/yihengwu917/lib/libplumedKernel.so
#2 0x00007ffff645d249 in float* PLMD::TypesafePtr::get<float*>(std::initializer_list<unsigned long>) const [clone .constprop.99] () from /home/yihengwu917/lib/libplumedKernel.so
#3 0x00007ffff6462102 in PLMD::MDAtomsTyped<float>::setVirial(PLMD::TypesafePtr const&) () from /home/yihengwu917/lib/libplumedKernel.so
#4 0x00007ffff64234a9 in PLMD::Atoms::setVirial(PLMD::TypesafePtr const&) () from /home/yihengwu917/lib/libplumedKernel.so
#5 0x00007ffff64700f8 in PLMD::PlumedMain::cmd(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, PLMD::TypesafePtr const&) () from /home/yihengwu917/lib/libplumedKernel.so
#6 0x00007ffff6482dce in plumed_plumedmain_cmd_safe_nothrow () from /home/yihengwu917/lib/libplumedKernel.so
#7 0x00000000006f1ca6 in PLMD::Plumed::cmd_priv (main=..., key=0x7047b5 "setVirial", safe=0x7fffffff6d60, unsafe=0x0, error=0x0) at /home/yihengwu917/source_code/upside2-md-fork/src/Plumed.h:2434
#8 0x00000000006f314c in PLMD::Plumed::plumed_cmd_cxx<double [9]> (p=..., key=0x7047b5 "setVirial", val=0xb37488, error=0x0) at /home/yihengwu917/source_code/upside2-md-fork/src/Plumed.h:2594
#9 0x00000000006f25a3 in PlumedForce::compute_value (this=0xb37430, mode=PotentialAndDerivMode) at /home/yihengwu917/source_code/upside2-md-fork/src/plumed.cpp:106
#10 0x0000000000677c2f in DerivEngine::compute (this=0x9dfe70, mode=PotentialAndDerivMode) at /home/yihengwu917/source_code/upside2-md-fork/src/deriv_engine.cpp:244
#11 0x000000000053112f in upside_main (argc=10, argv=0x7fffffffbea8, verbose=1) at /home/yihengwu917/source_code/upside2-md-fork/src/main.cpp:900
#12 0x00000000005349ce in main (argc=10, argv=0x7fffffffbea8) at /home/yihengwu917/source_code/upside2-md-fork/src/main.cpp:1104
(gdb)
Catchpoint 1 (exception thrown), __cxxabiv1::__cxa_throw (obj=0xf25920, tinfo=0x7ffff6afd368 <typeinfo for PLMD::ExceptionTypeError>, dest=0x7ffff6424990 <PLMD::ExceptionTypeError::~ExceptionTypeError()>)
at /home/builder/ktietz/cos6/ci_cos6/ctng-compilers_1622658800915/work/.build/x86_64-conda-linux-gnu/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc:80
80 /home/builder/ktietz/cos6/ci_cos6/ctng-compilers_1622658800915/work/.build/x86_64-conda-linux-gnu/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc: No such file or directory.
(gdb) bt
#0 __cxxabiv1::__cxa_throw (obj=0xf25920, tinfo=0x7ffff6afd368 <typeinfo for PLMD::ExceptionTypeError>, dest=0x7ffff6424990 <PLMD::ExceptionTypeError::~ExceptionTypeError()>)
at /home/builder/ktietz/cos6/ci_cos6/ctng-compilers_1622658800915/work/.build/x86_64-conda-linux-gnu/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc:80
#1 0x00007ffff6442604 in float* PLMD::TypesafePtr::get_priv<float>(unsigned long, unsigned long const*, bool) const () from /home/yihengwu917/lib/libplumedKernel.so
#2 0x00007ffff645d249 in float* PLMD::TypesafePtr::get<float*>(std::initializer_list<unsigned long>) const [clone .constprop.99] () from /home/yihengwu917/lib/libplumedKernel.so
#3 0x00007ffff6462102 in PLMD::MDAtomsTyped<float>::setVirial(PLMD::TypesafePtr const&) () from /home/yihengwu917/lib/libplumedKernel.so
#4 0x00007ffff64234a9 in PLMD::Atoms::setVirial(PLMD::TypesafePtr const&) () from /home/yihengwu917/lib/libplumedKernel.so
#5 0x00007ffff64700f8 in PLMD::PlumedMain::cmd(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, PLMD::TypesafePtr const&) () from /home/yihengwu917/lib/libplumedKernel.so
#6 0x00007ffff6482dce in plumed_plumedmain_cmd_safe_nothrow () from /home/yihengwu917/lib/libplumedKernel.so
#7 0x00000000006f1ca6 in PLMD::Plumed::cmd_priv (main=..., key=0x7047b5 "setVirial", safe=0x7fffffff6d60, unsafe=0x0, error=0x0) at /home/yihengwu917/source_code/upside2-md-fork/src/Plumed.h:2434
#8 0x00000000006f314c in PLMD::Plumed::plumed_cmd_cxx<double [9]> (p=..., key=0x7047b5 "setVirial", val=0xb37488, error=0x0) at /home/yihengwu917/source_code/upside2-md-fork/src/Plumed.h:2594
#9 0x00000000006f25a3 in PlumedForce::compute_value (this=0xb37430, mode=PotentialAndDerivMode) at /home/yihengwu917/source_code/upside2-md-fork/src/plumed.cpp:106
#10 0x0000000000677c2f in DerivEngine::compute (this=0x9dfe70, mode=PotentialAndDerivMode) at /home/yihengwu917/source_code/upside2-md-fork/src/deriv_engine.cpp:244
#11 0x000000000053112f in upside_main (argc=10, argv=0x7fffffffbea8, verbose=1) at /home/yihengwu917/source_code/upside2-md-fork/src/main.cpp:900
#12 0x00000000005349ce in main (argc=10, argv=0x7fffffffbea8) at /home/yihengwu917/source_code/upside2-md-fork/src/main.cpp:1104
The last relevant line executed is the plumed_cmd(plumedmain, "setVirial", &virial);, and I've also tried to initialize virial array with 0.0f, and it will still throw this error. It also seems to be related to the eh_throw.cc. But anyways, it seems after exporting the global variable it works.
recording issues: The comparison result above used frame-interval=1. If I use something large, e.g. 50, then there will be certain deviations between plumed and upside:
it seems to me that this is due to the rounding error when Upside records the trajectory to a time-frame, such that the plumed recorded frames are shifted compared to Upside recorded. For example, a time=1000, frame-interval=50, (PLUMED) STRIDE=50 simulation will give only 20 upside recorded frames but 21 PLUMED recorded frames.
And the traj.time in this case shows:
Based on Xiangda's legacy codes, I've cleaned and added initial support for PLUMED. A comparison between upside and PLUMED is done by
example/14.Plumed/compare_plumed_upside.py
: basically we have identical coordinates and radius of gyrations:However, there are a few caveats:
source_sh
:export PLUMED_TYPESAFE_IGNORE=yes
. Otherwise plumed will throw this error:And the full stack can be traced by
gdb
:The last relevant line executed is the
plumed_cmd(plumedmain, "setVirial", &virial);
, and I've also tried to initialize virial array with 0.0f, and it will still throw this error. It also seems to be related to theeh_throw.cc
. But anyways, it seems after exporting the global variable it works.traj.time
in this case shows: