Skip to content

Commit

Permalink
Fixed to ensure that regtests gridtools/rt-spherical-integral-2, symf…
Browse files Browse the repository at this point in the history
…unc/rt-two-filter and crystdistrib/rt-bops all work with new force scheme
  • Loading branch information
Gareth Aneurin Tribello authored and Gareth Aneurin Tribello committed Sep 6, 2024
1 parent cd81a35 commit 8080dcb
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 15 deletions.
14 changes: 7 additions & 7 deletions regtest/gridtools/rt-spherical-integral-2/config
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ plumed_modules=adjmat
# this is to test a different name
arg="--plumed plumed.dat --ixyz trajectory.xyz --dump-forces forces --dump-forces-fmt %8.4f" # --debug-forces forces.num"

# function plumed_regtest_before() {
# export PLUMED_FORBID_CHAINS=yes
# }
#
# function plumed_regtest_after() {
# export PLUMED_FORBID_CHAINS=no
# }
function plumed_regtest_before() {
export PLUMED_FORBID_CHAINS=yes
}

function plumed_regtest_after() {
export PLUMED_FORBID_CHAINS=no
}
8 changes: 8 additions & 0 deletions regtest/symfunc/rt-two-filter/config
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@ type=driver
plumed_modules="symfunc adjmat"
# this is to test a different name
arg="--plumed plumed.dat --ixyz gas-one.xyz --dump-forces forces --dump-forces-fmt=%8.4f" #--debug-forces forces.num"

function plumed_regtest_before() {
export PLUMED_FORBID_CHAINS=yes
}

function plumed_regtest_after() {
export PLUMED_FORBID_CHAINS=no
}
2 changes: 1 addition & 1 deletion regtest/symfunc/rt-two-filter/plumed.dat
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ c1: COORDINATIONNUMBER SPECIES=1-150 SWITCH={EXP D_0=4.0 R_0=0.5 D_MAX=6.0}
c1m: MORE_THAN ARG=c1 SWITCH={RATIONAL D_0=2.0 R_0=0.1}

con: CONTACT_MATRIX GROUP=c1 SWITCH={EXP D_0=4.0 R_0=0.5 D_MAX=6.0}
dot: OUTER_PRODUCT ARG=c1m,c1m
dot: OUTER_PRODUCT ARG=c1m,c1m MASK=con
mm: MATHEVAL ARG=con,dot FUNC=x*y PERIODIC=NO

ones: ONES SIZE=150
Expand Down
4 changes: 2 additions & 2 deletions src/crystdistrib/QuaternionBondProductMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ unsigned QuaternionBondProductMatrix::getNumberOfColumns() const {
}

void QuaternionBondProductMatrix::setupForTask( const unsigned& task_index, std::vector<unsigned>& indices, MultiValue& myvals ) const {
unsigned start_n = getPntrToArgument(4)->getShape()[0], size_v = getPntrToArgument(4)->getShape()[1];
Value* myarg = getPntrToArgument(4); unsigned start_n = myarg->getShape()[0], size_v = myarg->getRowLength(task_index);
if( indices.size()!=size_v+1 ) indices.resize( size_v+1 );
for(unsigned i=0; i<size_v; ++i) indices[i+1] = start_n + i;
for(unsigned i=0; i<size_v; ++i) indices[i+1] = start_n + myarg->getRowIndex( task_index, i);
myvals.setSplitIndex( size_v + 1 );
}

Expand Down
3 changes: 1 addition & 2 deletions src/function/FunctionOfMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,7 @@ void FunctionOfMatrix<T>::performTask( const std::string& controller, const unsi
if( getPntrToArgument(j)->getRank()==2 ) {
for(int i=0; i<getNumberOfComponents(); ++i) {
unsigned ostrn=getConstPntrToComponent(i)->getPositionInStream();
unsigned myind = base + getPntrToArgument(j)->getNumberOfColumns()*index1 + ind2;
if( getConstPntrToComponent(i)->valueIsStored() && getConstPntrToComponent(i)->getNumberOfColumns()<getConstPntrToComponent(i)->getShape()[1] ) myind = base + getPntrToArgument(j)->getNumberOfColumns()*index1 + getConstPntrToComponent(i)->getRowLength(index1);
unsigned myind = base + getPntrToArgument(j)->getIndexInStore( index1*getPntrToArgument(j)->getShape()[1] + ind2 );
myvals.addDerivative( ostrn, myind, derivatives(i,j) );
myvals.updateIndex( ostrn, myind );
}
Expand Down
20 changes: 17 additions & 3 deletions src/matrixtools/OuterProduct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class OuterProduct : public ActionWithMatrix {
PLUMED_REGISTER_ACTION(OuterProduct,"OUTER_PRODUCT")

void OuterProduct::registerKeywords( Keywords& keys ) {
ActionWithMatrix::registerKeywords(keys); keys.use("ARG");
ActionWithMatrix::registerKeywords(keys); keys.use("ARG"); keys.use("MASK");
keys.add("compulsory","FUNC","x*y","the function of the input vectors that should be put in the elements of the outer product");
keys.addFlag("ELEMENTS_ON_DIAGONAL_ARE_ZERO",false,"set all diagonal elements to zero");
keys.setValueDescription("a matrix containing the outer product of the two input vectors that was obtained using the function that was input");
Expand All @@ -67,9 +67,15 @@ OuterProduct::OuterProduct(const ActionOptions&ao):
domin(false),
domax(false)
{
if( getNumberOfArguments()!=2 ) error("should be two arguments to this action, a matrix and a vector");
unsigned nargs=getNumberOfArguments(); if( getNumberOfMasks()>0 ) nargs = nargs - getNumberOfMasks();
if( nargs!=2 ) error("should be two arguments to this action, they should both be vectors");
if( getPntrToArgument(0)->getRank()!=1 || getPntrToArgument(0)->hasDerivatives() ) error("first argument to this action should be a vector");
if( getPntrToArgument(1)->getRank()!=1 || getPntrToArgument(1)->hasDerivatives() ) error("first argument to this action should be a vector");
if( getNumberOfMasks()==1 ) {
if( getPntrToArgument(2)->getRank()!=2 || getPntrToArgument(2)->hasDerivatives() ) error("mask argument should be a matrix");
if( getPntrToArgument(2)->getShape()[0]!=getPntrToArgument(0)->getShape()[0] ) error("mask argument has wrong size");
if( getPntrToArgument(2)->getShape()[1]!=getPntrToArgument(1)->getShape()[0] ) error("mask argument has wrong size");
}

std::string func; parse("FUNC",func);
if( func=="min") {
Expand Down Expand Up @@ -106,7 +112,15 @@ void OuterProduct::prepare() {
}

void OuterProduct::setupForTask( const unsigned& task_index, std::vector<unsigned>& indices, MultiValue& myvals ) const {
unsigned start_n = getPntrToArgument(0)->getShape()[0], size_v = getPntrToArgument(1)->getShape()[0];
unsigned start_n = getPntrToArgument(0)->getShape()[0];
if( getNumberOfMasks()>0 ) {
Value* maskarg = getPntrToArgument(2); unsigned size_v = maskarg->getRowLength(task_index);
if( indices.size()!=size_v+1 ) indices.resize( size_v+1 );
for(unsigned i=0; i<size_v; ++i) indices[i+1] = start_n + maskarg->getRowIndex( task_index, i );
myvals.setSplitIndex( 1 + size_v ); return;
}

unsigned size_v = getPntrToArgument(1)->getShape()[0];
if( diagzero ) {
if( indices.size()!=size_v ) indices.resize( size_v );
unsigned k=1;
Expand Down

1 comment on commit 8080dcb

@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/METATENSOR.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.