@@ -206,25 +206,6 @@ void AdjacencyMatrixBase::updateNeighbourList() {
206
206
if ( read_one_group && maxcol==getConstPntrToComponent (0 )->getShape ()[1 ] ) maxcol = maxcol-1 ;
207
207
}
208
208
209
- void AdjacencyMatrixBase::getAdditionalTasksRequired ( ActionWithVector* action, std::vector<unsigned >& atasks ) {
210
- if ( action==this ) return ;
211
- // Update the neighbour list
212
- updateNeighbourList ();
213
-
214
- unsigned nactive = atasks.size ();
215
- std::vector<unsigned > indlist ( 1 + ablocks.size () + threeblocks.size () );
216
- for (unsigned i=0 ; i<nactive; ++i) {
217
- unsigned num = retrieveNeighbours ( atasks[i], indlist );
218
- for (unsigned j=0 ; j<num; ++j) {
219
- bool found=false ;
220
- for (unsigned k=0 ; k<atasks.size (); ++k ) {
221
- if ( indlist[j]==atasks[k] ) { found=true ; break ; }
222
- }
223
- if ( !found ) atasks.push_back ( indlist[j] );
224
- }
225
- }
226
- }
227
-
228
209
unsigned AdjacencyMatrixBase::retrieveNeighbours ( const unsigned & current, std::vector<unsigned > & indices ) const {
229
210
unsigned natoms=nlist[current]; indices[0 ]=current;
230
211
unsigned lstart = getConstPntrToComponent (0 )->getShape ()[0 ] + current*(1 +natoms_per_list); plumed_dbg_assert ( nlist[lstart]==current );
@@ -278,10 +259,9 @@ void AdjacencyMatrixBase::performTask( const std::string& controller, const unsi
278
259
// Update dynamic list indices for virial
279
260
unsigned base = 3 *getNumberOfAtoms (); for (unsigned j=0 ; j<9 ; ++j) myvals.updateIndex ( 0 , base+j );
280
261
// And the indices for the derivatives of the row of the matrix
281
- unsigned nmat = getConstPntrToComponent (0 )->getPositionInMatrixStash (), nmat_ind = myvals.getNumberOfMatrixRowDerivatives ( nmat );
282
- std::vector<unsigned >& matrix_indices ( myvals.getMatrixRowDerivativeIndices ( nmat ) );
262
+ unsigned nmat_ind = myvals.getNumberOfMatrixRowDerivatives (); std::vector<unsigned >& matrix_indices ( myvals.getMatrixRowDerivativeIndices () );
283
263
matrix_indices[nmat_ind+0 ]=3 *index2+0 ; matrix_indices[nmat_ind+1 ]=3 *index2+1 ; matrix_indices[nmat_ind+2 ]=3 *index2+2 ;
284
- myvals.setNumberOfMatrixRowDerivatives ( nmat, nmat_ind+3 );
264
+ myvals.setNumberOfMatrixRowDerivatives ( nmat_ind+3 );
285
265
}
286
266
287
267
// Calculate the components if we need them
@@ -319,38 +299,30 @@ void AdjacencyMatrixBase::performTask( const std::string& controller, const unsi
319
299
myvals.addDerivative ( 3 , base+1 , 0 ); myvals.addDerivative ( 3 , base+4 , 0 ); myvals.addDerivative ( 3 , base+7 , 0 );
320
300
myvals.addDerivative ( 3 , base+2 , -atom[0 ] ); myvals.addDerivative ( 3 , base+5 , -atom[1 ] ); myvals.addDerivative ( 3 , base+8 , -atom[2 ] );
321
301
for (unsigned k=0 ; k<9 ; ++k) { myvals.updateIndex ( 1 , base+k ); myvals.updateIndex ( 2 , base+k ); myvals.updateIndex ( 3 , base+k ); }
322
- for (unsigned k=1 ; k<4 ; ++k) {
323
- unsigned nmat = getConstPntrToComponent (k)->getPositionInMatrixStash (), nmat_ind = myvals.getNumberOfMatrixRowDerivatives ( nmat );
324
- std::vector<unsigned >& matrix_indices ( myvals.getMatrixRowDerivativeIndices ( nmat ) );
325
- matrix_indices[nmat_ind+0 ]=3 *index2+0 ; matrix_indices[nmat_ind+1 ]=3 *index2+1 ; matrix_indices[nmat_ind+2 ]=3 *index2+2 ;
326
- myvals.setNumberOfMatrixRowDerivatives ( nmat, nmat_ind+3 );
327
- }
328
302
}
329
303
}
330
304
}
331
305
332
306
void AdjacencyMatrixBase::runEndOfRowJobs ( const unsigned & ind, const std::vector<unsigned > & indices, MultiValue& myvals ) const {
333
307
if ( doNotCalculateDerivatives () ) return ;
334
308
335
- for (int k=0 ; k<getNumberOfComponents (); ++k) {
336
- unsigned nmat = getConstPntrToComponent (k)->getPositionInMatrixStash (), nmat_ind = myvals.getNumberOfMatrixRowDerivatives ( nmat );
337
- std::vector<unsigned >& matrix_indices ( myvals.getMatrixRowDerivativeIndices ( nmat ) );
338
- plumed_assert ( nmat_ind<matrix_indices.size () );
339
- matrix_indices[nmat_ind+0 ]=3 *ind+0 ;
340
- matrix_indices[nmat_ind+1 ]=3 *ind+1 ;
341
- matrix_indices[nmat_ind+2 ]=3 *ind+2 ;
309
+ unsigned nmat_ind = myvals.getNumberOfMatrixRowDerivatives ();
310
+ std::vector<unsigned >& matrix_indices ( myvals.getMatrixRowDerivativeIndices () );
311
+ plumed_assert ( nmat_ind<matrix_indices.size () );
312
+ matrix_indices[nmat_ind+0 ]=3 *ind+0 ;
313
+ matrix_indices[nmat_ind+1 ]=3 *ind+1 ;
314
+ matrix_indices[nmat_ind+2 ]=3 *ind+2 ;
315
+ nmat_ind+=3 ;
316
+ for (unsigned i=myvals.getSplitIndex (); i<myvals.getNumberOfIndices (); ++i) {
317
+ matrix_indices[nmat_ind+0 ]=3 *indices[i]+0 ;
318
+ matrix_indices[nmat_ind+1 ]=3 *indices[i]+1 ;
319
+ matrix_indices[nmat_ind+2 ]=3 *indices[i]+2 ;
342
320
nmat_ind+=3 ;
343
- for (unsigned i=myvals.getSplitIndex (); i<myvals.getNumberOfIndices (); ++i) {
344
- matrix_indices[nmat_ind+0 ]=3 *indices[i]+0 ;
345
- matrix_indices[nmat_ind+1 ]=3 *indices[i]+1 ;
346
- matrix_indices[nmat_ind+2 ]=3 *indices[i]+2 ;
347
- nmat_ind+=3 ;
348
- }
349
- unsigned virbase = 3 *getNumberOfAtoms ();
350
- for (unsigned i=0 ; i<9 ; ++i) matrix_indices[nmat_ind+i]=virbase+i;
351
- nmat_ind+=9 ; plumed_dbg_massert ( nmat_ind<=3 *getNumberOfAtoms () + 9 , " found too many derivatives in " + getLabel () );
352
- myvals.setNumberOfMatrixRowDerivatives ( nmat, nmat_ind );
353
321
}
322
+ unsigned virbase = 3 *getNumberOfAtoms ();
323
+ for (unsigned i=0 ; i<9 ; ++i) matrix_indices[nmat_ind+i]=virbase+i;
324
+ nmat_ind+=9 ; plumed_dbg_massert ( nmat_ind<=3 *getNumberOfAtoms () + 9 , " found too many derivatives in " + getLabel () );
325
+ myvals.setNumberOfMatrixRowDerivatives ( nmat_ind );
354
326
}
355
327
356
328
}
0 commit comments