fix temp/rescale thermostat

Dear LAMMPS Users,

I am simulating liquid flow through a nanaochanel which is confined by two walls in y and z direction respectively. The flow is along with x direction and I divided the fluid atoms into two groups including fluid group 1 and fluid group 2, in x direction. And four walls are treated as six groups with different constant temperature(T1=300K<T2<T3<T4<T5<T6).

Simulation has two stages. Firstly, no body force is added to each fluid atom in fluid group 1 or 2.Temperatures of six wall groups and fluid group 1 are controlled by using ‘fix temp/rescale’command respectively. And I only consider velocity in y and z direction when performing thermostat for fluid group 1. These thermostat control command are

compute temp_2_flow_1 group_flow_1 temp/partial 0 1 1

fix 2f_flow_1_nve group_flow_1 nve

fix 2f_flow_1 group_flow_1 temp/rescale 1 {T_fluid} {T_fluid} 0.1 1

fix_modify 2f_flow_1 temp temp_2_flow_1

In second stage, after running the input file for 80,0000 timesteps (timestep=1 fs). A body force 200X10-12N along with x direction is added to all fluid atoms in fluid group 1 and 2. In this stage, velocity in y and z direction for each fluid atom is only considered when calculating temperature. At the same time, thermostat is still conducted for fluid group 1 (300K) by using ‘fix temp/rescale’.

However, in stage 2, temperature for fluid group 1 is much higher than 300K around 5000K. I will appreciate if you can give me some suggestion. Thank you.

My input file is shown as follows.

units nano

variable T_fluid equal 300

variable T_wall_1 equal 300

variable T_wall_2 equal 330

variable T_wall_3 equal 360

variable T_wall_4 equal 390

variable T_wall_5 equal 420

variable T_wall_6 equal 450

variable spring_constant equal 500.0e3

#--------------------dimension and boundary--------------------------------------

dimension 3

boundary p p p

#--------------------definition of geometry--------------------------------------

lattice fcc 0.4

region box block 0 30 -25 25 -25 25

create_box 7 box

region hybrid block 0 30 -15 15 -15 15

region zone_flow cylinder x 0.0 0.0 3.0 0.0 12.0 units box

region zone_flow_1 cylinder x 0.0 0.0 3.0 0.0 2.0 units box

region zone_flow_2 cylinder x 0.0 0.0 3.0 2.0 12.0 units box

region zone_temp intersect 2 zone_flow box side out

region wall intersect 2 zone_temp hybrid side in

#---------------------definition of 6 walls--------------------------------------

region wall_temp_11 block 0 5 -15 15 -15 15

region wall_temp_22 block 6 10 -15 15 -15 15

region wall_temp_33 block 11 15 -15 15 -15 15

region wall_temp_44 block 16 20 -15 15 -15 15

region wall_temp_55 block 21 25 -15 15 -15 15

region wall_temp_66 block 26 30 -15 15 -15 15

region wall_1 intersect 2 wall wall_temp_11 side in

region wall_2 intersect 2 wall wall_temp_22 side in

region wall_3 intersect 2 wall wall_temp_33 side in

region wall_4 intersect 2 wall wall_temp_44 side in

region wall_5 intersect 2 wall wall_temp_55 side in

region wall_6 intersect 2 wall wall_temp_66 side in

#----------------------create atoms for each zone--------------------------------

create_atoms 1 region wall_1

create_atoms 2 region wall_2

create_atoms 3 region wall_3

create_atoms 4 region wall_4

create_atoms 5 region wall_5

create_atoms 6 region wall_6

create_atoms 7 random 7000 999999 zone_flow_1

create_atoms 7 random 10000 999999 zone_flow_2

mass 1 323.98306/1.0e6

mass 2 323.98306/1.0e6

mass 3 323.98306/1.0e6

mass 4 323.98306/1.0e6

mass 5 323.98306/1.0e6

mass 6 323.98306/1.0e6

mass 7 66.390788/1.0e6

#----------------------------groups----------------------------------------------

group group_wall_1 region wall_1

group group_wall_2 region wall_2

group group_wall_3 region wall_3

group group_wall_4 region wall_4

group group_wall_5 region wall_5

group group_wall_6 region wall_6

group group_flow region zone_flow

group group_flow_1 region zone_flow_1

group group_flow_2 region zone_flow_2

#------------------------------delete overlop atoms-----------------------------

#delete_atoms overlap 0.001 group_wall_1 group_wall_2

#delete_atoms overlap 0.001 group_wall_2 group_wall_3

#delete_atoms overlap 0.001 group_wall_3 group_wall_4

#delete_atoms overlap 0.001 group_wall_4 group_wall_5

#delete_atoms overlap o.001 group_wall_5 group_wall_6

#---------------------------potential energy model------------------------------

pair_style lj/cut 0.85125

pair_coeff * * 83.5 0.2475 0.85125

pair_coeff 7 7 1.657 0.3405 0.85125

pair_coeff *6 7 11.763 0.2940 0.85125

#--------------------------initialization velocity for each group-----------------

velocity group_wall_1 create ${T_wall_1} 999999 dist gaussian

velocity group_wall_2 create ${T_wall_2} 999999 dist gaussian

velocity group_wall_3 create ${T_wall_3} 999999 dist gaussian

velocity group_wall_4 create ${T_wall_4} 999999 dist gaussian

velocity group_wall_5 create ${T_wall_5} 999999 dist gaussian

velocity group_wall_6 create ${T_wall_6} 999999 dist gaussian

velocity group_flow_1 create ${T_fluid} 999999 dist gaussian

velocity group_flow_2 create ${T_fluid} 999999 dist gaussian

#-------------------------spring model for wall atoms-----------------------------

fix swall_1 group_wall_1 spring/self ${spring_constant}

fix swall_2 group_wall_2 spring/self ${spring_constant}

fix swall_3 group_wall_3 spring/self ${spring_constant}

fix swall_4 group_wall_4 spring/self ${spring_constant}

fix swall_5 group_wall_5 spring/self ${spring_constant}

fix swall_6 group_wall_6 spring/self ${spring_constant}

#-------------------------energy minimization-------------------------------------

minimize 1.0e-4 1.0e-6 10000 20000

min_style cg

#----------------------------temperature control----------------------------------

compute temp_wall_1 group_wall_1 temp

compute temp_wall_2 group_wall_2 temp

compute temp_wall_3 group_wall_3 temp

compute temp_wall_4 group_wall_4 temp

compute temp_wall_5 group_wall_5 temp

compute temp_wall_6 group_wall_6 temp

compute temp_flow_1 group_flow_1 temp/partial 0 1 1

fix f_wall_1 group_wall_1 nve

fix f_wall_11 group_wall_1 temp/rescale 1 {T_wall_1} {T_wall_1} 0.1 1

fix f_wall_2 group_wall_2 nve

fix f_wall_22 group_wall_2 temp/rescale 1 {T_wall_2} {T_wall_2} 0.1 1

fix f_wall_3 group_wall_3 nve

fix f_wall_33 group_wall_3 temp/rescale 1 {T_wall_3} {T_wall_3} 0.1 1

fix f_wall_4 group_wall_4 nve

fix f_wall_44 group_wall_4 temp/rescale 1 {T_wall_4} {T_wall_4} 0.1 1

fix f_wall_5 group_wall_5 nve

fix f_wall_55 group_wall_5 temp/rescale 1 {T_wall_5} {T_wall_5} 0.1 1

fix f_wall_6 group_wall_6 nve

fix f_wall_66 group_wall_6 temp/rescale 1 {T_wall_6} {T_wall_6} 0.1 1

#temperature control for liquid

fix f_flow_1_nve group_flow_1 nve

fix f_flow_1 group_flow_1 temp/rescale 1 {T_fluid} {T_fluid} 0.1 1

fix_modify f_flow_1 temp temp_flow_1

fix f_flow_2_nve group_flow_2 nve

#-----------------------------------kenitic and potential energy for all group-----

compute e_1 all ke

compute e_2 all pe

fix e all ave/time 10 4001 50000 c_e_1 c_e_2 file e_ke_po.out

#-----------------------------------equilibrium stage------------------------------

thermo_modify temp temp_flow_1

thermo 10000

timestep 1.0e-6

run 800000

#-----------------------------------flow definition--------------------------------

#fix force_flow_1 group_flow_1 addforce 200.0 0.0 0.0

#fix force_flow_2 group_flow_2 addforce 200.0 0.0 0.0

fix force_flow group_flow addforce 200.0 0.0 0.0

unfix f_flow_1_nve

unfix f_flow_1

unfix f_flow_2_nve

compute temp_2_flow_1 group_flow_1 temp/partial 0 1 1

fix 2f_flow_1_nve group_flow_1 nve

fix 2f_flow_1 group_flow_1 temp/rescale 1 {T_fluid} {T_fluid} 0.1 1

fix_modify 2f_flow_1 temp temp_2_flow_1

fix 2f_flow_2_nve group_flow_2 nve

#-----------------------------------production stage-------------------------------

#velocity of mass center for group 'group_flow-1’and ‘group_flow_2’

compute p_id_flow_1 group_flow_1 chunk/atom bin/cylinder x 0.0 2.0 0.0 0.0 0.0 3.0 1 bound x 0.0 2.0 units box

compute p_v_flow_1 group_flow_1 vcm/chunk p_id_flow_1

fix p_vv_flow_1 group_flow_1 ave/time 2 149999 300000 c_p_v_flow_1[*] file v_m_flow1.out mode vector

compute p_id_flow_2 group_flow_2 chunk/atom bin/cylinder x 2.0 10.0 0.0 0.0 0.0 3.0 1 bound x 2.0 12.0 units box

compute p_v_flow_2 group_flow_2 vcm/chunk p_id_flow_2

fix p_vv_flow_2 group_flow_2 ave/time 2 149999 300000 c_p_v_flow_2[*] file v_m_flow2.out mode vector

#temperature calculation

#method1:axial chunk

compute p_id_flow group_flow chunk/atom bin/cylinder x 0.0 0.25 0.0 0.0 0.0 3.0 1 units box

compute p_t_flow group_flow temp/partial 0 1 1

fix p_tt_flow group_flow ave/chunk 2 499999 1000000 p_id_flow vx vy vz density/number temp bias p_t_flow file T_method1.out format %20.16g

#method2:axial and radial chunk

compute p_id_1_flow group_flow chunk/atom bin/cylinder x 0.0 0.25 0.0 0.0 0.0 3.0 15 units box

compute p_t_1_flow group_flow temp/partial 0 1 1

fix p_tt_1_flow group_flow ave/chunk 2 499999 1000000 p_id_1_flow vx vy vz density/number temp bias p_t_1_flow file T_method2.out format %20.16g

#--------------------------------------kenitic energy for group_flow_2-------------

compute p_e_1 all ke

fix p_e all ave/time 2 149999 300000 c_p_e_1 file p_ke.out

#--------------------------------------run-----------------------------------------

dump 1 all atom 5000 dump.flow

thermo 10000

thermo_modify temp p_t_flow

timestep 1.0e-8

restart 200000 poly.re.out

restart 50000 p2.re.out p3.re.out

run 12000000

Best wishes,

Sun

Are you removing the bias the velocities introduce? Also, don’t use temp/rescale.