diff -Naur lammps-25Jun08/doc/fix_thermal_conductivity.html lammps-26Jun08/doc/fix_thermal_conductivity.html --- lammps-25Jun08/doc/fix_thermal_conductivity.html 2008-05-14 15:40:50.000000000 -0600 +++ lammps-26Jun08/doc/fix_thermal_conductivity.html 2008-06-24 17:22:45.000000000 -0600 @@ -23,7 +23,7 @@
  • edim = x or y or z = direction of kinetic energy transfer -
  • Nbin = # of layers in edim direction +
  • Nbin = # of layers in edim direction (must be even number)
  • zero or more keyword/value pairs may be appended @@ -53,16 +53,17 @@ gradient is the system's response.

    The simulation box is divided into Nbin layers in the edim -direction. Every N steps, Nswap pairs of atoms are chosen in the -following manner. Only atoms in the fix group are considered. The -hottest Nswap atoms in the bottom layer are selected. Similarly, the -coldest Nswap atoms in the middle later are selected. The two sets of -Nswap atoms are paired up and their velocities are exchanged. This -effectively swaps their kinetic energies, assuming their masses are -the same. Over time, this induces a temperature gradient in the -system which can be measured using commands such as the following, -which writes the temperature profile (assuming z = edim) to the file -tmp.profile: +direction, where the layer 1 is at the low end of that dimension and +the layer Nbin is at the high end. Every N steps, Nswap pairs of +atoms are chosen in the following manner. Only atoms in the fix group +are considered. The hottest Nswap atoms in layer 1 are selected. +Similarly, the coldest Nswap atoms in the "middle" layer (see below) +are selected. The two sets of Nswap atoms are paired up and their +velocities are exchanged. This effectively swaps their kinetic +energies, assuming their masses are the same. Over time, this induces +a temperature gradient in the system which can be measured using +commands such as the following, which writes the temperature profile +(assuming z = edim) to the file tmp.profile:

    compute   ke all ke/atom
     variable  temp atom c_ke/1.5
    @@ -75,6 +76,13 @@
     across a wide range of values, and the kinetic energy to be exchanged
     in large chunks or more smoothly.
     

    +

    The "middle" layer for velocity swapping is defined as the Nbin/2 + +1 layer. Thus if Nbin = 20, the two swapping layers are 1 and 11. +This should lead to a symmetric temperature profile since the two +layers are separated by the same distance in both directions in a +periodic sense. This is why Nbin is restricted to being an even +number. +

    As described below, the total kinetic energy transferred by these swaps is computed by the fix and can be output. Dividing this quantity by time and the cross-sectional area of the simulation box diff -Naur lammps-25Jun08/doc/fix_thermal_conductivity.txt lammps-26Jun08/doc/fix_thermal_conductivity.txt --- lammps-25Jun08/doc/fix_thermal_conductivity.txt 2008-05-14 15:40:50.000000000 -0600 +++ lammps-26Jun08/doc/fix_thermal_conductivity.txt 2008-06-24 17:22:45.000000000 -0600 @@ -16,7 +16,7 @@ thermal/conductivity = style name of this fix command :l N = perform kinetic energy exchange every N steps :l edim = {x} or {y} or {z} = direction of kinetic energy transfer :l -Nbin = # of layers in edim direction :l +Nbin = # of layers in edim direction (must be even number) :l zero or more keyword/value pairs may be appended :l keyword = {swap} :l @@ -43,16 +43,17 @@ gradient is the system's response. The simulation box is divided into {Nbin} layers in the {edim} -direction. Every N steps, Nswap pairs of atoms are chosen in the -following manner. Only atoms in the fix group are considered. The -hottest Nswap atoms in the bottom layer are selected. Similarly, the -coldest Nswap atoms in the middle later are selected. The two sets of -Nswap atoms are paired up and their velocities are exchanged. This -effectively swaps their kinetic energies, assuming their masses are -the same. Over time, this induces a temperature gradient in the -system which can be measured using commands such as the following, -which writes the temperature profile (assuming z = edim) to the file -tmp.profile: +direction, where the layer 1 is at the low end of that dimension and +the layer {Nbin} is at the high end. Every N steps, Nswap pairs of +atoms are chosen in the following manner. Only atoms in the fix group +are considered. The hottest Nswap atoms in layer 1 are selected. +Similarly, the coldest Nswap atoms in the "middle" layer (see below) +are selected. The two sets of Nswap atoms are paired up and their +velocities are exchanged. This effectively swaps their kinetic +energies, assuming their masses are the same. Over time, this induces +a temperature gradient in the system which can be measured using +commands such as the following, which writes the temperature profile +(assuming z = edim) to the file tmp.profile: compute ke all ke/atom variable temp atom c_ke[]/1.5 @@ -65,6 +66,13 @@ across a wide range of values, and the kinetic energy to be exchanged in large chunks or more smoothly. +The "middle" layer for velocity swapping is defined as the {Nbin}/2 + +1 layer. Thus if {Nbin} = 20, the two swapping layers are 1 and 11. +This should lead to a symmetric temperature profile since the two +layers are separated by the same distance in both directions in a +periodic sense. This is why {Nbin} is restricted to being an even +number. + As described below, the total kinetic energy transferred by these swaps is computed by the fix and can be output. Dividing this quantity by time and the cross-sectional area of the simulation box diff -Naur lammps-25Jun08/doc/fix_viscosity.html lammps-26Jun08/doc/fix_viscosity.html --- lammps-25Jun08/doc/fix_viscosity.html 2008-05-15 13:42:47.000000000 -0600 +++ lammps-26Jun08/doc/fix_viscosity.html 2008-06-24 17:22:45.000000000 -0600 @@ -25,7 +25,7 @@

  • pdim = x or y or z = direction of momentum transfer -
  • Nbin = # of layers in pdim direction +
  • Nbin = # of layers in pdim direction (must be even number)
  • zero or more keyword/value pairs may be appended @@ -57,18 +57,19 @@ system's response.

    The simulation box is divided into Nbin layers in the pdim -direction. Every N steps, Nswap pairs of atoms are chosen in the -following manner. Only atoms in the fix group are considered. Nswap -atoms in the bottom layer with positive velocity components in the -vdim direction closest to the target value V are selected. -Similarly, Nswap atoms in the middle later with negative velocity -components in the vdim direction closest to the negative of the -target value V are selected. The two sets of Nswap atoms are paired -up and their vdim momenta components are swapped within each pair. -This resets their velocities, typically in opposite directions. Over -time, this induces a shear velocity profile in the system which can be -measured using commands such as the following, which writes the -profile to the file tmp.profile: +direction, where the layer 1 is at the low end of that dimension and +the layer Nbin is at the high end. Every N steps, Nswap pairs of +atoms are chosen in the following manner. Only atoms in the fix group +are considered. Nswap atoms in layer 1 with positive velocity +components in the vdim direction closest to the target value V are +selected. Similarly, Nswap atoms in the "middle" layer (see below) with +negative velocity components in the vdim direction closest to the +negative of the target value V are selected. The two sets of Nswap +atoms are paired up and their vdim momenta components are swapped +within each pair. This resets their velocities, typically in opposite +directions. Over time, this induces a shear velocity profile in the +system which can be measured using commands such as the following, +which writes the profile to the file tmp.profile:

    fix f1 all ave/spatial 100 10 1000 z lower 0.05 vx &
         file tmp.profile units reduced 
    @@ -81,6 +82,12 @@
     adjusted across a wide range of values, and the momenta to be
     exchanged in large chunks or more smoothly.
     

    +

    The "middle" layer for momenta swapping is defined as the Nbin/2 + 1 +layer. Thus if Nbin = 20, the two swapping layers are 1 and 11. +This should lead to a symmetric velocity profile since the two layers +are separated by the same distance in both directions in a periodic +sense. This is why Nbin is restricted to being an even number. +

    As described below, the total momentum transferred by these velocity swaps is computed by the fix and can be output. Dividing this quantity by time and the cross-sectional area of the simulation box diff -Naur lammps-25Jun08/doc/fix_viscosity.txt lammps-26Jun08/doc/fix_viscosity.txt --- lammps-25Jun08/doc/fix_viscosity.txt 2008-05-15 13:42:47.000000000 -0600 +++ lammps-26Jun08/doc/fix_viscosity.txt 2008-06-24 17:22:45.000000000 -0600 @@ -17,7 +17,7 @@ N = perform momentum exchange every N steps :l vdim = {x} or {y} or {z} = which momentum component to exchange :l pdim = {x} or {y} or {z} = direction of momentum transfer :l -Nbin = # of layers in pdim direction :l +Nbin = # of layers in pdim direction (must be even number) :l zero or more keyword/value pairs may be appended :l keyword = {swap} or {target} :l @@ -46,18 +46,19 @@ system's response. The simulation box is divided into {Nbin} layers in the {pdim} -direction. Every N steps, Nswap pairs of atoms are chosen in the -following manner. Only atoms in the fix group are considered. Nswap -atoms in the bottom layer with positive velocity components in the -{vdim} direction closest to the target value {V} are selected. -Similarly, Nswap atoms in the middle later with negative velocity -components in the {vdim} direction closest to the negative of the -target value {V} are selected. The two sets of Nswap atoms are paired -up and their {vdim} momenta components are swapped within each pair. -This resets their velocities, typically in opposite directions. Over -time, this induces a shear velocity profile in the system which can be -measured using commands such as the following, which writes the -profile to the file tmp.profile: +direction, where the layer 1 is at the low end of that dimension and +the layer {Nbin} is at the high end. Every N steps, Nswap pairs of +atoms are chosen in the following manner. Only atoms in the fix group +are considered. Nswap atoms in layer 1 with positive velocity +components in the {vdim} direction closest to the target value {V} are +selected. Similarly, Nswap atoms in the "middle" layer (see below) with +negative velocity components in the {vdim} direction closest to the +negative of the target value {V} are selected. The two sets of Nswap +atoms are paired up and their {vdim} momenta components are swapped +within each pair. This resets their velocities, typically in opposite +directions. Over time, this induces a shear velocity profile in the +system which can be measured using commands such as the following, +which writes the profile to the file tmp.profile: fix f1 all ave/spatial 100 10 1000 z lower 0.05 vx & file tmp.profile units reduced :pre @@ -70,6 +71,12 @@ adjusted across a wide range of values, and the momenta to be exchanged in large chunks or more smoothly. +The "middle" layer for momenta swapping is defined as the {Nbin}/2 + 1 +layer. Thus if {Nbin} = 20, the two swapping layers are 1 and 11. +This should lead to a symmetric velocity profile since the two layers +are separated by the same distance in both directions in a periodic +sense. This is why {Nbin} is restricted to being an even number. + As described below, the total momentum transferred by these velocity swaps is computed by the fix and can be output. Dividing this quantity by time and the cross-sectional area of the simulation box diff -Naur lammps-25Jun08/src/fix_thermal_conductivity.cpp lammps-26Jun08/src/fix_thermal_conductivity.cpp --- lammps-25Jun08/src/fix_thermal_conductivity.cpp 2008-05-14 15:38:34.000000000 -0600 +++ lammps-26Jun08/src/fix_thermal_conductivity.cpp 2008-06-24 17:24:37.000000000 -0600 @@ -51,7 +51,8 @@ else error->all("Illegal fix thermal/conductivity command"); nbin = atoi(arg[5]); - if (nbin < 3) error->all("Illegal fix thermal/conductivity command"); + if (nbin % 2 || nbin <= 2) + error->all("Illegal fix thermal/conductivity command"); // optional keywords @@ -105,8 +106,7 @@ // set bounds of 2 slabs in edim // only necessary for static box, else re-computed in end_of_step() // lo bin is always bottom bin - // if nbin even, hi bin is just below half height - // if nbin odd, hi bin straddles half height + // hi bin is just above half height if (domain->box_change == 0) { prd = domain->prd[edim]; @@ -115,8 +115,8 @@ double binsize = (boxhi-boxlo) / nbin; slablo_lo = boxlo; slablo_hi = boxlo + binsize; - slabhi_lo = boxlo + ((nbin-1)/2)*binsize; - slabhi_hi = boxlo + ((nbin-1)/2 + 1)*binsize; + slabhi_lo = boxlo + (nbin/2)*binsize; + slabhi_hi = boxlo + (nbin/2+1)*binsize; } periodicity = domain->periodicity[edim]; @@ -143,8 +143,8 @@ double binsize = (boxhi-boxlo) / nbin; slablo_lo = boxlo; slablo_hi = boxlo + binsize; - slabhi_lo = boxlo + ((nbin-1)/2)*binsize; - slabhi_hi = boxlo + ((nbin-1)/2 + 1)*binsize; + slabhi_lo = boxlo + (nbin/2)*binsize; + slabhi_hi = boxlo + (nbin/2+1)*binsize; } // make 2 lists of up to nswap atoms diff -Naur lammps-25Jun08/src/fix_viscosity.cpp lammps-26Jun08/src/fix_viscosity.cpp --- lammps-25Jun08/src/fix_viscosity.cpp 2008-05-15 16:42:47.000000000 -0600 +++ lammps-26Jun08/src/fix_viscosity.cpp 2008-06-24 17:24:37.000000000 -0600 @@ -56,7 +56,7 @@ else error->all("Illegal fix viscosity command"); nbin = atoi(arg[6]); - if (nbin < 3) error->all("Illegal fix viscosity command"); + if (nbin % 2 || nbin <= 2) error->all("Illegal fix viscosity command"); // optional keywords @@ -116,8 +116,7 @@ // set bounds of 2 slabs in pdim // only necessary for static box, else re-computed in end_of_step() // lo bin is always bottom bin - // if nbin even, hi bin is just below half height - // if nbin odd, hi bin straddles half height + // hi bin is just above half height if (domain->box_change == 0) { prd = domain->prd[pdim]; @@ -126,8 +125,8 @@ double binsize = (boxhi-boxlo) / nbin; slablo_lo = boxlo; slablo_hi = boxlo + binsize; - slabhi_lo = boxlo + ((nbin-1)/2)*binsize; - slabhi_hi = boxlo + ((nbin-1)/2 + 1)*binsize; + slabhi_lo = boxlo + (nbin/2)*binsize; + slabhi_hi = boxlo + (nbin/2+1)*binsize; } periodicity = domain->periodicity[pdim]; @@ -154,8 +153,8 @@ double binsize = (boxhi-boxlo) / nbin; slablo_lo = boxlo; slablo_hi = boxlo + binsize; - slabhi_lo = boxlo + ((nbin-1)/2)*binsize; - slabhi_hi = boxlo + ((nbin-1)/2 + 1)*binsize; + slabhi_lo = boxlo + (nbin/2)*binsize; + slabhi_hi = boxlo + (nbin/2+1)*binsize; } // make 2 lists of up to nswap atoms with velocity closest to +/- vtarget