Skip to content

Commit

Permalink
Merge branch 'v2.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
GiovanniBussi committed May 15, 2024
2 parents ec01ce1 + cdfa322 commit b73d17c
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGES/v2.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

1 change: 1 addition & 0 deletions regtest/basic/rt32b-mpi/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../../scripts/test.make
32 changes: 32 additions & 0 deletions regtest/basic/rt32b-mpi/config
Original file line number Diff line number Diff line change
@@ -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
}
10 changes: 6 additions & 4 deletions regtest/basic/rt32b/config
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions src/core/GenericMolInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,17 @@ void GenericMolInfo::interpretSymbol( const std::string& symbol, std::vector<Ato
plumed_assert(enablePythonInterpreter);

log<<" symbol " + symbol + " will be sent to python interpreter\n";
if(!selector) {
if(!selector_running) {
log<<" MOLINFO "<<getLabel()<<": starting python interpreter\n";
if(comm.Get_rank()==0) {
selector=Tools::make_unique<Subprocess>(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;
Expand All @@ -279,7 +282,6 @@ void GenericMolInfo::interpretSymbol( const std::string& symbol, std::vector<Ato
if(!words.empty() && words[0]=="Selection:") break;
}
words.erase(words.begin());
atoms.resize(0);
for(const auto & w : words) {
int n;
if(w.empty()) continue;
Expand Down Expand Up @@ -313,6 +315,7 @@ void GenericMolInfo::interpretSymbol( const std::string& symbol, std::vector<Ato
}
size_t nat=0;
comm.Bcast(nat,0);
atoms.resize(nat);
comm.Bcast(atoms,0);
}
log<<" selection interpreted using ";
Expand Down Expand Up @@ -359,9 +362,10 @@ bool GenericMolInfo::isWhole() const {
}

void GenericMolInfo::prepare() {
if(selector) {
if(selector_running) {
log<<" MOLINFO "<<getLabel()<<": killing python interpreter\n";
selector.reset();
selector_running=false;
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/core/GenericMolInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ class GenericMolInfo :
std::string pythonCmd;
/// Selector subprocess
std::unique_ptr<Subprocess> selector;
/// Track is selector is running
/// Needed on Get_rank()>0
bool selector_running=false;
/// Structure in pdb file is whole
bool iswhole_;
public:
Expand Down

1 comment on commit b73d17c

@PlumedBot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found broken examples in automatic/ANGLES.tmp
Found broken examples in automatic/ANN.tmp
Found broken examples in automatic/CAVITY.tmp
Found broken examples in automatic/CLASSICAL_MDS.tmp
Found broken examples in automatic/CLUSTER_DIAMETER.tmp
Found broken examples in automatic/CLUSTER_DISTRIBUTION.tmp
Found broken examples in automatic/CLUSTER_PROPERTIES.tmp
Found broken examples in automatic/CONSTANT.tmp
Found broken examples in automatic/CONTACT_MATRIX.tmp
Found broken examples in automatic/CONTACT_MATRIX_PROPER.tmp
Found broken examples in automatic/COORDINATIONNUMBER.tmp
Found broken examples in automatic/DFSCLUSTERING.tmp
Found broken examples in automatic/DISTANCE_FROM_CONTOUR.tmp
Found broken examples in automatic/EDS.tmp
Found broken examples in automatic/EMMI.tmp
Found broken examples in automatic/ENVIRONMENTSIMILARITY.tmp
Found broken examples in automatic/FIND_CONTOUR.tmp
Found broken examples in automatic/FIND_CONTOUR_SURFACE.tmp
Found broken examples in automatic/FIND_SPHERICAL_CONTOUR.tmp
Found broken examples in automatic/FOURIER_TRANSFORM.tmp
Found broken examples in automatic/FUNCPATHGENERAL.tmp
Found broken examples in automatic/FUNCPATHMSD.tmp
Found broken examples in automatic/FUNNEL.tmp
Found broken examples in automatic/FUNNEL_PS.tmp
Found broken examples in automatic/GHBFIX.tmp
Found broken examples in automatic/GPROPERTYMAP.tmp
Found broken examples in automatic/HBOND_MATRIX.tmp
Found broken examples in automatic/INCLUDE.tmp
Found broken examples in automatic/INCYLINDER.tmp
Found broken examples in automatic/INENVELOPE.tmp
Found broken examples in automatic/INTERPOLATE_GRID.tmp
Found broken examples in automatic/LOCAL_AVERAGE.tmp
Found broken examples in automatic/MAZE_OPTIMIZER_BIAS.tmp
Found broken examples in automatic/MAZE_RANDOM_ACCELERATION_MD.tmp
Found broken examples in automatic/MAZE_SIMULATED_ANNEALING.tmp
Found broken examples in automatic/MAZE_STEERED_MD.tmp
Found broken examples in automatic/MULTICOLVARDENS.tmp
Found broken examples in automatic/OUTPUT_CLUSTER.tmp
Found broken examples in automatic/PAMM.tmp
Found broken examples in automatic/PCA.tmp
Found broken examples in automatic/PCAVARS.tmp
Found broken examples in automatic/PIV.tmp
Found broken examples in automatic/PLUMED.tmp
Found broken examples in automatic/PYCVINTERFACE.tmp
Found broken examples in automatic/PYTHONFUNCTION.tmp
Found broken examples in automatic/Q3.tmp
Found broken examples in automatic/Q4.tmp
Found broken examples in automatic/Q6.tmp
Found broken examples in automatic/QUATERNION.tmp
Found broken examples in automatic/SIZESHAPE_POSITION_LINEAR_PROJ.tmp
Found broken examples in automatic/SIZESHAPE_POSITION_MAHA_DIST.tmp
Found broken examples in automatic/SPRINT.tmp
Found broken examples in automatic/TETRAHEDRALPORE.tmp
Found broken examples in automatic/TORSIONS.tmp
Found broken examples in automatic/WHAM_WEIGHTS.tmp
Found broken examples in AnalysisPP.md
Found broken examples in CollectiveVariablesPP.md
Found broken examples in MiscelaneousPP.md

Please sign in to comment.