Skip to content

Commit

Permalink
Fixed code that say regtest adjmat/rt45 works as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Gareth Aneurin Tribello authored and Gareth Aneurin Tribello committed Sep 6, 2024
1 parent 8080dcb commit aaa48f6
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
8 changes: 8 additions & 0 deletions regtest/adjmat/rt45/config
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ plumed_modules=adjmat
# this is to test a different name
arg="--plumed plumed.dat --trajectory-stride 10 --timestep 0.005 --ixyz trajectory.xyz --dump-forces forces --dump-forces-fmt=%8.4f" # --debug-forces=forces.num"
extra_files="../../trajectories/trajectory.xyz"

function plumed_regtest_before() {
export PLUMED_FORBID_CHAINS=yes
}

function plumed_regtest_after() {
export PLUMED_FORBID_CHAINS=no
}
3 changes: 0 additions & 3 deletions regtest/adjmat/rt45/plumed.dat
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ a2: COORD_ANGLES ...
BETWEEN1={GAUSSIAN LOWER=0.25pi UPPER=0.75pi}
...

PRINT ARG=a1_wsum FILE=matrix

DUMPDERIVATIVES ARG=a1_sum FILE=deriv FMT=%8.4f
a2b: CUSTOM ARG=a2_between-1,a2_denom FUNC=x/y PERIODIC=NO
PRINT ARG=a1.*,a2.*,a2b FILE=colvar FMT=%8.5f
BIASVALUE ARG=a1_mean
Expand Down
22 changes: 19 additions & 3 deletions src/matrixtools/MatrixTimesMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ namespace matrixtools {
class MatrixTimesMatrix : public ActionWithMatrix {
private:
bool squared;
bool diagzero;
unsigned nderivatives;
bool stored_matrix1, stored_matrix2;
public:
Expand All @@ -66,6 +67,7 @@ PLUMED_REGISTER_ACTION(MatrixTimesMatrix,"DISSIMILARITIES")
void MatrixTimesMatrix::registerKeywords( Keywords& keys ) {
ActionWithMatrix::registerKeywords(keys); keys.use("ARG"); keys.use("MASK");
keys.addFlag("SQUARED",false,"calculate the squares of the dissimilarities (this option cannot be used with MATRIX_PRODUCT)");
keys.addFlag("ELEMENTS_ON_DIAGONAL_ARE_ZERO",false,"set all diagonal elements to zero");
keys.setValueDescription("the product of the two input matrices");
}

Expand All @@ -83,6 +85,9 @@ MatrixTimesMatrix::MatrixTimesMatrix(const ActionOptions&ao):
std::string headstr=getFirstActionInChain()->getLabel();
stored_matrix1 = getPntrToArgument(0)->ignoreStoredValue( headstr );
stored_matrix2 = getPntrToArgument(1)->ignoreStoredValue( headstr );
parseFlag("ELEMENTS_ON_DIAGONAL_ARE_ZERO",diagzero);
if( diagzero ) log.printf(" setting diagonal elements equal to zero\n");

if( getName()=="DISSIMILARITIES" ) {
parseFlag("SQUARED",squared);
if( squared ) log.printf(" calculating the squares of the dissimilarities \n");
Expand Down Expand Up @@ -119,13 +124,24 @@ void MatrixTimesMatrix::getAdditionalTasksRequired( ActionWithVector* action, st
}

void MatrixTimesMatrix::setupForTask( const unsigned& task_index, std::vector<unsigned>& indices, MultiValue& myvals ) const {
unsigned start_n = getPntrToArgument(0)->getShape()[0];
if( getNumberOfArguments()>2 ) {
unsigned start_n = getPntrToArgument(0)->getShape()[0], size_v = getPntrToArgument(2)->getRowLength(task_index);
unsigned size_v = getPntrToArgument(2)->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 + getPntrToArgument(2)->getRowIndex(task_index, i);
myvals.setSplitIndex( size_v + 1 );
myvals.setSplitIndex( size_v + 1 ); return;
}

unsigned size_v = getPntrToArgument(1)->getShape()[1];
if( diagzero ) {
if( indices.size()!=size_v ) indices.resize( size_v );
unsigned k=1;
for(unsigned i=0; i<size_v; ++i) {
if( task_index==i ) continue ;
indices[k] = size_v + i; k++;
}
myvals.setSplitIndex( size_v );
} else {
unsigned start_n = getPntrToArgument(0)->getShape()[0], size_v = getPntrToArgument(1)->getShape()[1];
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;
myvals.setSplitIndex( size_v + 1 );
Expand Down
2 changes: 1 addition & 1 deletion src/multicolvar/CoordAngles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ CoordAngles::CoordAngles(const ActionOptions& ao):
// Avoid double counting
readInputLine( getShortcutLabel() + "_wmat: CUSTOM ARG=" + getShortcutLabel() + "_swd FUNC=0.5*x PERIODIC=NO");
// And the matrix of dot products and the angles
readInputLine( getShortcutLabel() + "_dpmat: MATRIX_PRODUCT ARG=" + getShortcutLabel() + "_stack," + getShortcutLabel() + "_stackT");
readInputLine( getShortcutLabel() + "_dpmat: MATRIX_PRODUCT ELEMENTS_ON_DIAGONAL_ARE_ZERO ARG=" + getShortcutLabel() + "_stack," + getShortcutLabel() + "_stackT");
readInputLine( getShortcutLabel() + "_angles: CUSTOM ARG=" + getShortcutLabel() + "_dpmat FUNC=acos(x) PERIODIC=NO");
// Read the input
Keywords keys; MultiColvarShortcuts::shortcutKeywords( keys ); pruneShortcuts( keys ); bool do_mean; parseFlag("MEAN",do_mean);
Expand Down

1 comment on commit aaa48f6

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