diff -Naur lammps-10May08/doc/Section_commands.html lammps-14May08/doc/Section_commands.html --- lammps-10May08/doc/Section_commands.html 2008-03-19 16:23:37.000000000 -0600 +++ lammps-14May08/doc/Section_commands.html 2008-05-14 15:40:02.000000000 -0600 @@ -323,8 +323,8 @@ npt/aspherenpt/spherenvenve/aspherenve/limitnve/noforcenve/spherenvt nvt/aspherenvt/sllodnvt/sphereorient/fccplaneforcepoemspourpress/berendsen printrdfrecenterrigidsetforceshakespringspring/rg -spring/selftemp/berendsentemp/rescaletmdviscosityviscouswall/granwall/lj126 -wall/lj93wall/reflectwiggle +spring/selftemp/berendsentemp/rescalethermal/conductivitytmdviscosityviscouswall/gran +wall/lj126wall/lj93wall/reflectwiggle
diff -Naur lammps-10May08/doc/Section_commands.txt lammps-14May08/doc/Section_commands.txt --- lammps-10May08/doc/Section_commands.txt 2008-03-19 16:23:37.000000000 -0600 +++ lammps-14May08/doc/Section_commands.txt 2008-05-14 15:40:02.000000000 -0600 @@ -426,6 +426,7 @@ "spring/self"_fix_spring_self.html, "temp/berendsen"_fix_temp_berendsen.html, "temp/rescale"_fix_temp_rescale.html, +"thermal/conductivity"_fix_thermal_conductivity.html, "tmd"_fix_tmd.html, "viscosity"_fix_viscosity.html, "viscous"_fix_viscous.html, diff -Naur lammps-10May08/doc/fix.html lammps-14May08/doc/fix.html --- lammps-10May08/doc/fix.html 2008-03-19 16:23:37.000000000 -0600 +++ lammps-14May08/doc/fix.html 2008-05-14 15:40:02.000000000 -0600 @@ -154,6 +154,7 @@
  • spring/self - spring from each atom to its origin
  • temp/berendsen - temperature control by Berendsen thermostat
  • temp/rescale - temperature control by velocity rescaling +
  • thermal/conductivity - Muller-Plathe kinetic energy exchange for thermal conductivity calculation
  • tmd - guide a group of atoms to a new configuration
  • viscosity - Muller-Plathe momentum exchange for viscosity calculation
  • viscous - viscous damping for granular simulations diff -Naur lammps-10May08/doc/fix.txt lammps-14May08/doc/fix.txt --- lammps-10May08/doc/fix.txt 2008-03-19 16:23:37.000000000 -0600 +++ lammps-14May08/doc/fix.txt 2008-05-14 15:40:02.000000000 -0600 @@ -160,6 +160,8 @@ Berendsen thermostat "temp/rescale"_fix_temp_rescale.html - temperature control by \ velocity rescaling +"thermal/conductivity"_fix_thermal_conductivity.html - Muller-Plathe kinetic energy exchange for \ + thermal conductivity calculation "tmd"_fix_tmd.html - guide a group of atoms to a new configuration "viscosity"_fix_viscosity.html - Muller-Plathe momentum exchange for \ viscosity calculation diff -Naur lammps-10May08/doc/fix_nph.html lammps-14May08/doc/fix_nph.html --- lammps-10May08/doc/fix_nph.html 2008-04-10 14:53:47.000000000 -0600 +++ lammps-14May08/doc/fix_nph.html 2008-05-13 15:46:42.000000000 -0600 @@ -113,6 +113,10 @@ pressure components must be specified as NULL when using style aniso.

    +

    For styles xy and yz and xz, the starting and stopping pressures +must be the same for the two coupled dimensions and cannot be +specified as NULL. +

    In some cases (e.g. for solids) the pressure (volume) and/or temperature of the system can oscillate undesirably when a Nose/Hoover barostat is applied. The optional drag keyword will damp these diff -Naur lammps-10May08/doc/fix_nph.txt lammps-14May08/doc/fix_nph.txt --- lammps-10May08/doc/fix_nph.txt 2008-04-10 14:53:47.000000000 -0600 +++ lammps-14May08/doc/fix_nph.txt 2008-05-13 15:46:42.000000000 -0600 @@ -104,6 +104,10 @@ pressure components must be specified as NULL when using style {aniso}. +For styles {xy} and {yz} and {xz}, the starting and stopping pressures +must be the same for the two coupled dimensions and cannot be +specified as NULL. + In some cases (e.g. for solids) the pressure (volume) and/or temperature of the system can oscillate undesirably when a Nose/Hoover barostat is applied. The optional {drag} keyword will damp these diff -Naur lammps-10May08/doc/fix_npt.html lammps-14May08/doc/fix_npt.html --- lammps-10May08/doc/fix_npt.html 2008-04-10 14:53:47.000000000 -0600 +++ lammps-14May08/doc/fix_npt.html 2008-05-13 15:46:42.000000000 -0600 @@ -124,6 +124,10 @@ pressure components must be specified as NULL when using style aniso.

    +

    For styles xy and yz and xz, the starting and stopping pressures +must be the same for the two coupled dimensions and cannot be +specified as NULL. +

    In some cases (e.g. for solids) the pressure (volume) and/or temperature of the system can oscillate undesirably when a Nose/Hoover barostat and thermostat is applied. The optional drag keyword will diff -Naur lammps-10May08/doc/fix_npt.txt lammps-14May08/doc/fix_npt.txt --- lammps-10May08/doc/fix_npt.txt 2008-04-10 14:53:47.000000000 -0600 +++ lammps-14May08/doc/fix_npt.txt 2008-05-13 15:46:42.000000000 -0600 @@ -113,6 +113,10 @@ pressure components must be specified as NULL when using style {aniso}. +For styles {xy} and {yz} and {xz}, the starting and stopping pressures +must be the same for the two coupled dimensions and cannot be +specified as NULL. + In some cases (e.g. for solids) the pressure (volume) and/or temperature of the system can oscillate undesirably when a Nose/Hoover barostat and thermostat is applied. The optional {drag} keyword will diff -Naur lammps-10May08/doc/fix_npt_asphere.html lammps-14May08/doc/fix_npt_asphere.html --- lammps-10May08/doc/fix_npt_asphere.html 2008-03-19 16:51:12.000000000 -0600 +++ lammps-14May08/doc/fix_npt_asphere.html 2008-05-13 15:46:42.000000000 -0600 @@ -111,6 +111,10 @@ pressure components must be specified as NULL when using style aniso.

    +

    For styles xy and yz and xz, the starting and stopping pressures +must be the same for the two coupled dimensions and cannot be +specified as NULL. +

    In some cases (e.g. for solids) the pressure (volume) and/or temperature of the system can oscillate undesirably when a Nose/Hoover barostat and thermostat is applied. The optional drag keyword will diff -Naur lammps-10May08/doc/fix_npt_asphere.txt lammps-14May08/doc/fix_npt_asphere.txt --- lammps-10May08/doc/fix_npt_asphere.txt 2008-03-19 16:51:12.000000000 -0600 +++ lammps-14May08/doc/fix_npt_asphere.txt 2008-05-13 15:46:42.000000000 -0600 @@ -100,6 +100,10 @@ pressure components must be specified as NULL when using style {aniso}. +For styles {xy} and {yz} and {xz}, the starting and stopping pressures +must be the same for the two coupled dimensions and cannot be +specified as NULL. + In some cases (e.g. for solids) the pressure (volume) and/or temperature of the system can oscillate undesirably when a Nose/Hoover barostat and thermostat is applied. The optional {drag} keyword will diff -Naur lammps-10May08/doc/fix_npt_sphere.html lammps-14May08/doc/fix_npt_sphere.html --- lammps-10May08/doc/fix_npt_sphere.html 2008-03-19 16:51:12.000000000 -0600 +++ lammps-14May08/doc/fix_npt_sphere.html 2008-05-13 15:46:42.000000000 -0600 @@ -113,6 +113,10 @@ pressure components must be specified as NULL when using style aniso.

    +

    For styles xy and yz and xz, the starting and stopping pressures +must be the same for the two coupled dimensions and cannot be +specified as NULL. +

    In some cases (e.g. for solids) the pressure (volume) and/or temperature of the system can oscillate undesirably when a Nose/Hoover barostat and thermostat is applied. The optional drag keyword will diff -Naur lammps-10May08/doc/fix_npt_sphere.txt lammps-14May08/doc/fix_npt_sphere.txt --- lammps-10May08/doc/fix_npt_sphere.txt 2008-03-19 16:51:12.000000000 -0600 +++ lammps-14May08/doc/fix_npt_sphere.txt 2008-05-13 15:46:42.000000000 -0600 @@ -102,6 +102,10 @@ pressure components must be specified as NULL when using style {aniso}. +For styles {xy} and {yz} and {xz}, the starting and stopping pressures +must be the same for the two coupled dimensions and cannot be +specified as NULL. + In some cases (e.g. for solids) the pressure (volume) and/or temperature of the system can oscillate undesirably when a Nose/Hoover barostat and thermostat is applied. The optional {drag} keyword will diff -Naur lammps-10May08/doc/fix_press_berendsen.html lammps-14May08/doc/fix_press_berendsen.html --- lammps-10May08/doc/fix_press_berendsen.html 2008-04-10 14:53:47.000000000 -0600 +++ lammps-14May08/doc/fix_press_berendsen.html 2008-05-13 15:46:42.000000000 -0600 @@ -105,6 +105,10 @@ pressure components must be specified as NULL when using style aniso.

    +

    For styles xy and yz and xz, the starting and stopping pressures +must be the same for the two coupled dimensions and cannot be +specified as NULL. +

    In some cases (e.g. for solids) the pressure (volume) and/or temperature of the system can oscillate undesirably when a Nose/Hoover barostat is applied. The optional drag keyword will damp these diff -Naur lammps-10May08/doc/fix_press_berendsen.txt lammps-14May08/doc/fix_press_berendsen.txt --- lammps-10May08/doc/fix_press_berendsen.txt 2008-04-10 14:53:47.000000000 -0600 +++ lammps-14May08/doc/fix_press_berendsen.txt 2008-05-13 15:46:42.000000000 -0600 @@ -96,6 +96,10 @@ pressure components must be specified as NULL when using style {aniso}. +For styles {xy} and {yz} and {xz}, the starting and stopping pressures +must be the same for the two coupled dimensions and cannot be +specified as NULL. + In some cases (e.g. for solids) the pressure (volume) and/or temperature of the system can oscillate undesirably when a Nose/Hoover barostat is applied. The optional {drag} keyword will damp these diff -Naur lammps-10May08/doc/fix_thermal_conductivity.html lammps-14May08/doc/fix_thermal_conductivity.html --- lammps-10May08/doc/fix_thermal_conductivity.html 1969-12-31 17:00:00.000000000 -0700 +++ lammps-14May08/doc/fix_thermal_conductivity.html 2008-05-14 15:40:50.000000000 -0600 @@ -0,0 +1,154 @@ + +

    LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Commands +
    + + + + + + +
    + +

    fix thermal/conductivity command +

    +

    Syntax: +

    +
    fix ID group-ID thermal/conductivity N edim Nbin keyword value ... 
    +
    + +

    Examples: +

    +
    fix 1 all thermal/conductivity 100 z 20
    +fix 1 all thermal/conductivity 50 z 20 swap 2 
    +
    +

    Description: +

    +

    Use the Muller-Plathe algorithm described in this +paper to exchange kinetic energy between two particles +in different regions of the simulation box every N steps. This +induces a temperature gradient in the system. As described below this +enables a thermal conductivity of the fluid to be calculated. This +algorithm is sometimes called a reverse non-equilibrium MD (reverse +NEMD) approach to computing thermal conductivity. This is because the +usual NEMD approach is to impose a temperature gradient on the system +and measure the response as the resulting heat flux. In the +Muller-Plathe method, the heat flux is imposed, and the temperature +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: +

    +
    compute   ke all ke/atom
    +variable  temp atom c_ke/1.5
    +fix       3 all ave/spatial 10 100 1000 z lower 0.05 v_temp &
    +            file tmp.profile units reduced 
    +
    +

    Note that by default, Nswap = 1, though this can be changed by the +optional swap keyword. Setting this parameter appropriately, in +conjunction with the swap rate N, allows the heat flux to be adjusted +across a wide range of values, and the kinetic energy to be exchanged +in large chunks or more smoothly. +

    +

    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 +yields a heat flux. The ratio of heat flux to the slope of the +temperature profile is the thermal conductivity of the fluid, +in appopriate units. See the Muller-Plathe paper for +details. +

    +

    IMPORTANT NOTE: After equilibration, if the temperature gradient you +observe is not linear, then you are likely swapping energy too +frequently and are not in a regime of linear response. In this case +you cannot accurately infer a thermal conductivity and should try +increasing the Nevery parameter. +

    +

    Restart, fix_modify, output, run start/stop, minimize info: +

    +

    No information about this fix is written to binary restart +files. None of the fix_modify options +are relevant to this fix. +

    +

    The cummulative kinetic energy transferred between the bottom and +middle of the simulation box (in the edim direction) is stored as a +scalar quantity by this fix. This quantity is zeroed when the fix is +defined and accumlates thereafter, once every N steps. The units of +the quantity are energy; see the units command for +details. This quantity can be accessed by various output +commands, such as thermo_style +custom. The scalar value calculated by this fix is +"intensive", meaning it is independent of the number of atoms in the +simulation. +

    +

    No parameter of this fix can be used with the start/stop keywords of +the run command. This fix is not invoked during energy +minimization. +

    +

    Restrictions: +

    +

    LAMMPS does not check, but the masses of all exchanged atom pairs +should be the same to use this fix in a way that conserves both +momentum and kinetic energy. Thus you should not need to thermostat +the system. If you do use a thermostat, you may want to apply it only +to the non-swapped dimensions (other than vdim). +

    +

    LAMMPS does not check, but you should not use this fix to swap the +kinetic energy of atoms that are in constrained molecules, e.g. via +fix shake or fix rigid. This is +because application of the constraints will alter the amount of +transferred momentum. You should, however, be able to use flexible +molecules. See the Zhang paper for a discussion and results +of this idea. +

    +

    When running a simulation with large, massive particles or molecules +in a background solvent, you may want to only exchange kinetic energy +bewteen solvent particles. +

    +

    Related commands: +

    +

    fix ave/spatial, fix +viscosity +

    +

    Default: +

    +

    The option defaults are swap = 1. +

    +
    + + + +

    (Muller-Plathe) Muller-Plathe and Reith, Computational and +Theoretical Polymer Science, 9, 203-209 (1999). +

    + + +

    (Zhang) Zhang, Lussetti, de Souza, Muller-Plathe, J Phys Chem B, +109, 15060-15067 (2005). +

    + diff -Naur lammps-10May08/doc/fix_thermal_conductivity.txt lammps-14May08/doc/fix_thermal_conductivity.txt --- lammps-10May08/doc/fix_thermal_conductivity.txt 1969-12-31 17:00:00.000000000 -0700 +++ lammps-14May08/doc/fix_thermal_conductivity.txt 2008-05-14 15:40:50.000000000 -0600 @@ -0,0 +1,140 @@ +"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c + +:link(lws,http://lammps.sandia.gov) +:link(ld,Manual.html) +:link(lc,Section_commands.html#comm) + +:line + +fix thermal/conductivity command :h3 + +[Syntax:] + +fix ID group-ID thermal/conductivity N edim Nbin keyword value ... :pre + +ID, group-ID are documented in "fix"_fix.html command :ulb,l +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 + +zero or more keyword/value pairs may be appended :l +keyword = {swap} :l + {swap} value = Nswap = number of swaps to perform every N steps :pre +:ule + +[Examples:] + +fix 1 all thermal/conductivity 100 z 20 +fix 1 all thermal/conductivity 50 z 20 swap 2 :pre + +[Description:] + +Use the Muller-Plathe algorithm described in "this +paper"_#Muller-Plathe to exchange kinetic energy between two particles +in different regions of the simulation box every N steps. This +induces a temperature gradient in the system. As described below this +enables a thermal conductivity of the fluid to be calculated. This +algorithm is sometimes called a reverse non-equilibrium MD (reverse +NEMD) approach to computing thermal conductivity. This is because the +usual NEMD approach is to impose a temperature gradient on the system +and measure the response as the resulting heat flux. In the +Muller-Plathe method, the heat flux is imposed, and the temperature +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: + +compute ke all ke/atom +variable temp atom c_ke[]/1.5 +fix 3 all ave/spatial 10 100 1000 z lower 0.05 v_temp & + file tmp.profile units reduced :pre + +Note that by default, Nswap = 1, though this can be changed by the +optional {swap} keyword. Setting this parameter appropriately, in +conjunction with the swap rate N, allows the heat flux to be adjusted +across a wide range of values, and the kinetic energy to be exchanged +in large chunks or more smoothly. + +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 +yields a heat flux. The ratio of heat flux to the slope of the +temperature profile is the thermal conductivity of the fluid, +in appopriate units. See the "Muller-Plathe paper"_#Muller-Plathe for +details. + +IMPORTANT NOTE: After equilibration, if the temperature gradient you +observe is not linear, then you are likely swapping energy too +frequently and are not in a regime of linear response. In this case +you cannot accurately infer a thermal conductivity and should try +increasing the Nevery parameter. + +[Restart, fix_modify, output, run start/stop, minimize info:] + +No information about this fix is written to "binary restart +files"_restart.html. None of the "fix_modify"_fix_modify.html options +are relevant to this fix. + +The cummulative kinetic energy transferred between the bottom and +middle of the simulation box (in the {edim} direction) is stored as a +scalar quantity by this fix. This quantity is zeroed when the fix is +defined and accumlates thereafter, once every N steps. The units of +the quantity are energy; see the "units"_units.html command for +details. This quantity can be accessed by various "output +commands"_Section_howto.html#4_15, such as "thermo_style +custom"_thermo_style.html. The scalar value calculated by this fix is +"intensive", meaning it is independent of the number of atoms in the +simulation. + +No parameter of this fix can be used with the {start/stop} keywords of +the "run"_run.html command. This fix is not invoked during "energy +minimization"_minimize.html. + +[Restrictions:] + +LAMMPS does not check, but the masses of all exchanged atom pairs +should be the same to use this fix in a way that conserves both +momentum and kinetic energy. Thus you should not need to thermostat +the system. If you do use a thermostat, you may want to apply it only +to the non-swapped dimensions (other than {vdim}). + +LAMMPS does not check, but you should not use this fix to swap the +kinetic energy of atoms that are in constrained molecules, e.g. via +"fix shake"_fix_shake.html or "fix rigid"_fix_rigid.html. This is +because application of the constraints will alter the amount of +transferred momentum. You should, however, be able to use flexible +molecules. See the "Zhang paper"_#Zhang for a discussion and results +of this idea. + +When running a simulation with large, massive particles or molecules +in a background solvent, you may want to only exchange kinetic energy +bewteen solvent particles. + +[Related commands:] + +"fix ave/spatial"_fix_ave_spatial.html, "fix +viscosity"_fix_viscosity.html + +[Default:] + +The option defaults are swap = 1. + +:line + +:link(Muller-Plathe) +[(Muller-Plathe)] Muller-Plathe and Reith, Computational and +Theoretical Polymer Science, 9, 203-209 (1999). + +:link(Zhang) +[(Zhang)] Zhang, Lussetti, de Souza, Muller-Plathe, J Phys Chem B, +109, 15060-15067 (2005). diff -Naur lammps-10May08/doc/fix_viscosity.html lammps-14May08/doc/fix_viscosity.html --- lammps-10May08/doc/fix_viscosity.html 2008-03-28 09:45:51.000000000 -0600 +++ lammps-14May08/doc/fix_viscosity.html 2008-05-14 15:40:02.000000000 -0600 @@ -70,8 +70,8 @@ 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 
    +
    fix f1 all ave/spatial 100 10 1000 z lower 0.05 vx &
    +    file tmp.profile units reduced 
     

    Note that by default, Nswap = 1 and vtarget = INF, though this can be changed by the optional swap and vtarget keywords. When vtarget = @@ -144,8 +144,7 @@

    Related commands:

    -

    fix ave/spatial, fix -nvt/sllod +

    fix ave/spatial

    Default:

    diff -Naur lammps-10May08/doc/fix_viscosity.txt lammps-14May08/doc/fix_viscosity.txt --- lammps-10May08/doc/fix_viscosity.txt 2008-03-28 09:45:51.000000000 -0600 +++ lammps-14May08/doc/fix_viscosity.txt 2008-05-14 15:40:02.000000000 -0600 @@ -59,8 +59,8 @@ 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 +fix f1 all ave/spatial 100 10 1000 z lower 0.05 vx & + file tmp.profile units reduced :pre Note that by default, Nswap = 1 and vtarget = INF, though this can be changed by the optional {swap} and {vtarget} keywords. When vtarget = @@ -133,8 +133,7 @@ [Related commands:] -"fix ave/spatial"_fix_ave_spatial.html, "fix -nvt/sllod"_fix_nvt_sllod.html +"fix ave/spatial"_fix_ave_spatial.html [Default:] diff -Naur lammps-10May08/doc/fix_wall_reflect.html lammps-14May08/doc/fix_wall_reflect.html --- lammps-10May08/doc/fix_wall_reflect.html 2007-10-10 16:28:11.000000000 -0600 +++ lammps-14May08/doc/fix_wall_reflect.html 2008-05-13 15:49:52.000000000 -0600 @@ -35,6 +35,14 @@ put back inside the box by the same delta and the sign of the corresponding component of its velocity is flipped.

    +

    When used in conjunction with fix nve and run_style +verlet, the resultant time-integration algorithm is +equivalent to the primitive splitting algorithm (PSA) described by +Bond. Because each reflection event divides +the corresponding timestep asymmetrically, energy conservation is only +satisfied to O(dt), rather than to O(dt^2) as it would be for +velocity-Verlet integration without reflective walls. +

    IMPORTANT NOTE: This fix performs its operations at the same point in the timestep as other time integration fixes, such as fix nve, fix nvt, or fix npt. @@ -69,4 +77,8 @@

    Default: none

    + + +

    (Bond) Bond and Leimkuhler, SIAM J Sci Comput, 30, p 134 (2007). +

    diff -Naur lammps-10May08/doc/fix_wall_reflect.txt lammps-14May08/doc/fix_wall_reflect.txt --- lammps-10May08/doc/fix_wall_reflect.txt 2007-10-10 16:28:11.000000000 -0600 +++ lammps-14May08/doc/fix_wall_reflect.txt 2008-05-13 15:49:52.000000000 -0600 @@ -32,6 +32,14 @@ put back inside the box by the same delta and the sign of the corresponding component of its velocity is flipped. +When used in conjunction with "fix nve"_fix_nve.html and "run_style +verlet"_run_style.html, the resultant time-integration algorithm is +equivalent to the primitive splitting algorithm (PSA) described by +"Bond"_#Bond. Because each reflection event divides +the corresponding timestep asymmetrically, energy conservation is only +satisfied to O(dt), rather than to O(dt^2) as it would be for +velocity-Verlet integration without reflective walls. + IMPORTANT NOTE: This fix performs its operations at the same point in the timestep as other time integration fixes, such as "fix nve"_fix_nve.html, "fix nvt"_fix_nvt.html, or "fix npt"_fix_npt.html. @@ -65,3 +73,6 @@ "fix wall/lj93"_fix_wall_lj93.html command [Default:] none + +:link(Bond) +[(Bond)] Bond and Leimkuhler, SIAM J Sci Comput, 30, p 134 (2007). diff -Naur lammps-10May08/src/fix_nph.cpp lammps-14May08/src/fix_nph.cpp --- lammps-10May08/src/fix_nph.cpp 2008-04-10 14:53:37.000000000 -0600 +++ lammps-14May08/src/fix_nph.cpp 2008-05-13 15:44:17.000000000 -0600 @@ -136,7 +136,24 @@ } else error->all("Illegal fix nph command"); } - // check for periodicity in controlled dimensions + // error checks + + if (press_couple == XY && (p_flag[0] == 0 || p_flag[1] == 0)) + error->all("Invalid fix npt command"); + if (press_couple == YZ && (p_flag[1] == 0 || p_flag[2] == 0)) + error->all("Invalid fix npt command"); + if (press_couple == XZ && (p_flag[0] == 0 || p_flag[2] == 0)) + error->all("Invalid fix npt command"); + + if (press_couple == XY && + (p_start[0] != p_start[1] || p_stop[0] != p_stop[1])) + error->all("Invalid fix npt command"); + if (press_couple == YZ && + (p_start[1] != p_start[2] || p_stop[1] != p_stop[2])) + error->all("Invalid fix npt command"); + if (press_couple == XZ && + (p_start[0] != p_start[2] || p_stop[0] != p_stop[2])) + error->all("Invalid fix npt command"); if (p_flag[0] && domain->xperiodic == 0) error->all("Cannot use fix nph on a non-periodic dimension"); diff -Naur lammps-10May08/src/fix_npt.cpp lammps-14May08/src/fix_npt.cpp --- lammps-10May08/src/fix_npt.cpp 2008-04-16 16:00:37.000000000 -0600 +++ lammps-14May08/src/fix_npt.cpp 2008-05-13 15:44:17.000000000 -0600 @@ -142,8 +142,25 @@ } else error->all("Illegal fix npt command"); } - // check for periodicity in controlled dimensions + // error checks + if (press_couple == XY && (p_flag[0] == 0 || p_flag[1] == 0)) + error->all("Invalid fix npt command"); + if (press_couple == YZ && (p_flag[1] == 0 || p_flag[2] == 0)) + error->all("Invalid fix npt command"); + if (press_couple == XZ && (p_flag[0] == 0 || p_flag[2] == 0)) + error->all("Invalid fix npt command"); + + if (press_couple == XY && + (p_start[0] != p_start[1] || p_stop[0] != p_stop[1])) + error->all("Invalid fix npt command"); + if (press_couple == YZ && + (p_start[1] != p_start[2] || p_stop[1] != p_stop[2])) + error->all("Invalid fix npt command"); + if (press_couple == XZ && + (p_start[0] != p_start[2] || p_stop[0] != p_stop[2])) + error->all("Invalid fix npt command"); + if (p_flag[0] && domain->xperiodic == 0) error->all("Cannot use fix npt on a non-periodic dimension"); if (p_flag[1] && domain->yperiodic == 0) diff -Naur lammps-10May08/src/fix_press_berendsen.cpp lammps-14May08/src/fix_press_berendsen.cpp --- lammps-10May08/src/fix_press_berendsen.cpp 2008-03-18 16:55:14.000000000 -0600 +++ lammps-14May08/src/fix_press_berendsen.cpp 2008-05-13 15:43:39.000000000 -0600 @@ -33,6 +33,7 @@ #define MAX(A,B) ((A) > (B)) ? (A) : (B) enum{NOBIAS,BIAS}; +enum{XYZ,XY,YZ,XZ,ANISO}; /* ---------------------------------------------------------------------- */ @@ -50,7 +51,7 @@ if (strcmp(arg[3],"xyz") == 0) { if (narg < 7) error->all("Illegal fix press/berendsen command"); - press_couple = 0; + press_couple = XYZ; p_start[0] = p_start[1] = p_start[2] = atof(arg[4]); p_stop[0] = p_stop[1] = p_stop[2] = atof(arg[5]); p_period[0] = p_period[1] = p_period[2] = atof(arg[6]); @@ -61,16 +62,16 @@ } } else { - if (strcmp(arg[3],"xy") == 0) press_couple = 1; - else if (strcmp(arg[3],"yz") == 0) press_couple = 2; - else if (strcmp(arg[3],"xz") == 0) press_couple = 3; - else if (strcmp(arg[3],"aniso") == 0) press_couple = 4; + if (strcmp(arg[3],"xy") == 0) press_couple = XY; + else if (strcmp(arg[3],"yz") == 0) press_couple = YZ; + else if (strcmp(arg[3],"xz") == 0) press_couple = XZ; + else if (strcmp(arg[3],"aniso") == 0) press_couple = ANISO; else error->all("Illegal fix press/berendsen command"); if (narg < 8) error->all("Illegal fix press/berendsen command"); if (domain->dimension == 2 && - (press_couple == 1 || press_couple == 2 || press_couple == 3)) + (press_couple == XY || press_couple == YZ || press_couple == XZ)) error->all("Invalid fix press/berendsen command for a 2d simulation"); if (strcmp(arg[4],"NULL") == 0) { @@ -112,7 +113,7 @@ allremap = 1; int iarg; - if (press_couple == 0) iarg = 7; + if (press_couple == XYZ) iarg = 7; else iarg = 11; while (iarg < narg) { @@ -133,6 +134,23 @@ // error checks + if (press_couple == XY && (p_flag[0] == 0 || p_flag[1] == 0)) + error->all("Invalid fix npt command"); + if (press_couple == YZ && (p_flag[1] == 0 || p_flag[2] == 0)) + error->all("Invalid fix npt command"); + if (press_couple == XZ && (p_flag[0] == 0 || p_flag[2] == 0)) + error->all("Invalid fix npt command"); + + if (press_couple == XY && + (p_start[0] != p_start[1] || p_stop[0] != p_stop[1])) + error->all("Invalid fix npt command"); + if (press_couple == YZ && + (p_start[1] != p_start[2] || p_stop[1] != p_stop[2])) + error->all("Invalid fix npt command"); + if (press_couple == XZ && + (p_start[0] != p_start[2] || p_stop[0] != p_stop[2])) + error->all("Invalid fix npt command"); + if (p_flag[0] && domain->xperiodic == 0) error->all("Cannot use fix press/berendsen on a non-periodic dimension"); if (p_flag[1] && domain->yperiodic == 0) @@ -281,7 +299,7 @@ { // compute new T,P - if (press_couple == 0) { + if (press_couple == XYZ) { double tmp = temperature->compute_scalar(); tmp = pressure->compute_scalar(); } else { @@ -319,21 +337,21 @@ { double *tensor = pressure->vector; - if (press_couple == 0) + if (press_couple == XYZ) p_current[0] = p_current[1] = p_current[2] = pressure->scalar; - else if (press_couple == 1) { + else if (press_couple == XY) { double ave = 0.5 * (tensor[0] + tensor[1]); p_current[0] = p_current[1] = ave; p_current[2] = tensor[2]; - } else if (press_couple == 2) { + } else if (press_couple == YZ) { double ave = 0.5 * (tensor[1] + tensor[2]); p_current[1] = p_current[2] = ave; p_current[0] = tensor[0]; - } else if (press_couple == 3) { + } else if (press_couple == XZ) { double ave = 0.5 * (tensor[0] + tensor[2]); p_current[0] = p_current[2] = ave; p_current[1] = tensor[1]; - } if (press_couple == 4) { + } if (press_couple == ANISO) { p_current[0] = tensor[0]; p_current[1] = tensor[1]; p_current[2] = tensor[2]; diff -Naur lammps-10May08/src/fix_thermal_conductivity.cpp lammps-14May08/src/fix_thermal_conductivity.cpp --- lammps-10May08/src/fix_thermal_conductivity.cpp 1969-12-31 17:00:00.000000000 -0700 +++ lammps-14May08/src/fix_thermal_conductivity.cpp 2008-05-14 15:38:34.000000000 -0600 @@ -0,0 +1,277 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "math.h" +#include "mpi.h" +#include "string.h" +#include "stdlib.h" +#include "fix_thermal_conductivity.h" +#include "atom.h" +#include "force.h" +#include "domain.h" +#include "error.h" + +using namespace LAMMPS_NS; + +#define BIG 1.0e10 + +#define MIN(A,B) ((A) < (B)) ? (A) : (B) +#define MAX(A,B) ((A) > (B)) ? (A) : (B) + +/* ---------------------------------------------------------------------- */ + +FixThermalConductivity::FixThermalConductivity(LAMMPS *lmp, + int narg, char **arg) : + Fix(lmp, narg, arg) +{ + if (narg < 6) error->all("Illegal fix thermal/conductivity command"); + + MPI_Comm_rank(world,&me); + + nevery = atoi(arg[3]); + if (nevery <= 0) error->all("Illegal fix thermal/conductivity command"); + + scalar_flag = 1; + scalar_vector_freq = nevery; + extscalar = 0; + + if (strcmp(arg[4],"x") == 0) edim = 0; + else if (strcmp(arg[4],"y") == 0) edim = 1; + else if (strcmp(arg[4],"z") == 0) edim = 2; + else error->all("Illegal fix thermal/conductivity command"); + + nbin = atoi(arg[5]); + if (nbin < 3) error->all("Illegal fix thermal/conductivity command"); + + // optional keywords + + nswap = 1; + + int iarg = 6; + while (iarg < narg) { + if (strcmp(arg[iarg],"swap") == 0) { + if (iarg+2 > narg) + error->all("Illegal fix thermal/conductivity command"); + nswap = atoi(arg[iarg+1]); + if (nswap <= 0) + error->all("Fix thermal/conductivity swap value must be positive"); + iarg += 2; + } else error->all("Illegal fix thermal/conductivity command"); + } + + // initialize array sizes to nswap+1 so have space to shift values down + + index_lo = new int[nswap+1]; + index_hi = new int[nswap+1]; + ke_lo = new double[nswap+1]; + ke_hi = new double[nswap+1]; + + e_exchange = 0.0; +} + +/* ---------------------------------------------------------------------- */ + +FixThermalConductivity::~FixThermalConductivity() +{ + delete [] index_lo; + delete [] index_hi; + delete [] ke_lo; + delete [] ke_hi; +} + +/* ---------------------------------------------------------------------- */ + +int FixThermalConductivity::setmask() +{ + int mask = 0; + mask |= END_OF_STEP; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixThermalConductivity::init() +{ + // 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 + + if (domain->box_change == 0) { + prd = domain->prd[edim]; + boxlo = domain->boxlo[edim]; + boxhi = domain->boxhi[edim]; + 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; + } + + periodicity = domain->periodicity[edim]; +} + +/* ---------------------------------------------------------------------- */ + +void FixThermalConductivity::end_of_step() +{ + int i,j,m,insert; + double p,coord,ke; + MPI_Status status; + struct { + double value; + int proc; + } mine[2],all[2]; + + // if box changes, recompute bounds of 2 slabs in edim + + if (domain->box_change) { + prd = domain->prd[edim]; + boxlo = domain->boxlo[edim]; + boxhi = domain->boxhi[edim]; + 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; + } + + // make 2 lists of up to nswap atoms + // hottest atoms in lo slab, coldest atoms in hi slab (really mid slab) + // lo slab list is sorted by hottest, hi slab is sorted by coldest + // map atoms back into periodic box if necessary + // insert = location in list to insert new atom + + double **x = atom->x; + double **v = atom->v; + double *mass = atom->mass; + double *rmass = atom->rmass; + int *type = atom->type; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + nhi = nlo = 0; + + for (i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + coord = x[i][edim]; + if (coord < boxlo && periodicity) coord += prd; + else if (coord >= boxhi && periodicity) coord -= prd; + + if (coord >= slablo_lo && coord < slablo_hi) { + ke = v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]; + if (mass) ke *= 0.5*mass[type[i]]; + else ke *= 0.5*rmass[i]; + if (nlo < nswap || ke > ke_lo[nswap-1]) { + for (insert = nlo-1; insert >= 0; insert--) + if (ke < ke_lo[insert]) break; + insert++; + for (m = nlo-1; m >= insert; m--) { + ke_lo[m+1] = ke_lo[m]; + index_lo[m+1] = index_lo[m]; + } + ke_lo[insert] = ke; + index_lo[insert] = i; + if (nlo < nswap) nlo++; + } + } + + if (coord >= slabhi_lo && coord < slabhi_hi) { + ke = v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]; + if (mass) ke *= 0.5*mass[type[i]]; + else ke *= 0.5*rmass[i]; + if (nhi < nswap || ke < ke_hi[nswap-1]) { + for (insert = nhi-1; insert >= 0; insert--) + if (ke > ke_hi[insert]) break; + insert++; + for (m = nhi-1; m >= insert; m--) { + ke_hi[m+1] = ke_hi[m]; + index_hi[m+1] = index_hi[m]; + } + ke_hi[insert] = ke; + index_hi[insert] = i; + if (nhi < nswap) nhi++; + } + } + } + + // loop over nswap pairs + // pair 2 global atoms at beginning of sorted lo/hi slab lists via Allreduce + // BIG values are for procs with no atom to contribute + // use negative of hottest KE since is doing a MINLOC + // MINLOC also communicates which procs own them + // exchange kinetic energy between the 2 particles + // if I own both particles just swap, else point2point comm of velocities + + double sbuf[3],rbuf[3]; + + mine[0].proc = mine[1].proc = me; + int ilo = 0; + int ihi = 0; + + for (m = 0; m < nswap; m++) { + if (ilo < nlo) mine[0].value = -ke_lo[ilo]; + else mine[0].value = BIG; + if (ihi < nhi) mine[1].value = ke_hi[ihi]; + else mine[1].value = BIG; + + MPI_Allreduce(mine,all,2,MPI_DOUBLE_INT,MPI_MINLOC,world); + if (all[0].value == BIG || all[1].value == BIG) continue; + all[0].value = -all[0].value; + e_exchange += force->mvv2e * (all[0].value - all[1].value); + + if (me == all[0].proc && me == all[1].proc) { + i = index_lo[ilo++]; + j = index_hi[ihi++]; + rbuf[0] = v[i][0]; + rbuf[1] = v[i][1]; + rbuf[2] = v[i][2]; + v[i][0] = v[j][0]; + v[i][1] = v[j][1]; + v[i][2] = v[j][2]; + v[j][0] = rbuf[0]; + v[j][1] = rbuf[1]; + v[j][2] = rbuf[2]; + + } else if (me == all[0].proc) { + i = index_lo[ilo++]; + sbuf[0] = v[i][0]; + sbuf[1] = v[i][1]; + sbuf[2] = v[i][2]; + MPI_Sendrecv(sbuf,3,MPI_DOUBLE,all[1].proc,0, + rbuf,3,MPI_DOUBLE,all[1].proc,0,world,&status); + v[i][0] = rbuf[0]; + v[i][1] = rbuf[1]; + v[i][2] = rbuf[2]; + + } else if (me == all[1].proc) { + j = index_hi[ihi++]; + sbuf[0] = v[j][0]; + sbuf[1] = v[j][1]; + sbuf[2] = v[j][2]; + MPI_Sendrecv(sbuf,3,MPI_DOUBLE,all[0].proc,0, + rbuf,3,MPI_DOUBLE,all[0].proc,0,world,&status); + v[j][0] = rbuf[0]; + v[j][1] = rbuf[1]; + v[j][2] = rbuf[2]; + } + } +} + +/* ---------------------------------------------------------------------- */ + +double FixThermalConductivity::compute_scalar() +{ + return e_exchange; +} diff -Naur lammps-10May08/src/fix_thermal_conductivity.h lammps-14May08/src/fix_thermal_conductivity.h --- lammps-10May08/src/fix_thermal_conductivity.h 1969-12-31 17:00:00.000000000 -0700 +++ lammps-14May08/src/fix_thermal_conductivity.h 2008-05-14 15:38:34.000000000 -0600 @@ -0,0 +1,45 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef FIX_THERMAL_CONDUCTIVITY_H +#define FIX_THERMAL_CONDUCTIVITY_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixThermalConductivity : public Fix { + public: + FixThermalConductivity(class LAMMPS *, int, char **); + ~FixThermalConductivity(); + int setmask(); + void init(); + void end_of_step(); + double compute_scalar(); + + private: + int me; + int edim,nbin,periodicity; + int nswap; + double prd,boxlo,boxhi; + double slablo_lo,slablo_hi,slabhi_lo,slabhi_hi; + double e_exchange; + + int nlo,nhi; + int *index_lo,*index_hi; + double *ke_lo,*ke_hi; +}; + +} + +#endif diff -Naur lammps-10May08/src/fix_viscosity.cpp lammps-14May08/src/fix_viscosity.cpp --- lammps-10May08/src/fix_viscosity.cpp 2008-04-02 14:32:07.000000000 -0600 +++ lammps-14May08/src/fix_viscosity.cpp 2008-05-14 15:38:34.000000000 -0600 @@ -87,7 +87,7 @@ pos_delta = new double[nswap+1]; neg_delta = new double[nswap+1]; - flux = 0.0; + p_exchange = 0.0; } /* ---------------------------------------------------------------------- */ @@ -225,7 +225,7 @@ int ipos,ineg; double sbuf[2],rbuf[2]; - double dflux = 0.0; + double pswap = 0.0; mine[0].proc = mine[1].proc = me; int ipositive = 0; int inegative = 0; @@ -251,7 +251,7 @@ else sbuf[1] = rmass[ineg]; v[ineg][vdim] = rbuf[0] * rbuf[1]/sbuf[1]; v[ipos][vdim] = sbuf[0] * sbuf[1]/rbuf[1]; - dflux += rbuf[0]*rbuf[1] - sbuf[0]*sbuf[1]; + pswap += rbuf[0]*rbuf[1] - sbuf[0]*sbuf[1]; } else if (me == all[0].proc) { ipos = pos_index[ipositive++]; @@ -261,7 +261,7 @@ MPI_Sendrecv(sbuf,2,MPI_DOUBLE,all[1].proc,0, rbuf,2,MPI_DOUBLE,all[1].proc,0,world,&status); v[ipos][vdim] = rbuf[0] * rbuf[1]/sbuf[1]; - dflux += sbuf[0]*sbuf[1]; + pswap += sbuf[0]*sbuf[1]; } else if (me == all[1].proc) { ineg = neg_index[inegative++]; @@ -271,20 +271,20 @@ MPI_Sendrecv(sbuf,2,MPI_DOUBLE,all[0].proc,0, rbuf,2,MPI_DOUBLE,all[0].proc,0,world,&status); v[ineg][vdim] = rbuf[0] * rbuf[1]/sbuf[1]; - dflux -= sbuf[0]*sbuf[1]; + pswap -= sbuf[0]*sbuf[1]; } } - // tally momentum flux from all swaps + // tally momentum exchange from all swaps - double dflux_all; - MPI_Allreduce(&dflux,&dflux_all,1,MPI_DOUBLE,MPI_SUM,world); - flux += dflux_all; + double pswap_all; + MPI_Allreduce(&pswap,&pswap_all,1,MPI_DOUBLE,MPI_SUM,world); + p_exchange += pswap_all; } /* ---------------------------------------------------------------------- */ double FixViscosity::compute_scalar() { - return flux; + return p_exchange; } diff -Naur lammps-10May08/src/fix_viscosity.h lammps-14May08/src/fix_viscosity.h --- lammps-10May08/src/fix_viscosity.h 2008-03-28 09:47:41.000000000 -0600 +++ lammps-14May08/src/fix_viscosity.h 2008-05-14 15:38:34.000000000 -0600 @@ -34,7 +34,7 @@ double vtarget; double prd,boxlo,boxhi; double slablo_lo,slablo_hi,slabhi_lo,slabhi_hi; - double flux; + double p_exchange; int npositive,nnegative; int *pos_index,*neg_index; diff -Naur lammps-10May08/src/neighbor.cpp lammps-14May08/src/neighbor.cpp --- lammps-10May08/src/neighbor.cpp 2008-04-28 11:36:38.000000000 -0600 +++ lammps-14May08/src/neighbor.cpp 2008-05-13 15:44:43.000000000 -0600 @@ -1193,8 +1193,8 @@ } // create stencil of bins to search over in neighbor list construction - // sx,sy,sz = max range of stencil extent - // smax = + // sx,sy,sz = max range of stencil in each dim + // smax = max possible size of entire 3d stencil // stencil is empty if cutneighmax = 0.0 sx = static_cast (cutneighmax*bininvx); @@ -1478,7 +1478,7 @@ else iz = static_cast ((x[2]-bboxlo[2])*bininvz) - mbinzlo - 1; - return (iz*mbiny*mbinx + iy*mbinx + ix + 1); + return (iz*mbiny*mbinx + iy*mbinx + ix); } /* ---------------------------------------------------------------------- diff -Naur lammps-10May08/src/style.h lammps-14May08/src/style.h --- lammps-10May08/src/style.h 2008-05-09 09:14:11.000000000 -0600 +++ lammps-14May08/src/style.h 2008-05-14 15:38:34.000000000 -0600 @@ -188,6 +188,7 @@ #include "fix_spring_self.h" #include "fix_temp_berendsen.h" #include "fix_temp_rescale.h" +#include "fix_thermal_conductivity.h" #include "fix_tmd.h" #include "fix_viscosity.h" #include "fix_viscous.h" @@ -246,6 +247,7 @@ FixStyle(spring/self,FixSpringSelf) FixStyle(temp/berendsen,FixTempBerendsen) FixStyle(temp/rescale,FixTempRescale) +FixStyle(thermal/conductivity,FixThermalConductivity) FixStyle(tmd,FixTMD) FixStyle(viscosity,FixViscosity) FixStyle(viscous,FixViscous)