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

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


From: Axel Kohlmeyer <akohlmey@...24...>
Date: Tue, 21 Nov 2017 11:26:18 -0500



On Tue, Nov 21, 2017 at 11:10 AM, Jones, Reese <rjones@...3...> wrote:

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.

compute pressure is restricted to group all since it uses the *total* virial. 

i would suggest an approach for a per group pressure by implementing a compute pressure/group based on combining existing compute facilities, e.g. stress/atom as source for the group virial (via reduction) and then take a variable as source for the volume (and this could be either a per-atom value, e.g. computed by voronoi/atom or set based on atom type in an atom-style variable, or a globally computed or constant value). reduce as needed and combine, and you would have a pressure style for a group that could be connected to your npt fix (with all caveats that apply to this kind of model, but i am certain you are aware of that).

axel.


 

many thanks,
Reese

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.

Steve

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 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
lammps-users mailing list
lammps-users@...6297....sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lammps-users




--
Dr. Axel Kohlmeyer  akohlmey@...12...24...  http://goo.gl/1wk0
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.