@@ -308,12 +308,10 @@ void AdjacencyMatrixBase::performTask( const std::string& controller, const unsi
308
308
// Update dynamic list indices for virial
309
309
unsigned base = 3 *getNumberOfAtoms (); for (unsigned j=0 ; j<9 ; ++j) myvals.updateIndex ( w_ind, base+j );
310
310
// And the indices for the derivatives of the row of the matrix
311
- if ( chainContinuesAfterThisAction () ) {
312
- unsigned nmat = getConstPntrToComponent (0 )->getPositionInMatrixStash (), nmat_ind = myvals.getNumberOfMatrixRowDerivatives ( nmat );
313
- std::vector<unsigned >& matrix_indices ( myvals.getMatrixRowDerivativeIndices ( nmat ) );
314
- matrix_indices[nmat_ind+0 ]=3 *index2+0 ; matrix_indices[nmat_ind+1 ]=3 *index2+1 ; matrix_indices[nmat_ind+2 ]=3 *index2+2 ;
315
- myvals.setNumberOfMatrixRowDerivatives ( nmat, nmat_ind+3 );
316
- }
311
+ unsigned nmat = getConstPntrToComponent (0 )->getPositionInMatrixStash (), nmat_ind = myvals.getNumberOfMatrixRowDerivatives ( nmat );
312
+ std::vector<unsigned >& matrix_indices ( myvals.getMatrixRowDerivativeIndices ( nmat ) );
313
+ matrix_indices[nmat_ind+0 ]=3 *index2+0 ; matrix_indices[nmat_ind+1 ]=3 *index2+1 ; matrix_indices[nmat_ind+2 ]=3 *index2+2 ;
314
+ myvals.setNumberOfMatrixRowDerivatives ( nmat, nmat_ind+3 );
317
315
}
318
316
319
317
// Calculate the components if we need them
@@ -354,20 +352,18 @@ void AdjacencyMatrixBase::performTask( const std::string& controller, const unsi
354
352
myvals.addDerivative ( z_index, base+1 , 0 ); myvals.addDerivative ( z_index, base+4 , 0 ); myvals.addDerivative ( z_index, base+7 , 0 );
355
353
myvals.addDerivative ( z_index, base+2 , -atom[0 ] ); myvals.addDerivative ( z_index, base+5 , -atom[1 ] ); myvals.addDerivative ( z_index, base+8 , -atom[2 ] );
356
354
for (unsigned k=0 ; k<9 ; ++k) { myvals.updateIndex ( x_index, base+k ); myvals.updateIndex ( y_index, base+k ); myvals.updateIndex ( z_index, base+k ); }
357
- if ( chainContinuesAfterThisAction () ) {
358
- for (unsigned k=1 ; k<4 ; ++k) {
359
- unsigned nmat = getConstPntrToComponent (k)->getPositionInMatrixStash (), nmat_ind = myvals.getNumberOfMatrixRowDerivatives ( nmat );
360
- std::vector<unsigned >& matrix_indices ( myvals.getMatrixRowDerivativeIndices ( nmat ) );
361
- matrix_indices[nmat_ind+0 ]=3 *index2+0 ; matrix_indices[nmat_ind+1 ]=3 *index2+1 ; matrix_indices[nmat_ind+2 ]=3 *index2+2 ;
362
- myvals.setNumberOfMatrixRowDerivatives ( nmat, nmat_ind+3 );
363
- }
355
+ for (unsigned k=1 ; k<4 ; ++k) {
356
+ unsigned nmat = getConstPntrToComponent (k)->getPositionInMatrixStash (), nmat_ind = myvals.getNumberOfMatrixRowDerivatives ( nmat );
357
+ std::vector<unsigned >& matrix_indices ( myvals.getMatrixRowDerivativeIndices ( nmat ) );
358
+ matrix_indices[nmat_ind+0 ]=3 *index2+0 ; matrix_indices[nmat_ind+1 ]=3 *index2+1 ; matrix_indices[nmat_ind+2 ]=3 *index2+2 ;
359
+ myvals.setNumberOfMatrixRowDerivatives ( nmat, nmat_ind+3 );
364
360
}
365
361
}
366
362
}
367
363
}
368
364
369
365
void AdjacencyMatrixBase::runEndOfRowJobs ( const unsigned & ind, const std::vector<unsigned > & indices, MultiValue& myvals ) const {
370
- if ( doNotCalculateDerivatives () || ! chainContinuesAfterThisAction () ) return ;
366
+ if ( doNotCalculateDerivatives () ) return ;
371
367
372
368
for (int k=0 ; k<getNumberOfComponents (); ++k) {
373
369
unsigned nmat = getConstPntrToComponent (k)->getPositionInMatrixStash (), nmat_ind = myvals.getNumberOfMatrixRowDerivatives ( nmat );
0 commit comments