variable nbins index 3
variable fraction equal 1.0/v_nbins
compute cchunk all chunk/atom bin/1d x lower ${fraction} units reduced
compute stress all stress/atom NULL
variable press atom -(c_stress[1]+c_stress[2]+c_stress[3])/(3.0*vol*${fraction})
compute binpress all reduce/chunk cchunk sum v_press
fix avg all ave/time 1 100 100 c_binpress mode vector file ave_stress.txt
region H2O block 20 40 INF INF INF INF units box
compute 1 all reduce/region H2O sum c_stress[1] c_stress[2] c_stress[3]
variable press2 equal -(c_1[1]+c_1[2]+c_1[3])/(3*20*20*20)
fix 2 all ave/time 1 100 100 v_press2 file stress2.txt
---------- End -----------
报名一对一培训课程可领完整版《lammps中文教程》,配套学习更轻松!
扫码领取粉丝专属优惠券↓↓↓