diff --git a/src/fix_thermal_conductivity.cpp b/src/fix_thermal_conductivity.cpp index 26d423f7cd..8b46ff807e 100644 --- a/src/fix_thermal_conductivity.cpp +++ b/src/fix_thermal_conductivity.cpp @@ -105,7 +105,7 @@ void FixThermalConductivity::init() // set bounds of 2 slabs in edim // only necessary for static box, else re-computed in end_of_step() // lo bin is always bottom bin - // if nbin even, hi bin is just below half height + // if nbin even, hi bin is just above half height // if nbin odd, hi bin straddles half height if (domain->box_change == 0) { @@ -115,8 +115,8 @@ void FixThermalConductivity::init() double binsize = (boxhi-boxlo) / nbin; slablo_lo = boxlo; slablo_hi = boxlo + binsize; - slabhi_lo = boxlo + ((nbin-1)/2)*binsize; - slabhi_hi = boxlo + ((nbin-1)/2 + 1)*binsize; + slabhi_lo = boxlo + (nbin/2)*binsize; + slabhi_hi = boxlo + (nbin/2+1)*binsize; } periodicity = domain->periodicity[edim]; @@ -143,8 +143,8 @@ void FixThermalConductivity::end_of_step() double binsize = (boxhi-boxlo) / nbin; slablo_lo = boxlo; slablo_hi = boxlo + binsize; - slabhi_lo = boxlo + ((nbin-1)/2)*binsize; - slabhi_hi = boxlo + ((nbin-1)/2 + 1)*binsize; + slabhi_lo = boxlo + (nbin/2)*binsize; + slabhi_hi = boxlo + (nbin/2+1)*binsize; } // make 2 lists of up to nswap atoms diff --git a/src/fix_viscosity.cpp b/src/fix_viscosity.cpp index 3b62746307..cd29ac85ff 100644 --- a/src/fix_viscosity.cpp +++ b/src/fix_viscosity.cpp @@ -116,7 +116,7 @@ void FixViscosity::init() // set bounds of 2 slabs in pdim // only necessary for static box, else re-computed in end_of_step() // lo bin is always bottom bin - // if nbin even, hi bin is just below half height + // if nbin even, hi bin is just above half height // if nbin odd, hi bin straddles half height if (domain->box_change == 0) { @@ -126,8 +126,8 @@ void FixViscosity::init() double binsize = (boxhi-boxlo) / nbin; slablo_lo = boxlo; slablo_hi = boxlo + binsize; - slabhi_lo = boxlo + ((nbin-1)/2)*binsize; - slabhi_hi = boxlo + ((nbin-1)/2 + 1)*binsize; + slabhi_lo = boxlo + (nbin/2)*binsize; + slabhi_hi = boxlo + (nbin/2+1)*binsize; } periodicity = domain->periodicity[pdim]; @@ -154,8 +154,8 @@ void FixViscosity::end_of_step() double binsize = (boxhi-boxlo) / nbin; slablo_lo = boxlo; slablo_hi = boxlo + binsize; - slabhi_lo = boxlo + ((nbin-1)/2)*binsize; - slabhi_hi = boxlo + ((nbin-1)/2 + 1)*binsize; + slabhi_lo = boxlo + (nbin/2)*binsize; + slabhi_hi = boxlo + (nbin/2+1)*binsize; } // make 2 lists of up to nswap atoms with velocity closest to +/- vtarget