From 61a286a0da789bbe08338e12576450357fb150df Mon Sep 17 00:00:00 2001 From: Donatas Surblys Date: Mon, 11 Nov 2019 19:16:21 +0900 Subject: [PATCH] compute centroid/atom/stress will use cvatom from pair styles when available --- src/compute_centroid_stress_atom.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/compute_centroid_stress_atom.cpp b/src/compute_centroid_stress_atom.cpp index 86ea4b45af..a78c2ee421 100644 --- a/src/compute_centroid_stress_atom.cpp +++ b/src/compute_centroid_stress_atom.cpp @@ -173,12 +173,19 @@ void ComputeCentroidStressAtom::compute_peratom() // per-atom virial and per-atom centroid virial are the same for pairwise // many-body pair styles not yet implemented if (pairflag && force->pair) { - double **vatom = force->pair->vatom; - for (i = 0; i < npair; i++) { - for (j = 0; j < 6; j++) - stress[i][j] += vatom[i][j]; - for (j = 6; j < 9; j++) - stress[i][j] += vatom[i][j-3]; + if (force->pair->cntratmstressflag & 2) { + double **cvatom = force->pair->cvatom; + for (i = 0; i < npair; i++) + for (j = 0; j < 9; j++) + stress[i][j] += cvatom[i][j]; + } else { + double **vatom = force->pair->vatom; + for (i = 0; i < npair; i++) { + for (j = 0; j < 6; j++) + stress[i][j] += vatom[i][j]; + for (j = 6; j < 9; j++) + stress[i][j] += vatom[i][j-3]; + } } }