[lammps-users] error on example of compute heat/flux

Hi, I am trying a example give by the manual of command ‘computer heat flux’. While alway got an error ’ compute ID for fix ave/correlate does not exist’. I just updated Lammps and the version should not be the problem. Below is the script:

Sample LAMMPS input script

atom_style  atomic
units       real
variable    kB equal 1.3806504e-23 # **J/K** Boltzmann
variable    kCal2J equal 4186.0/6.02214e23
variable    T equal 70
variable    V equal vol
variable    dt equal 4.0
variable    p equal 200 # correlation length
variable    s equal 10  # sample interval
variable    d equal $p*$s # dump interval 

---------------------------------------------------------

dimension    3
boundary     p p p
lattice      fcc  5.376  orient x 1 0 0 orient y 0 1 0 orient z 0 0 1
region       box block 0 4 0 4 0 4
create_box   1 box
create_atoms 1 box
mass	     1 39.948
pair_style   lj/cut 13.0
pair_coeff   * * 0.2381 3.405
timestep     $*dt*
thermo	     $d 

------------- equilibration and thermalization ----------------

velocity  all create $T 102486 mom yes rot yes dist gaussian
fix       NVT all nvt temp $T $T 10 drag 0.2
run       8000 

-------------- flux calculation ---------------

reset_timestep  0
compute   myKE all ke/atom
compute   myPE all pe/atom
compute   myStress all stress/atom virial
compute   flux all heat/flux myKE myPE myStress
variable  Jx equal c_flux**1**/vol
variable  Jy equal c_flux**2**/vol
variable  Jz equal c_flux**3**/vol
fix       JJ all ave/correlate $s $p $d &
          c_flux**1** c_flux**2** c_flux**3** type auto file J0Jt.dat ave running
variable  scale equal $*kCal2J**$*kCal2J*/$*kB*/$T/$T/$V*$s*$*dt**1.0e25
variable  k11 equal trap(f_JJ**3**)*$*scale*
variable  k22 equal trap(f_JJ**4**)*$*scale*
variable  k33 equal trap(f_JJ**5**)*$*scale*
thermo_style custom step temp v_Jx v_Jy v_Jz v_k11 v_k22 v_k33
run       100000
variable  k equal (v_k11+v_k22+v_k33)/3.0
print     "average conductivity: $k **W/mK**" 

It should be c_flux[1], not c_flux1.
It's just a formatting error
in the way the HTML for the doc page appears.
I just corrected it on the WWW site. Try looking
at the new page, there are several places that brackets
now appear in the commands.

Steve

Hi Steve, thanks for the modifications. While I got another error by using the new script:

“ERROR on proc 0: Substitution for illegal variable
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0”

ok - try cut/paste from the compute heat/flux doc page (on the
WWW site) one more time. This was again a formatting error
in the HTML with the curly braces around variables not passing
thru to the HTML.

Steve

2010/8/27 Tom Yu <[email protected]>:

Thanks, it works now. While as I modified the second piece of the script to the following, i.e. I use my amorphous silica structure by ‘read data’, and use Tersoff potential, I was always given ‘Invalid pair style’. This position file and potential were already tested in other script, so these should not be the problem. I know the Tersoff potential file I used is only suitable for ‘metal’ unit, when I changed the unit in the sample script from ‘real’ to ‘metal’, I still got the same message. I am confused, even the potential parameters are wrong due to the mis-assigning of unit style, it should be nothing to do with the pair style.

---------------------------------------------------------

read_data sio
neighbor 0.3 bin
neigh_modify check yes
pair_style tersoff
pair_coeff * * sico.tersoff Si O
timestep ${dt}
thermo $d

Your system has 1 atom type (create box). The pair_coeff
command is trying to set up 2 atoms types - hence the error.

Steve

2010/9/2 Tom Yu <[email protected]>:

I replaced the second part of sample script with my script shown in the last message, so I did not use ‘create box’ command but defined the box and the atoms positions in the configuration file. As shown below,

units real
variable kB equal 1.3806504e-23 # [J/K] Boltzmann
variable kCal2J equal 4186.0/6.02214e23
variable T equal 70
variable V equal vol
variable dt equal 4.0
variable p equal 200 # correlation length
variable s equal 10 # sample interval
variable d equal $p*$s # dump interval

---------------------------------------------------------

read_data sio
neighbor 0.3 bin
neigh_modify check yes
#pair_style tersoff
#pair_coeff * * sio.tersoff Si O
pair_style lj/cut 13.0
pair_coeff * * 0.2381 3.405
timestep ${dt}
thermo $d

------------- equilibration and thermalization ----------------

…the following is the same with the sample

I don't know what your question is anymore.

Steve

2010/9/3 Tom Yu <[email protected]>: