From 5e4dd5321c423fa0abf80e18a1a3a3930c24dc10 Mon Sep 17 00:00:00 2001 From: Stephen Sanderson Date: Wed, 17 Mar 2021 11:43:25 +1000 Subject: [PATCH] Using local dof and tfactor for compute_array to prevent overwrite --- src/compute_temp_profile.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/compute_temp_profile.cpp b/src/compute_temp_profile.cpp index 5bb415f5ed..52f2f7de6f 100644 --- a/src/compute_temp_profile.cpp +++ b/src/compute_temp_profile.cpp @@ -339,12 +339,13 @@ void ComputeTempProfile::compute_array() totcount += array[i][0]; } double nper = domain->dimension - (extra_dof + fix_dof)/totcount; + double dofbin, tfactorbin; for (i = 0; i < nbins; i++) { if (array[i][0] > 0.0) { - dof = nper*array[i][0] - domain->dimension; - if (dof > 0) tfactor = force->mvv2e / (dof * force->boltz); - else tfactor = 0.0; - array[i][1] = tfactor*tbinall[i]; + dofbin = nper*array[i][0] - domain->dimension; + if (dofbin > 0) tfactorbin = force->mvv2e / (dofbin * force->boltz); + else tfactorbin = 0.0; + array[i][1] = tfactorbin*tbinall[i]; } else array[i][1] = 0.0; } }