I’m having problems with LAMMPS.
The simulation I am working with starts from a restart file. I divide all atoms in the system into a group for liquid atoms, and one for gaseous atoms, based on a Potential Energy criterion.
compute PotEng all pe/atom
compute spec all reduce sum c_PotEng
thermo_style custom step temp pe c_spec
run 0
variable ifFind atom "c_PotEng < -1.3"
variable elseFind atom "c_PotEng >= -1.3"
group liquid13 dynamic all var ifFind every 10
group gas dynamic all var elseFind every 10
Then I find the center of mass of the liquid.
compute liquidCenter liquid13 com
variable liquidCenterX equal c_liquidCenter[1]
variable liquidCenterY equal c_liquidCenter[2]
variable liquidCenterZ equal c_liquidCenter[3]
And I apply a force to the liquid and an equal and opposite force to the gas.
variable liqForceValue equal 0.125
variable gasForceValue equal "-1.0*v_liqForceValue *(v_liqCount/v_gasCount)"
fix liqForceadd liquid13 addforce v_liqForceValue 0.0 0.0 every 1000
fix gasForceAdd gas addforce v_gasForceValue 0.0 0.0 every 1000
Finally, based on the center of mass I calculated and a pre-defined radius, I create a series of “shells” and divide the atoms into groups based on the shells, then record their velocities.
variable radius equal 11.23489 #for 0.125 force sphere radius
variable twiceRad equal "2*v_radius"
variable threeRad equal "3*v_radius"
variable fourRad equal "4*v_radius"
variable fiveRad equal "5*v_radius"
variable mid1Rad equal "2.01*v_radius"
variable mid2Rad equal "3.01*v_radius"
variable mid3Rad equal "4.01*v_radius"
region deltaTwo sphere v_liquidCenterX v_liquidCenterY v_liquidCenterZ v_twiceRad side out
region deltaThree sphere v_liquidCenterX v_liquidCenterY v_liquidCenterZ v_threeRad side out
region deltaFour sphere v_liquidCenterX v_liquidCenterY v_liquidCenterZ v_fourRad side out
region deltaFive sphere v_liquidCenterX v_liquidCenterY v_liquidCenterZ v_fiveRad side out
region mid1Sphere sphere v_liquidCenterX v_liquidCenterY v_liquidCenterZ v_mid1Rad side in
region mid2Sphere sphere v_liquidCenterX v_liquidCenterY v_liquidCenterZ v_mid2Rad side in
region mid3Sphere sphere v_liquidCenterX v_liquidCenterY v_liquidCenterZ v_mid3Rad side in
region innerSphere sphere v_liquidCenterX v_liquidCenterY v_liquidCenterZ v_radius
region intersectSphere1 union 2 deltaTwo innerSphere side out
region intersectSphere2 union 2 mid1Sphere deltaThree side out
region intersectSphere3 union 2 mid2Sphere deltaFour side out
region intersectSphere4 union 2 mid3Sphere deltaFive side out
group allTwo dynamic all region intersectSphere1 every 10
group allThree dynamic all region intersectSphere2 every 10
group allFour dynamic all region intersectSphere3 every 10
group allFive dynamic all region intersectSphere4 every 10
dump 26 allTwo custom 10000 dumpAllTwo.data id x y z vx vy vz
dump 326 allThree custom 10000 dumpAllThree.data id x y z vx vy vz
dump 426 allFour custom 10000 dumpAllFour.data id x y z vx vy vz
dump 526 allFive custom 10000 dumpAllFive.data id x y z vx vy vz
I am getting very strange and inconsistent results when trying to graph the shell versus the average x-velocity of atoms in it. Based on the physical conditions of the simulation, I would expect the velocity to grow more negative as the shell increases, but instead it will vary randomly.
Anyone have any ideas how to stop this?