From dc53071b60e60b10ffc8a92431d3cf12be6bb51c Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 1 Apr 2015 14:41:46 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@13354 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/ASPHERE/compute_temp_asphere.cpp | 10 +++++----- src/CORESHELL/compute_temp_cs.cpp | 8 ++++---- src/USER-EFF/compute_temp_deform_eff.cpp | 8 ++++---- src/USER-EFF/compute_temp_eff.cpp | 8 ++++---- src/USER-EFF/compute_temp_region_eff.cpp | 4 +++- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/ASPHERE/compute_temp_asphere.cpp b/src/ASPHERE/compute_temp_asphere.cpp index 48b443f049..0f2fea0356 100755 --- a/src/ASPHERE/compute_temp_asphere.cpp +++ b/src/ASPHERE/compute_temp_asphere.cpp @@ -147,7 +147,7 @@ void ComputeTempAsphere::dof_compute() // assume full rotation of extended particles // user should correct this via compute_modify if needed - double natoms = group->count(igroup); + natoms_temp = group->count(igroup); int nper; if (domain->dimension == 3) { if (mode == ALL) nper = 6; @@ -156,12 +156,12 @@ void ComputeTempAsphere::dof_compute() if (mode == ALL) nper = 3; else nper = 1; } - dof = nper*natoms; + dof = nper*natoms_temp; // additional adjustments to dof if (tempbias == 1) { - if (mode == ALL) dof -= tbias->dof_remove(-1) * natoms; + if (mode == ALL) dof -= tbias->dof_remove(-1) * natoms_temp; } else if (tempbias == 2) { int *mask = atom->mask; @@ -179,8 +179,6 @@ void ComputeTempAsphere::dof_compute() } dof -= extra_dof + fix_dof; - if (dof < 0.0 && natoms > 0.0) - error->all(FLERR,"Temperature compute degrees of freedom < 0"); if (dof > 0) tfactor = force->mvv2e / (dof * force->boltz); else tfactor = 0.0; } @@ -269,6 +267,8 @@ double ComputeTempAsphere::compute_scalar() MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world); if (dynamic || tempbias == 2) dof_compute(); + if (dof < 0.0 && natoms_temp > 0.0) + error->all(FLERR,"Temperature compute degrees of freedom < 0"); scalar *= tfactor; return scalar; } diff --git a/src/CORESHELL/compute_temp_cs.cpp b/src/CORESHELL/compute_temp_cs.cpp index 807a132e94..cd577291f1 100644 --- a/src/CORESHELL/compute_temp_cs.cpp +++ b/src/CORESHELL/compute_temp_cs.cpp @@ -210,12 +210,10 @@ void ComputeTempCS::dof_compute() { adjust_dof_fix(); int nper = domain->dimension; - double natoms = group->count(igroup); - dof = nper * natoms; + natoms_temp = group->count(igroup); + dof = nper * natoms_temp; dof -= nper * nshells; dof -= extra_dof + fix_dof; - if (dof < 0.0 && natoms > 0.0) - error->all(FLERR,"Temperature compute degrees of freedom < 0"); if (dof > 0) tfactor = force->mvv2e / (dof * force->boltz); else tfactor = 0.0; } @@ -258,6 +256,8 @@ double ComputeTempCS::compute_scalar() MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world); if (dynamic) dof_compute(); + if (dof < 0.0 && natoms_temp > 0.0) + error->all(FLERR,"Temperature compute degrees of freedom < 0"); scalar *= tfactor; return scalar; } diff --git a/src/USER-EFF/compute_temp_deform_eff.cpp b/src/USER-EFF/compute_temp_deform_eff.cpp index 92ebdb298a..8ff1d6f768 100644 --- a/src/USER-EFF/compute_temp_deform_eff.cpp +++ b/src/USER-EFF/compute_temp_deform_eff.cpp @@ -101,8 +101,8 @@ void ComputeTempDeformEff::setup() void ComputeTempDeformEff::dof_compute() { adjust_dof_fix(); - double natoms = group->count(igroup); - dof = domain->dimension * natoms; + natoms_temp = group->count(igroup); + dof = domain->dimension * natoms_temp; dof -= extra_dof + fix_dof; // just include nuclear dof @@ -123,8 +123,6 @@ void ComputeTempDeformEff::dof_compute() dof -= domain->dimension * nelectrons; - if (dof < 0.0 && natoms > 0.0) - error->all(FLERR,"Temperature compute degrees of freedom < 0"); if (dof > 0) tfactor = force->mvv2e / (dof * force->boltz); else tfactor = 0.0; } @@ -176,6 +174,8 @@ double ComputeTempDeformEff::compute_scalar() MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world); if (dynamic) dof_compute(); + if (dof < 0.0 && natoms_temp > 0.0) + error->all(FLERR,"Temperature compute degrees of freedom < 0"); scalar *= tfactor; return scalar; } diff --git a/src/USER-EFF/compute_temp_eff.cpp b/src/USER-EFF/compute_temp_eff.cpp index 9b24e0a707..2b4e507091 100644 --- a/src/USER-EFF/compute_temp_eff.cpp +++ b/src/USER-EFF/compute_temp_eff.cpp @@ -67,8 +67,8 @@ void ComputeTempEff::setup() void ComputeTempEff::dof_compute() { adjust_dof_fix(); - double natoms = group->count(igroup); - dof = domain->dimension * natoms; + natoms_temp = group->count(igroup); + dof = domain->dimension * natoms_temp; dof -= extra_dof + fix_dof; int *spin = atom->spin; @@ -87,8 +87,6 @@ void ComputeTempEff::dof_compute() dof -= domain->dimension * nelectrons; - if (dof < 0.0 && natoms > 0.0) - error->all(FLERR,"Temperature compute degrees of freedom < 0"); if (dof > 0.0) tfactor = force->mvv2e / (dof * force->boltz); else tfactor = 0.0; } @@ -122,6 +120,8 @@ double ComputeTempEff::compute_scalar() MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world); if (dynamic) dof_compute(); + if (dof < 0.0 && natoms_temp > 0.0) + error->all(FLERR,"Temperature compute degrees of freedom < 0"); scalar *= tfactor; return scalar; } diff --git a/src/USER-EFF/compute_temp_region_eff.cpp b/src/USER-EFF/compute_temp_region_eff.cpp index d2517d8791..3c762e5d7b 100644 --- a/src/USER-EFF/compute_temp_region_eff.cpp +++ b/src/USER-EFF/compute_temp_region_eff.cpp @@ -148,6 +148,8 @@ double ComputeTempRegionEff::compute_scalar() tarray[1] = t; MPI_Allreduce(tarray,tarray_all,2,MPI_DOUBLE,MPI_SUM,world); dof = domain->dimension * tarray_all[0] - extra_dof; + if (dof < 0.0 && tarray_all[0] > 0.0) + error->all(FLERR,"Temperature compute degrees of freedom < 0"); int one = 0; for (int i = 0; i < nlocal; i++) @@ -155,7 +157,7 @@ double ComputeTempRegionEff::compute_scalar() if (abs(spin[i])==1) one++; } - if (dof > 0) scalar = force->mvv2e * tarray_all[1] / (dof * force->boltz); + if (dof > 0.0) scalar = force->mvv2e * tarray_all[1] / (dof * force->boltz); else scalar = 0.0; return scalar; }