Skip to content

Commit

Permalink
Fix sign for virials
Browse files Browse the repository at this point in the history
  • Loading branch information
Luthaf committed Apr 22, 2024
1 parent 8c02493 commit 12c2254
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/metatensor/metatensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,17 +686,17 @@ void MetatensorPlumedAction::apply() {
);

// add virials to the derivatives
derivatives.push_back(strain_grad[0][0].item<double>());
derivatives.push_back(strain_grad[0][1].item<double>());
derivatives.push_back(strain_grad[0][2].item<double>());
derivatives.push_back(-strain_grad[0][0].item<double>());
derivatives.push_back(-strain_grad[0][1].item<double>());
derivatives.push_back(-strain_grad[0][2].item<double>());

derivatives.push_back(strain_grad[1][0].item<double>());
derivatives.push_back(strain_grad[1][1].item<double>());
derivatives.push_back(strain_grad[1][2].item<double>());
derivatives.push_back(-strain_grad[1][0].item<double>());
derivatives.push_back(-strain_grad[1][1].item<double>());
derivatives.push_back(-strain_grad[1][2].item<double>());

derivatives.push_back(strain_grad[2][0].item<double>());
derivatives.push_back(strain_grad[2][1].item<double>());
derivatives.push_back(strain_grad[2][2].item<double>());
derivatives.push_back(-strain_grad[2][0].item<double>());
derivatives.push_back(-strain_grad[2][1].item<double>());
derivatives.push_back(-strain_grad[2][2].item<double>());

unsigned index = 0;
this->setForcesOnAtoms(derivatives, index);
Expand Down

0 comments on commit 12c2254

Please sign in to comment.