A question about fix nph

Dear LAMMPS users,
I have a question regarding this fix nph command:
In this command, the user can tell lammps which dimension to apply the barostat by using the keywords x, y, z, etc. When lammps is calculating enthalpy in this command, does it take all 3 dimensions into account or just the dimensions prescribed by the keywords (x, y or z)?
I have been looking though the manual page for fix nph but did not find anything helpful regarding this question.
Could anybody answer my question or just direct me to the correct documentation page?

Regards,

Aidan can answer this Q ...

Steve

When LAMMPS runs NVE dynamics, it does not calculate E.
Similarly, when it runs NPH dynamics, it does not calculate H.
So your question is not well-posed. A better question is, what is the
definition of the conserved quantity H in NPH dynamics?
The answer is H = Etot(t) + P*V(t), where
Etot is the instantaneous total energy, P
is the specified target pressure, and V is the instantaneous volume.
Etot should include only kinetic and potential energy of the atoms. There
should be no other external fields, fixes, etc, and the potential energy
should not include the energy of fix nph. Finally, the NPH ensemble is only
guaranteed when P is a hydrostatic pressure. It may be possible in other
cases,
but it depends on the details. Note also that H is different from the
LAMMPS thermo variable enthalpy, which uses the instantaneous pressure.
See the appended script and output for a comparison of enthalpy and H.

Aidan

[[email protected]... melt]$ more in.foo
# 3d Lennard-Jones crystal

variable pset equal 100.0

units lj
atom_style atomic

# Initial state

lattice fcc 1.522
region box block 0 10 0 10 0 10
create_box 1 box
create_atoms 1 box
mass 1 1.0
velocity all create 0.1 87287
displace_atoms all random 0.008 0.008 0.008 12345 units lattice

# Potential

pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0 2.5

# Integrator

neighbor 0.3 bin
neigh_modify every 20 delay 0 check no

timestep 0.00025

fix 1 all nph iso \{pset\} {pset} 0.1 drag 0.0
fix_modify 1 energy no

# Output settings

variable HinNPH equal etotal+${pset}*vol
variable etotfix equal etotal+f_1
thermo 50
thermo_style custom step temp v_etotfix press vol enthalpy v_HinNPH
thermo_modify norm no

run 1000
[[email protected]... melt]$ mpirun -np 1 ../../src/lmp_mac_mpi < in.foo
LAMMPS (25 Sep 2011)
Lattice spacing in x,y,z = 1.38001 1.38001 1.38001
Created orthogonal box = (0 0 0) to (13.8001 13.8001 13.8001)
  1 by 1 by 1 processor grid
Created 4000 atoms
Displacing atoms ...
Setting up run ...
Memory usage per processor = 3.90295 Mbytes
Step Temp etotfix Press Volume Enthalpy HinNPH
       0 0.1 1133.6654 100.18912 2628.1209 264442.79
  263945.75
      50 0.10742455 1133.6603 99.896704 2628.9689 263674.14
  263945.71
     100 0.10921089 1133.6568 99.92348 2628.7981 263744.54
   263945.7
     150 0.088865322 1133.664 100.18937 2628.4689 264443.52
  263945.75
     200 0.078153079 1133.6665 99.867988 2630.035 263598.53
  263945.72
     250 0.095026393 1133.6601 99.950951 2629.1618 263816.72
  263945.68
     300 0.10806783 1133.6584 100.19046 2627.8309 264446.24
  263945.75
     350 0.099814796 1133.6626 99.839976 2629.4307 263524.96
  263945.73
     400 0.094485863 1133.6633 99.980216 2629.0804 263893.67
  263945.69
     450 0.10169923 1133.6607 100.1909 2628.0428 264447.44
  263945.75
     500 0.10099538 1133.6608 99.80481 2629.5168 263432.5
  263945.75
     550 0.092015154 1133.663 100.01612 2629.0216 263988.07
  263945.69
     600 0.094319366 1133.6636 100.19729 2628.2644 264464.29
  263945.76
     650 0.10313303 1133.6612 99.750073 2629.6541 263288.58
   263945.8
     700 0.10041987 1133.6603 100.06743 2628.5501 264122.95
   263945.7
     750 0.093330082 1133.6649 100.21723 2628.2241 264516.7
  263945.77
     800 0.097280269 1133.666 99.655052 2630.2085 263038.63
  263945.91
     850 0.10288696 1133.6597 100.15125 2628.1508 264343.23
  263945.72
     900 0.097579091 1133.6633 100.23988 2627.9956 264576.18
  263945.79
     950 0.092714862 1133.6715 99.534972 2630.8147 262722.69
  263946.09
    1000 0.098097164 1133.6634 100.26323 2627.8896 264637.55
  263945.81
Loop time of 5.53433 on 1 procs for 1000 steps with 4000 atoms

Pair time (\) = 4\.73183 \(85\.4996\) Neigh time \() = 0.521135 (9.41641)
Comm time (\) = 0\.0682504 \(1\.23322\) Outpt time \() = 0.000777721 (0.0140527)
Other time (%) = 0.212336 (3.8367)

Nlocal: 4000 ave 4000 max 4000 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 8195 ave 8195 max 8195 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 279999 ave 279999 max 279999 min
Histogram: 1 0 0 0 0 0 0 0 0 0

Total # of neighbors = 279999
Ave neighs/atom = 69.9998
Neighbor list builds = 50
Dangerous builds = 0

Hi Aidan,
I did not realize the fact that LAMMPS does not actually calculate H when it runs NPH.
Now that I have your explanations, please allow me to rephrase my question.
You said “The NPH ensemble is only guaranteed when P is a hydrostatic pressure. It may be possible in other cases, but it depends on the details.”
If I am looking at a “tensile test” case where the “fix deform” is applying a constant strain rate in y direction and I specify the pressure in x and z to be zeros using fix NPH command. (The boundary conditions are p p p of course.) Then in H = Etot(t) + P*V(t), what is P for this case?

Regards,

Shuai

Anytime you combine a non-Hamiltonian integrator such as fix nph with
another fix, such as fix deform, you are violating the formal assumptions
underlying non-Hamiltonian integrators, as laid out by Tuckerman et al.
Therefore, you can not expect the simulation to sample the
isobaric-isenthalpic ensemble. That does not mean your simulation is
necessarily wrong, but you will have to scrutinize your results carefully.