# How to get temperature gradient for example of rNEMD thermal conductivity in lammps documentation?

Hello everyone,

I am trying to figure out how to get thermal conductivity, using Muller-Plathe method. As a toy-run, I am using the example provided in lammps-testing/tests/examples/KAPPA/in.mp directory.

I have tried to run this simulation to figure out each parameter. However, I cannot seem to find out how dTemp is reported as 1.16. As it is mentioned in the ReadMe section, dTemp is supposed to be obtained from f_ave, which is below one in my log file.

I would really appreciate any help on this regard.

This is the log file that I got from running this code.

LAMMPS (29 Sep 2021 - Update 2)

# 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 rho equal 0.85
#variable t equal 0.7
#variable rc equal 3.0

# setup problem

units lj
atom_style atomic

lattice fcc \${rho}
lattice fcc 0.6
Lattice spacing in x,y,z = 1.8820721 1.8820721 1.8820721
region box block 0 \$x 0 \$y 0 \$z
region box block 0 10 0 \$y 0 \$z
region box block 0 10 0 10 0 \$z
region box block 0 10 0 10 0 20
create_box 1 box
Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (18.820721 18.820721 37.641441)
1 by 1 by 4 MPI processor grid
create_atoms 1 box
Created 8000 atoms
using lattice units in orthogonal box = (0.0000000 0.0000000 0.0000000) to (18.820721 18.820721 37.641441)
create_atoms CPU = 0.090 seconds
mass 1 1.0

velocity all create \$t 87287
velocity all create 1.35 87287

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

neighbor 0.3 bin
neigh_modify delay 0 every 1

# 1st equilibration run

fix 1 all nvt temp \$t \$t 0.5
fix 1 all nvt temp 1.35 \$t 0.5
fix 1 all nvt temp 1.35 1.35 0.5
thermo 100
run 1000
Neighbor list info …
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 2.8
ghost atom cutoff = 2.8
binsize = 1.4, bins = 14 14 27
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair lj/cut, perpetual
attributes: half, newton on
pair build: half/bin/atomonly/newton
stencil: half/bin/3d
bin: standard
Per MPI rank memory allocation (min/avg/max) = 3.223 | 3.223 | 3.223 Mbytes
Step Temp E_pair E_mol TotEng Press
0 1.35 -4.1241917 0 -2.0994448 -3.1961612
100 1.1872068 -3.770585 0 -1.9899974 0.50876678
200 1.2623273 -3.7436709 0 -1.8504166 0.64576172
300 1.3232893 -3.7100115 0 -1.7253256 0.77952968
400 1.376056 -3.7037794 0 -1.6399534 0.84369178
500 1.3804885 -3.6952486 0 -1.6247747 0.86182223
600 1.3466801 -3.7003367 0 -1.680569 0.85207011
700 1.3135776 -3.6912719 0 -1.7211517 0.87163831
800 1.3301143 -3.696371 0 -1.701449 0.85570562
900 1.3746191 -3.7187036 0 -1.6570327 0.85271264
1000 1.3660212 -3.7049279 0 -1.6561522 0.89219276
Loop time of 22.1729 on 4 procs for 1000 steps with 8000 atoms

Performance: 19483.204 tau/day, 45.100 timesteps/s

## MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total

Pair | 0.93773 | 0.97568 | 1.0121 | 2.7 | 4.40
Neigh | 0.56437 | 0.59945 | 0.63406 | 3.7 | 2.70
Comm | 12.756 | 13.117 | 13.324 | 6.2 | 59.16
Output | 0.13636 | 0.15222 | 0.16562 | 2.7 | 0.69
Modify | 3.5762 | 3.8771 | 4.2345 | 12.2 | 17.49
Other | | 3.452 | | | 15.57

Nlocal: 2000.00 ave 2011 max 1988 min
Histogram: 1 0 0 0 1 0 1 0 0 1
Nghost: 3373.75 ave 3400 max 3348 min
Histogram: 1 0 0 0 1 1 0 0 0 1
Neighs: 54271.8 ave 55143 max 53239 min
Histogram: 1 0 1 0 0 0 0 0 1 1

Total # of neighbors = 217087
Ave neighs/atom = 27.135875
Neighbor list builds = 160
Dangerous builds = 0

#velocity all scale \$t

unfix 1

# 2nd equilibration run

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

fix 1 all nve

compute layers all chunk/atom bin/1d z lower 0.05 units reduced
fix 2 all ave/chunk 10 100 1000 layers v_temp file profile.mp

fix 3 all thermal/conductivity 10 z 20

variable tdiff equal f_2[11][3]-f_2[1][3]
thermo_style custom step temp epair etotal f_3 v_tdiff

thermo 1000
run 2000
Per MPI rank memory allocation (min/avg/max) = 3.481 | 3.482 | 3.483 Mbytes
Step Temp E_pair TotEng f_3 v_tdiff
1000 1.3660212 -3.7049279 -1.6561522 0 0
2000 1.3674392 -3.7077798 -1.6568775 878.64192 0.25276052
3000 1.3829504 -3.7311666 -1.6570004 1754.5814 0.46707295
Loop time of 22.7563 on 4 procs for 2000 steps with 8000 atoms

Performance: 37967.448 tau/day, 87.888 timesteps/s

## MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total

Pair | 1.6458 | 1.7773 | 1.8701 | 6.6 | 7.81
Neigh | 0.94566 | 1.1232 | 1.2798 | 13.4 | 4.94
Comm | 14.76 | 15.153 | 15.397 | 6.1 | 66.59
Output | 0.0050777 | 0.0051339 | 0.0053016 | 0.1 | 0.02
Modify | 0.89575 | 0.95827 | 0.9922 | 3.8 | 4.21
Other | | 3.739 | | | 16.43

Nlocal: 2000.00 ave 2170 max 1873 min
Histogram: 2 0 0 0 0 0 1 0 0 1
Nghost: 3335.50 ave 3559 max 3120 min
Histogram: 1 1 0 0 0 0 0 0 1 1
Neighs: 54492.5 ave 62011 max 47612 min
Histogram: 1 1 0 0 0 0 0 0 1 1

Total # of neighbors = 217970
Ave neighs/atom = 27.246250
Neighbor list builds = 337
Dangerous builds = 0

# reset fix thermal/conductivity to zero energy accumulation

fix 3 all thermal/conductivity 10 z 20

fix ave all ave/time 1 1 1000 v_tdiff ave running
thermo_style custom step temp epair etotal f_3 v_tdiff f_ave

dump 1 all xyz 1000 Github.xyz

run 2000
Per MPI rank memory allocation (min/avg/max) = 4.947 | 4.951 | 4.955 Mbytes
Step Temp E_pair TotEng f_3 v_tdiff f_ave
3000 1.3829504 -3.7311666 -1.6570004 0 0.46707295 0.46707295
4000 1.3889527 -3.7426904 -1.6595217 849.00676 0.5975433 0.53230812
5000 1.3874841 -3.7408309 -1.6598649 1645.2787 0.70733722 0.59065115
Loop time of 3.94426 on 4 procs for 2000 steps with 8000 atoms

Performance: 219052.359 tau/day, 507.066 timesteps/s

## MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total

Pair | 1.4808 | 1.8208 | 2.2038 | 22.6 | 46.16
Neigh | 0.80471 | 0.9539 | 1.1411 | 14.4 | 24.18
Comm | 0.41698 | 0.97406 | 1.4512 | 44.2 | 24.70
Output | 0.0060908 | 0.0060977 | 0.0061164 | 0.0 | 0.15
Modify | 0.07586 | 0.079669 | 0.084716 | 1.3 | 2.02
Other | | 0.1098 | | | 2.78

Nlocal: 2000.00 ave 2220 max 1763 min
Histogram: 1 0 1 0 0 0 0 0 1 1
Nghost: 3367.00 ave 3659 max 3097 min
Histogram: 2 0 0 0 0 0 0 0 0 2
Neighs: 54849.5 ave 64718 max 43255 min
Histogram: 1 1 0 0 0 0 0 0 0 2

Total # of neighbors = 219398
Ave neighs/atom = 27.424750
Neighbor list builds = 341
Dangerous builds = 0

undump 1
Total wall time: 0:00:49

Thanks,

Please edit your post properly so it can be read without the forum software markup making a mess of it.
This is explained in the forum guidelines post.