|From:||Axel Kohlmeyer <akohlmey@...24...>|
|Date:||Tue, 21 Nov 2017 11:26:18 -0500|
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_FLUIDP242401 -69618.561 279.19592 -4316.1601 504.12015 11762.013243000 -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+c_virial+c_
virial)/(3.*vol)> compute FLUIDP FLUID reduce sum v_pfwhere vol = volume of box minus the solidruns 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.
ps from a 2009 post by Steve:LAMMPS can do all of this except the volume normalization, whichas you say, is ill-defined, so LAMMPS doesn't attempt it. Youcan use compute reduce to sum per-atom stress over atoms ina group or geometric region. You can use variable formulas to massagethat quantity, then output with thermo. If you just use pxx, pyy, etcyou 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 notinclude forces from the "ghost" atoms into the virial but does include themin 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