LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Mailing List Archives
[lammps-users] NPT with a (sub)group
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lammps-users] NPT with a (sub)group

From: "Jones, Reese" <rjones@...3...>
Date: Tue, 21 Nov 2017 16:10:57 +0000

I want to control the pressure of a solid-fluid system via NPT. The fluid completely surrounds the solid and the periodic boundaries only cross the fluid. For reasons that would just confuse the problem, I want to control the pressure in the fluid only since:
Step PotEng Temp Press c_FLUIDT c_FLUIDP
  242401   -69618.561    279.19592   -4316.1601    504.12015    11762.013
  243000   -69611.766    273.03258     -2254.22    498.39166    11873.174
  244000   -69632.783    273.86891   -3366.2436     498.7713    11618.811

At the level of LAMMPS commands
- NPT has no restrictions on groups, so group FLUID is ok
- compute_pressure is restricted to group "all"
- a compute_reduce such as:
> variable pf atom -(c_virial[1]+c_virial[2]+c_virial[3])/(3.*vol)
> compute FLUIDP FLUID reduce sum v_pf
where vol = volume of box minus the solid
runs into this error:
> Fix_modify pressure ID does not compute pressure

Hacking this error out leads to a seg fault in compute reduce  which I can only guess is due to the timing of the virial computation versus the request for the compute's result.

I think the next avenue would be to enable non-"all" groups for compute_pressure but I don't fully understand why it is restricted to "all". Is it merely the volume is assumed to be the total system volume or is it something deeper like the partial sum of a per-atom virial isn't exactly a pressure/stress? If it's the former, just adding a compute_modify to feed it the volume or the fraction of the total volume to use would work I think.

many thanks,

ps from a 2009 post by Steve:
LAMMPS can do all of this except the volume normalization, which
as you say, is ill-defined, so LAMMPS doesn't attempt it.  You
can use compute reduce to sum per-atom stress over atoms in
a group or geometric region.  You can use variable formulas to massage
that quantity, then output with thermo.  If you just use pxx, pyy, etc
you will get the pressure tensor for the entire system.


but there is also a 2014 post entitled "Re: [lammps-users] Does LAMMPS calculate pressure correctly?"

The reason you get the result different from LAMMPS is that LAMMPS does not
include forces from the "ghost" atoms into the virial but does include them
in the force output.

"the second law is just a fancy way of saying things are going from bad to worse" -- Eeyore
"nah, they are just getting more interesting" -- Piglet
Reese Jones (925) 294-4744