diff --git a/CHANGES/v2.8.md b/CHANGES/v2.8.md index 56eea42f1e..89f72024cf 100644 --- a/CHANGES/v2.8.md +++ b/CHANGES/v2.8.md @@ -112,4 +112,5 @@ Changes from version 2.7 which are relevant for users: - Fixed an error in checking array shapes in the interface. Arrays with shape (N,4) should not be accepted for positions or forces. - Small fix in Python, where we do not assume anymore that strings are null terminated. - Environment variables such as `PLUMED_INCLUDEDIR` and similar are sanitized before they are used for running commands. +- Fixed a bug leading to a crash when using python selectors (e.g., `@mda:` or `@mdt:`) and multiple MPI processes per replica. diff --git a/regtest/basic/rt32b-mpi/Makefile b/regtest/basic/rt32b-mpi/Makefile new file mode 100644 index 0000000000..3703b27cea --- /dev/null +++ b/regtest/basic/rt32b-mpi/Makefile @@ -0,0 +1 @@ +include ../../scripts/test.make diff --git a/regtest/basic/rt32b-mpi/config b/regtest/basic/rt32b-mpi/config new file mode 100644 index 0000000000..6699c7e137 --- /dev/null +++ b/regtest/basic/rt32b-mpi/config @@ -0,0 +1,32 @@ +type=driver +mpiprocs=2 +arg="--plumed plumed.dat --trajectory-stride 10 --timestep 0.005 --ixyz ala12_trajectory.xyz --dump-forces forces --dump-forces-fmt=%10.6f --debug-dd yes" +extra_files=" + ../rt32b/colvar.reference + ../rt32b/helix.pdb + ../rt32b/test.gro.reference + ../rt32b/test1.gro.reference + ../rt32b/test2.gro.reference + ../rt32b/test3.gro.reference + ../rt32b/test4.gro.reference + ../rt32b/test5.gro.reference + ../rt32b/ala12_trajectory.xyz + ../rt32b/plumed.dat +" + + +function plumed_custom_skip() { + if test -n "$PLUMED_PYTHON_SELECT" ; then + export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" + return 1 + fi + for python_bin in python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7 python ; do + if $python_bin -c "import MDAnalysis; import mdtraj" 2>/dev/null ; then + if [ $python_bin != python ] ; then + export PLUMED_PYTHON_BIN=$python_bin + fi + return 1 + fi + done + return 0 +} diff --git a/regtest/basic/rt32b/config b/regtest/basic/rt32b/config index a82d522431..b839e31a28 100644 --- a/regtest/basic/rt32b/config +++ b/regtest/basic/rt32b/config @@ -2,11 +2,13 @@ type=driver arg="--plumed plumed.dat --trajectory-stride 10 --timestep 0.005 --ixyz ala12_trajectory.xyz --dump-forces forces --dump-forces-fmt=%10.6f" function plumed_custom_skip() { - if test -n "$PLUMED_PYTHON_SELECT" ; then - export PLUMED_PYTHON_BIN="$PLUMED_PYTHON_SELECT" - return 1 + if test -n "$PYTHON_BIN" ; then + if $PYTHON_BIN -c "import MDAnalysis; import mdtraj" 2>/dev/null ; then + export PLUMED_PYTHON_BIN=$PYTHON_BIN + return 1 + fi fi - for python_bin in python python2.7 python3.6 python3.7 ; do + for python_bin in python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7 python ; do if $python_bin -c "import MDAnalysis; import mdtraj" 2>/dev/null ; then if [ $python_bin != python ] ; then export PLUMED_PYTHON_BIN=$python_bin diff --git a/src/core/GenericMolInfo.cpp b/src/core/GenericMolInfo.cpp index 6eecc32d81..2791d2d112 100644 --- a/src/core/GenericMolInfo.cpp +++ b/src/core/GenericMolInfo.cpp @@ -250,14 +250,17 @@ void GenericMolInfo::interpretSymbol( const std::string& symbol, std::vector(pythonCmd+" \""+config::getPlumedRoot()+"\"/scripts/selector.sh --pdb " + reference); selector->stop(); } + selector_running=true; } + atoms.resize(0); + if(comm.Get_rank()==0) { int ok=0; std::string error_msg; @@ -279,7 +282,6 @@ void GenericMolInfo::interpretSymbol( const std::string& symbol, std::vector selector; +/// Track is selector is running +/// Needed on Get_rank()>0 + bool selector_running=false; /// Structure in pdb file is whole bool iswhole_; public: