From 8854ae3443279d1d3d371f421584ca47109c3d8a Mon Sep 17 00:00:00 2001 From: SilvioPipolo Date: Mon, 1 Oct 2018 13:55:40 +0200 Subject: [PATCH] piv regtest (#390) * PIV metric coupled with PathCV and added input example for doxygen. * Line CRYST1 of a PDB file is read and box vectors, axis and angles are computed. Functions are added to get box parameters. * Added function getClosePairAtomNumber to get pairs in AtomNumber format for piv construction. * Added function set_r0 to set the R_0 value from piv class once the scaling factor has been defined. * piv module added * Added piv module regtests on distance and derivatives/virial * PIV.cpp Astyled * Files astyled using plumed astyle * solved Travis warnings on non-initialized member variables * Solved the R_0 issue without adding any new function in SwitchingFunction.cpp, but by substituting its value in the string read as in PIV.cpp. * Fixed format in reading box parmaters (CRYST1) in pdb.cpp * Changed the construction of the box vectors from length and angle parameters in pdb.cpp * fixed update_piv * Better timing part2 * Fixed problems in Makefiles for regtests * Fixed details from a resolved conflict * Added Makefile for regtests * Deleted tmp directories in regtests * Revert "Deleted tmp directories in regtests" This reverts commit 1fd981329f510c4a6384586a2e4a8eea9dc63353. * Revert "Added Makefile for regtests" This reverts commit 552cb527d4bfbca5e061a158ee7a9863c5cecd33. * Reverted commit and Makefile added * using the "serial" path for distance tests. This fixes the MPI errors in regtests * Fixed problems in regtests with debug flags for compiler * PIV.cpp astyled --- regtest/piv/Makefile | 2 ++ regtest/piv/rt-piv-derivatives/Makefile | 2 +- .../piv/rt-piv-derivatives_onlycross/Makefile | 2 +- .../rt-piv-derivatives_onlydirect/Makefile | 2 +- regtest/piv/rt-piv-distance/Makefile | 2 +- regtest/piv/rt-piv-distance/plumed.dat | 2 ++ .../piv/rt-piv-distance_onlycross/Makefile | 2 +- .../piv/rt-piv-distance_onlycross/plumed.dat | 2 ++ .../piv/rt-piv-distance_onlydirect/Makefile | 2 +- .../piv/rt-piv-distance_onlydirect/plumed.dat | 2 ++ src/piv/PIV.cpp | 19 ++++++++----------- src/tools/SwitchingFunction.cpp | 1 - 12 files changed, 22 insertions(+), 18 deletions(-) create mode 100644 regtest/piv/Makefile diff --git a/regtest/piv/Makefile b/regtest/piv/Makefile new file mode 100644 index 0000000000..42480767ae --- /dev/null +++ b/regtest/piv/Makefile @@ -0,0 +1,2 @@ +include ../scripts/module.make + diff --git a/regtest/piv/rt-piv-derivatives/Makefile b/regtest/piv/rt-piv-derivatives/Makefile index 275c4b5047..3703b27cea 100644 --- a/regtest/piv/rt-piv-derivatives/Makefile +++ b/regtest/piv/rt-piv-derivatives/Makefile @@ -1 +1 @@ -include ../scripts/test.make +include ../../scripts/test.make diff --git a/regtest/piv/rt-piv-derivatives_onlycross/Makefile b/regtest/piv/rt-piv-derivatives_onlycross/Makefile index 275c4b5047..3703b27cea 100644 --- a/regtest/piv/rt-piv-derivatives_onlycross/Makefile +++ b/regtest/piv/rt-piv-derivatives_onlycross/Makefile @@ -1 +1 @@ -include ../scripts/test.make +include ../../scripts/test.make diff --git a/regtest/piv/rt-piv-derivatives_onlydirect/Makefile b/regtest/piv/rt-piv-derivatives_onlydirect/Makefile index 275c4b5047..3703b27cea 100644 --- a/regtest/piv/rt-piv-derivatives_onlydirect/Makefile +++ b/regtest/piv/rt-piv-derivatives_onlydirect/Makefile @@ -1 +1 @@ -include ../scripts/test.make +include ../../scripts/test.make diff --git a/regtest/piv/rt-piv-distance/Makefile b/regtest/piv/rt-piv-distance/Makefile index 275c4b5047..3703b27cea 100644 --- a/regtest/piv/rt-piv-distance/Makefile +++ b/regtest/piv/rt-piv-distance/Makefile @@ -1 +1 @@ -include ../scripts/test.make +include ../../scripts/test.make diff --git a/regtest/piv/rt-piv-distance/plumed.dat b/regtest/piv/rt-piv-distance/plumed.dat index dea44e043c..5bd03fcf7c 100644 --- a/regtest/piv/rt-piv-distance/plumed.dat +++ b/regtest/piv/rt-piv-distance/plumed.dat @@ -7,6 +7,7 @@ NLIST REF_FILE=Liq.pdb PIVATOMS=2 ATOMTYPES=OW1,HW +SFACTOR=1.,1.,1. SORT=1,1,1 SWITCH1={RATIONAL R_0=0.7 MM=12 NN=4} SWITCH2={RATIONAL R_0=0.7 MM=12 NN=6} @@ -23,6 +24,7 @@ NLIST REF_FILE=Ice.pdb PIVATOMS=2 ATOMTYPES=OW1,HW +SFACTOR=1.,1.,1. SORT=1,1,1 SWITCH1={RATIONAL R_0=0.7 MM=12 NN=4} SWITCH2={RATIONAL R_0=0.7 MM=12 NN=6} diff --git a/regtest/piv/rt-piv-distance_onlycross/Makefile b/regtest/piv/rt-piv-distance_onlycross/Makefile index 275c4b5047..3703b27cea 100644 --- a/regtest/piv/rt-piv-distance_onlycross/Makefile +++ b/regtest/piv/rt-piv-distance_onlycross/Makefile @@ -1 +1 @@ -include ../scripts/test.make +include ../../scripts/test.make diff --git a/regtest/piv/rt-piv-distance_onlycross/plumed.dat b/regtest/piv/rt-piv-distance_onlycross/plumed.dat index ea453a98f8..ec63fb903e 100644 --- a/regtest/piv/rt-piv-distance_onlycross/plumed.dat +++ b/regtest/piv/rt-piv-distance_onlycross/plumed.dat @@ -7,6 +7,7 @@ ONLYCROSS REF_FILE=Liq.pdb PIVATOMS=2 ATOMTYPES=OW1,HW +SFACTOR=1. SORT=1 SWITCH1={RATIONAL R_0=0.5 MM=12 NN=4} NL_CUTOFF=3. @@ -22,6 +23,7 @@ ONLYCROSS REF_FILE=Ice.pdb PIVATOMS=2 ATOMTYPES=OW1,HW +SFACTOR=1. SORT=1 SWITCH1={RATIONAL R_0=0.5 MM=12 NN=4} NL_CUTOFF=3. diff --git a/regtest/piv/rt-piv-distance_onlydirect/Makefile b/regtest/piv/rt-piv-distance_onlydirect/Makefile index 275c4b5047..3703b27cea 100644 --- a/regtest/piv/rt-piv-distance_onlydirect/Makefile +++ b/regtest/piv/rt-piv-distance_onlydirect/Makefile @@ -1 +1 @@ -include ../scripts/test.make +include ../../scripts/test.make diff --git a/regtest/piv/rt-piv-distance_onlydirect/plumed.dat b/regtest/piv/rt-piv-distance_onlydirect/plumed.dat index aba91fc398..aa94f4f953 100644 --- a/regtest/piv/rt-piv-distance_onlydirect/plumed.dat +++ b/regtest/piv/rt-piv-distance_onlydirect/plumed.dat @@ -7,6 +7,7 @@ REF_FILE=Liq.pdb PIVATOMS=2 ATOMTYPES=OW1,HW ONLYDIRECT +SFACTOR=1.,1. SORT=1,1 SWITCH1={RATIONAL R_0=0.7 MM=12 NN=4} SWITCH2={RATIONAL R_0=0.7 MM=12 NN=6} @@ -23,6 +24,7 @@ REF_FILE=Ice.pdb PIVATOMS=2 ATOMTYPES=OW1,HW ONLYDIRECT +SFACTOR=1.,1. SORT=1,1 SWITCH1={RATIONAL R_0=0.7 MM=12 NN=4} SWITCH2={RATIONAL R_0=0.7 MM=12 NN=6} diff --git a/src/piv/PIV.cpp b/src/piv/PIV.cpp index 8bfbdb9aeb..6d3c5e709f 100644 --- a/src/piv/PIV.cpp +++ b/src/piv/PIV.cpp @@ -281,7 +281,6 @@ PIV::PIV(const ActionOptions&ao): //com2atoms(std:: vector >(Nlist)) { log << "Starting PIV Constructor\n"; - unsigned rank=comm.Get_rank(); // Precision on the real-to-integer transformation for the sorting parse("PRECISION",Nprec); @@ -303,6 +302,7 @@ PIV::PIV(const ActionOptions&ao): log << "Serial PIV construction\n"; } else { log << "Parallel PIV construction\n"; + unsigned rank=comm.Get_rank(); } // Derivatives @@ -496,7 +496,6 @@ PIV::PIV(const ActionOptions&ao): parseVector("SFACTOR",scaling); //if(scaling.size()!=getNumberOfArguments() && scaling.size()!=0) error("not enough values for SFACTOR"); } - // Neighbour Lists option parseFlag("NLIST",doneigh); nl.resize(Nlist); @@ -737,7 +736,6 @@ void PIV::calculate() static std:: vector > cPIV(Nlist); static std:: vector > Atom0(Nlist); static std:: vector > Atom1(Nlist); - // std:: vector > A0(Nprec); std:: vector > A1(Nprec); unsigned stride=1; @@ -754,7 +752,6 @@ void PIV::calculate() // Transform (and sort) the rPIV before starting the dynamics if (((prev_stp==-1) || (init_stp==1)) &&!CompDer) { if(prev_stp!=-1) {init_stp=0;} - log << "Debug " << prev_stp << " " << init_stp << "\n"; // Calculate the volume scaling factor if(Svol) { Fvol=cbrt(Vol0/getBox().determinant()); @@ -925,7 +922,7 @@ void PIV::calculate() } if(timer) stopwatch.stop("1 Build cPIV"); if(timer) stopwatch.start("2 Sort cPIV"); - if(!doserial) { + if(!doserial && comm.initialized()) { // Vectors keeping track of the dimension and the starting-position of the rank-specific pair vector in the big pair vector. std:: vector Vdim(stride,0); std:: vector Vpos(stride,0); @@ -987,6 +984,8 @@ void PIV::calculate() // Loop on blocks //for(unsigned m=0;m