From e0f560683c13abda72691f172d81f0dae1fa82b7 Mon Sep 17 00:00:00 2001 From: Gareth Aneurin Tribello Date: Thu, 25 Jul 2024 09:11:41 +0100 Subject: [PATCH] Reduced the size of the forces array that is manipulated in matrix vector multiplication --- src/core/ActionWithVector.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/ActionWithVector.cpp b/src/core/ActionWithVector.cpp index d588ff8146..fa19b58ca2 100644 --- a/src/core/ActionWithVector.cpp +++ b/src/core/ActionWithVector.cpp @@ -703,6 +703,12 @@ bool ActionWithVector::checkForForces() { getNumberOfStreamedQuantities( getLabel(), nquants, nmatrices, maxcol, nbooks ); // Recover the number of derivatives we require (this should be equal to the number of forces) unsigned nderiv=0; getNumberOfStreamedDerivatives( nderiv, NULL ); + if( !action_to_do_after && arg_deriv_starts.size()>0 ) { + nderiv = 0; + for(unsigned i=0; igetNumberOfStoredValues(); + } + } if( forcesForApply.size()!=nderiv ) forcesForApply.resize( nderiv ); // Clear force buffer forcesForApply.assign( forcesForApply.size(), 0.0 );