Ray,
Here is input code.
My question is why energy added/subtracted are not equal to each other after using temp/rescale.
I thought the net energy will be zero, but it is not.
Thank you.
---------- Initialize Simulation ---------------------
clear
units metal
dimension 3
boundary p p f
atom_style atomic
atom_modify map array
neighbor 2 bin
neigh_modify every 1
echo screen
newton on
---------- Create Atoms -------------------------------
lattice diamond 5.431
region box block 0 2 0 2 0 18.1
create_box 1 box
create_atoms 1 box
---------- Define Interatomic Potential ---------------
pair_style tersoff
pair_coeff * * Si.tersoff Si
mass 1 28.06
---------- Settings --------------------------------
size: 2218
region 2 block 0 2 0 2 0 2 units lattice # left boundary
region 3 block 0 2 0 2 16 18.1 units lattice # right boundary
region 4 block 0 2 0 2 2 5 units lattice # high temp bath
region 5 block 0 2 0 2 13 16 units lattice # low temp bath
region 6 block 0 2 0 2 5 13 units lattice # middle
region 7 block 0 2 0 2 5.5 7.5 units lattice # T1
region 8 block 0 2 0 2 8.0 10.0 units lattice # T2
region 9 block 0 2 0 2 10.5 12.5 units lattice # T3
group l_fixed region 2
group r_fixed region 3
group htemp region 4
group ctemp region 5
group mid region 6
group nowall union htemp ctemp mid
group layer1 region 7
group layer2 region 8
group layer3 region 9
fix lbdr l_fixed setforce 0.0 0.0 0.0
fix rbdr r_fixed setforce 0.0 0.0 0.0
------------------ NVT Equilibration -----------------------------
thermo 100
velocity all create 330.0 4928459 dist gaussian
fix nvt1 htemp nvt temp 310 310 0.3
fix nvt2 ctemp nvt temp 290 290 0.3
fix nvt3 mid nvt temp 300 300 0.3
display thermo
thermo_style custom step temp etotal press vol
reset_timestep 0
timestep 0.001
run 100000
unfix nvt1
unfix nvt2
unfix nvt3
------------------ NVE Equilibration -----------------------------
fix nve nowall nve
run 100000
--------------- Direct Method ---------------------
fix heatbath htemp temp/rescale 1 350.0 350.0 0.5 1.0
fix middle mid temp/rescale 1 300.0 300.0 0.5 1.0
fix coldbath ctemp temp/rescale 1 250.0 250.0 0.5 1.0
compute T1 layer1 temp
compute T2 layer2 temp
compute T3 layer3 temp
thermo_modify lost warn
thermo_style custom step temp etotal c_heatbath_temp c_middle_temp c_coldbath_temp f_heatbath f_coldbath c_T1 c_T2 c_T3