Skip to content

Commit

Permalink
piv regtest (plumed#390)
Browse files Browse the repository at this point in the history
* 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 1fd9813.

* Revert "Added Makefile for regtests"

This reverts commit 552cb52.

* 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
  • Loading branch information
SilvioPipolo authored and GiovanniBussi committed Oct 1, 2018
1 parent f87e9de commit 8854ae3
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 18 deletions.
2 changes: 2 additions & 0 deletions regtest/piv/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include ../scripts/module.make

2 changes: 1 addition & 1 deletion regtest/piv/rt-piv-derivatives/Makefile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ../scripts/test.make
include ../../scripts/test.make
2 changes: 1 addition & 1 deletion regtest/piv/rt-piv-derivatives_onlycross/Makefile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ../scripts/test.make
include ../../scripts/test.make
2 changes: 1 addition & 1 deletion regtest/piv/rt-piv-derivatives_onlydirect/Makefile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ../scripts/test.make
include ../../scripts/test.make
2 changes: 1 addition & 1 deletion regtest/piv/rt-piv-distance/Makefile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ../scripts/test.make
include ../../scripts/test.make
2 changes: 2 additions & 0 deletions regtest/piv/rt-piv-distance/plumed.dat
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion regtest/piv/rt-piv-distance_onlycross/Makefile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ../scripts/test.make
include ../../scripts/test.make
2 changes: 2 additions & 0 deletions regtest/piv/rt-piv-distance_onlycross/plumed.dat
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion regtest/piv/rt-piv-distance_onlydirect/Makefile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ../scripts/test.make
include ../../scripts/test.make
2 changes: 2 additions & 0 deletions regtest/piv/rt-piv-distance_onlydirect/plumed.dat
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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}
Expand Down
19 changes: 8 additions & 11 deletions src/piv/PIV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ PIV::PIV(const ActionOptions&ao):
//com2atoms(std:: vector<std:: vector<unsigned> >(Nlist))
{
log << "Starting PIV Constructor\n";
unsigned rank=comm.Get_rank();

// Precision on the real-to-integer transformation for the sorting
parse("PRECISION",Nprec);
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -737,7 +736,6 @@ void PIV::calculate()
static std:: vector<std:: vector<double> > cPIV(Nlist);
static std:: vector<std:: vector<int> > Atom0(Nlist);
static std:: vector<std:: vector<int> > Atom1(Nlist);
//
std:: vector<std:: vector<int> > A0(Nprec);
std:: vector<std:: vector<int> > A1(Nprec);
unsigned stride=1;
Expand All @@ -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());
Expand Down Expand Up @@ -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<int> Vdim(stride,0);
std:: vector<int> Vpos(stride,0);
Expand Down Expand Up @@ -987,6 +984,8 @@ void PIV::calculate()
// Loop on blocks
//for(unsigned m=0;m<Nlist;m++) {
// Loop on Ordering Vector size excluding zeros (i=1)
if(timer) stopwatch.stop("2 Sort cPIV");
if(timer) stopwatch.start("3 Reconstruct cPIV");
for(unsigned i=1; i<Nprec; i++) {
// Loop on the ranks
for(unsigned l=0; l<stride; l++) {
Expand All @@ -1000,7 +999,7 @@ void PIV::calculate()
}
}
}
if(timer) stopwatch.stop("2 Sort cPIV");
if(timer) stopwatch.stop("3 Reconstruct cPIV");
} else {
for(unsigned i=1; i<Nprec; i++) {
for(unsigned m=0; m<OrdVec[i]; m++) {
Expand All @@ -1013,7 +1012,6 @@ void PIV::calculate()
}
}
}

Vector distance;
double dfunc=0.;
// Calculate volume scaling factor
Expand Down Expand Up @@ -1072,7 +1070,7 @@ void PIV::calculate()
exit();
}

if(timer) stopwatch.start("3 Build For Derivatives");
if(timer) stopwatch.start("4 Build For Derivatives");
// non-global variables Nder and Scalevol defined to speedup if structures in cycles
bool Nder=CompDer;
bool Scalevol=Svol;
Expand Down Expand Up @@ -1206,18 +1204,17 @@ void PIV::calculate()
}
}

if (!serial) {
if (!serial && comm.initialized()) {
comm.Barrier();
comm.Sum(&m_PIVdistance,1);
if(!m_deriv.empty()) comm.Sum(&m_deriv[0][0],3*m_deriv.size());
comm.Sum(&m_virial[0][0],9);
}

}
prev_stp=getStep();

//Timing
if(timer) stopwatch.stop("3 Build For Derivatives");
if(timer) stopwatch.stop("4 Build For Derivatives");
if(timer) {
log.printf("Timings for action %s with label %s \n", getName().c_str(), getLabel().c_str() );
log<<stopwatch;
Expand Down
1 change: 0 additions & 1 deletion src/tools/SwitchingFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,6 @@ double SwitchingFunction::get_dmax2() const {
return dmax_2;
}


}


Expand Down

0 comments on commit 8854ae3

Please sign in to comment.