git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@13354 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2015-04-01 14:41:46 +00:00
parent d497d65930
commit dc53071b60
5 changed files with 20 additions and 18 deletions

View File

@ -147,7 +147,7 @@ void ComputeTempAsphere::dof_compute()
// assume full rotation of extended particles // assume full rotation of extended particles
// user should correct this via compute_modify if needed // user should correct this via compute_modify if needed
double natoms = group->count(igroup); natoms_temp = group->count(igroup);
int nper; int nper;
if (domain->dimension == 3) { if (domain->dimension == 3) {
if (mode == ALL) nper = 6; if (mode == ALL) nper = 6;
@ -156,12 +156,12 @@ void ComputeTempAsphere::dof_compute()
if (mode == ALL) nper = 3; if (mode == ALL) nper = 3;
else nper = 1; else nper = 1;
} }
dof = nper*natoms; dof = nper*natoms_temp;
// additional adjustments to dof // additional adjustments to dof
if (tempbias == 1) { 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) { } else if (tempbias == 2) {
int *mask = atom->mask; int *mask = atom->mask;
@ -179,8 +179,6 @@ void ComputeTempAsphere::dof_compute()
} }
dof -= extra_dof + fix_dof; 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); if (dof > 0) tfactor = force->mvv2e / (dof * force->boltz);
else tfactor = 0.0; else tfactor = 0.0;
} }
@ -269,6 +267,8 @@ double ComputeTempAsphere::compute_scalar()
MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world);
if (dynamic || tempbias == 2) dof_compute(); 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; scalar *= tfactor;
return scalar; return scalar;
} }

View File

@ -210,12 +210,10 @@ void ComputeTempCS::dof_compute()
{ {
adjust_dof_fix(); adjust_dof_fix();
int nper = domain->dimension; int nper = domain->dimension;
double natoms = group->count(igroup); natoms_temp = group->count(igroup);
dof = nper * natoms; dof = nper * natoms_temp;
dof -= nper * nshells; dof -= nper * nshells;
dof -= extra_dof + fix_dof; 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); if (dof > 0) tfactor = force->mvv2e / (dof * force->boltz);
else tfactor = 0.0; else tfactor = 0.0;
} }
@ -258,6 +256,8 @@ double ComputeTempCS::compute_scalar()
MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world);
if (dynamic) dof_compute(); if (dynamic) dof_compute();
if (dof < 0.0 && natoms_temp > 0.0)
error->all(FLERR,"Temperature compute degrees of freedom < 0");
scalar *= tfactor; scalar *= tfactor;
return scalar; return scalar;
} }

View File

@ -101,8 +101,8 @@ void ComputeTempDeformEff::setup()
void ComputeTempDeformEff::dof_compute() void ComputeTempDeformEff::dof_compute()
{ {
adjust_dof_fix(); adjust_dof_fix();
double natoms = group->count(igroup); natoms_temp = group->count(igroup);
dof = domain->dimension * natoms; dof = domain->dimension * natoms_temp;
dof -= extra_dof + fix_dof; dof -= extra_dof + fix_dof;
// just include nuclear dof // just include nuclear dof
@ -123,8 +123,6 @@ void ComputeTempDeformEff::dof_compute()
dof -= domain->dimension * nelectrons; 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); if (dof > 0) tfactor = force->mvv2e / (dof * force->boltz);
else tfactor = 0.0; else tfactor = 0.0;
} }
@ -176,6 +174,8 @@ double ComputeTempDeformEff::compute_scalar()
MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world);
if (dynamic) dof_compute(); if (dynamic) dof_compute();
if (dof < 0.0 && natoms_temp > 0.0)
error->all(FLERR,"Temperature compute degrees of freedom < 0");
scalar *= tfactor; scalar *= tfactor;
return scalar; return scalar;
} }

View File

@ -67,8 +67,8 @@ void ComputeTempEff::setup()
void ComputeTempEff::dof_compute() void ComputeTempEff::dof_compute()
{ {
adjust_dof_fix(); adjust_dof_fix();
double natoms = group->count(igroup); natoms_temp = group->count(igroup);
dof = domain->dimension * natoms; dof = domain->dimension * natoms_temp;
dof -= extra_dof + fix_dof; dof -= extra_dof + fix_dof;
int *spin = atom->spin; int *spin = atom->spin;
@ -87,8 +87,6 @@ void ComputeTempEff::dof_compute()
dof -= domain->dimension * nelectrons; 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); if (dof > 0.0) tfactor = force->mvv2e / (dof * force->boltz);
else tfactor = 0.0; else tfactor = 0.0;
} }
@ -122,6 +120,8 @@ double ComputeTempEff::compute_scalar()
MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world);
if (dynamic) dof_compute(); if (dynamic) dof_compute();
if (dof < 0.0 && natoms_temp > 0.0)
error->all(FLERR,"Temperature compute degrees of freedom < 0");
scalar *= tfactor; scalar *= tfactor;
return scalar; return scalar;
} }

View File

@ -148,6 +148,8 @@ double ComputeTempRegionEff::compute_scalar()
tarray[1] = t; tarray[1] = t;
MPI_Allreduce(tarray,tarray_all,2,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(tarray,tarray_all,2,MPI_DOUBLE,MPI_SUM,world);
dof = domain->dimension * tarray_all[0] - extra_dof; 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; int one = 0;
for (int i = 0; i < nlocal; i++) for (int i = 0; i < nlocal; i++)
@ -155,7 +157,7 @@ double ComputeTempRegionEff::compute_scalar()
if (abs(spin[i])==1) one++; 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; else scalar = 0.0;
return scalar; return scalar;
} }