Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for PLUMED: based on xiangda's efforts #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yihengwuKP
Copy link
Collaborator

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:
image
image

However, there are a few caveats:

  1. 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.
2. 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.
image And the traj.time in this case shows:

array([  0.        ,  50.0039978 , 100.00799561, 150.01199341,
       200.01599121, 250.01998901, 300.02398682, 350.02798462,
       400.03198242, 450.03598022, 500.03997803, 550.04400635,
       600.04797363, 650.05200195, 700.05596924, 750.05999756,
       800.06396484, 850.06799316, 900.07196045, 950.07598877])

@yihengwuKP yihengwuKP requested a review from pengxd May 29, 2023 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant