Example KAPPA: questions about fix langevin

Dear users,

I am learning the examples in KAPPA to calculate thermal conductivity by direct thermostatting method. I am facing several problems by learning these examples.
First, I am confused by the fix langevin command in the input file "in.langevin" as shown in the following. There are several commands in the last part:
"region hot block INF INF INF INF 0 1
region cold block INF INF INF INF 10 11
compute Thot all temp/region hot
compute Tcold all temp/region cold
...........
fix 1 all nve
fix hot all langevin \{thi\} {thi} 1.0 59804 tally yes
fix cold all langevin \{tlo\} {tlo} 1.0 287859 tally yes
fix_modify hot temp Thot
fix_modify cold temp Tcold
"
The explanation of fix langevin is " fix ID group-ID langevin Tstart Tstop damp seed keyword values". The question is why "all" group-ID are fixed in "fix hot all langevin \{thi\} {thi} 1.0 59804 tally yes"
and "fix cold all langevin \{tlo\} {tlo} 1.0 287859 tally yes"? Is this correct? Should I define groups for atoms in the hot and cold region, respectively, and then specify corresponding group-id in
fix langevin ?

Second, I am trying to simulate thermal conductivity of my system and came up with the following lines for performing the thermostatting:
"
fix 1 all nve
fix 7 all langevin 315.0 315.0 1.0 292252 tally yes
fix_modify 7 temp Thot
fix 8 all langevin 285.0 285.0 1.0 287859 tally yes
fix_modify 8 temp Tcold

variable tdiff equal c_Thot-c_Tcold
thermo_style custom step temp c_Thot c_Tcold f_hot f_cold v_tdiff
thermo 1000
"
However, the f_hot and f_cold variables stops printing data with "Step 7 8 " in the log file . But the code continues running. If I delete f_cold and f_hot from thermo_style command, it prints the other data to log file very well.
I would be highly grateful if you can take your time and tell what I am doing wrong.

Best,
John

in. langevin :
# sample LAMMPS input script for thermal conductivity of liquid LJ
# thermostatting 2 regions via fix langevin

# settings

variable x equal 10
variable y equal 10
variable z equal 20

variable rho equal 0.6
variable t equal 1.35
variable rc equal 2.5
variable tlo equal 1.0
variable thi equal 1.70

#variable rho equal 0.85
#variable t equal 0.7
#variable rc equal 3.0
#variable tlo equal 0.3
#variable thi equal 1.0

# setup problem

units lj
atom_style atomic

lattice fcc ${rho}
region box block 0 $x 0 $y 0 $z
create_box 1 box
create_atoms 1 box
mass 1 1.0

velocity all create $t 87287

pair_style lj/cut ${rc}
pair_coeff 1 1 1.0 1.0

neighbor 0.3 bin
neigh_modify delay 0 every 1

# heat layers

region hot block INF INF INF INF 0 1
region cold block INF INF INF INF 10 11
compute Thot all temp/region hot
compute Tcold all temp/region cold

# 1st equilibration run

fix 1 all nvt temp $t $t 0.5
thermo 100
run 1000

velocity all scale $t

unfix 1

# 2nd equilibration run

fix 1 all nve
fix hot all langevin \{thi\} {thi} 1.0 59804 tally yes
fix cold all langevin \{tlo\} {tlo} 1.0 287859 tally yes
fix_modify hot temp Thot
fix_modify cold temp Tcold

variable tdiff equal c_Thot-c_Tcold
thermo_style custom step temp c_Thot c_Tcold f_hot f_cold v_tdiff
thermo 1000
run 10000

# thermal conductivity calculation
# reset langevin thermostats to zero energy accumulation

compute ke all ke/atom
variable temp atom c_ke/1.5

fix hot all langevin \{thi\} {thi} 1.0 59804 tally yes
fix cold all langevin \{tlo\} {tlo} 1.0 287859 tally yes
fix_modify hot temp Thot
fix_modify cold temp Tcold

fix ave all ave/time 10 100 1000 v_tdiff ave running
thermo_style custom step temp c_Thot c_Tcold f_hot f_cold v_tdiff f_ave

fix 2 all ave/spatial 10 100 1000 z lower 0.05 v_temp &
           file profile.langevin units reduced

run 20000

1 Like

Hi John,

Comments below.

Dear users,

I am learning the examples in KAPPA to calculate thermal conductivity by
direct thermostatting method. I am facing several problems by learning
these examples.
First, I am confused by the fix langevin command in the input file
"in.langevin" as shown in the following. There are several commands in
the last part:
"region hot block INF INF INF INF 0 1
region cold block INF INF INF INF 10 11
compute Thot all temp/region hot
compute Tcold all temp/region cold
...........
fix 1 all nve
fix hot all langevin \{thi\} {thi} 1.0 59804 tally yes
fix cold all langevin \{tlo\} {tlo} 1.0 287859 tally yes
fix_modify hot temp Thot
fix_modify cold temp Tcold
"
The explanation of fix langevin is " fix ID group-ID langevin Tstart
Tstop damp seed keyword values". The question is why "all" group-ID
are fixed in "fix hot all langevin \{thi\} {thi} 1.0 59804
tally yes"
and "fix cold all langevin \{tlo\} {tlo} 1.0 287859 tally
yes"? Is this correct? Should I define groups for atoms in the hot and
cold region, respectively, and then specify corresponding group-id in
fix langevin ?

When thermostatting geometric regions like this, no, you don't need a special group. The fix_modify commands ensure that the two langevin fixes only apply to the two regions, "hot" and "cold".

If, for the sake of argument, you had two types of atoms, and only wanted to thermostat one of them within the region, you could use a group to do that.

Second, I am trying to simulate thermal conductivity of my system and
came up with the following lines for performing the thermostatting:
"
fix 1 all nve
fix 7 all langevin 315.0 315.0 1.0 292252 tally yes
fix_modify 7 temp Thot
fix 8 all langevin 285.0 285.0 1.0 287859 tally yes
fix_modify 8 temp Tcold

variable tdiff equal c_Thot-c_Tcold
thermo_style custom step temp c_Thot c_Tcold f_hot f_cold v_tdiff
thermo 1000
"
However, the f_hot and f_cold variables stops printing data with
"Step 7 8 " in the log file . But the code continues running. If I
delete f_cold and f_hot from thermo_style command, it prints the other
data to log file very well.
I would be highly grateful if you can take your time and tell what I am
doing wrong.

Your attached file in.langevin works fine for me. In the example in the e-mail, the fixes f_hot and f_cold don't exist (you've called the two fixes 7 and 8, not hot and cold).