How to estimate the pressure tensor in HPMC simulation?

20 views
Skip to first unread message

zhang...@gmail.com

unread,
May 13, 2025, 12:18:09 AMMay 13
to hoomd-users
Dear all,

I am currently performing HPMC simulations of a system containing 1,000 hard spheres in the NVT ensemble. My goal is to estimate the pressure tensor components (e.g., pressure_zz). When using hoomd.compute.thermo() to compute the pressure tensor, the output values remain zero. I expected non-zero values given the finite particle density and interactions. I have included my simulation script below for reference:

import hoomd
import hoomd.hpmc
import hoomd.md

hoomd.context.initialize()
hoomd.init.create_lattice(unitcell=hoomd.lattice.sc(a=2.0, type_name='A'), n=10)
all = hoomd.group.all();
mc = hoomd.hpmc.integrate.sphere(seed=1)
mc.shape_param.set('A', diameter=1.0)
g = hoomd.group.type(name='typeA', type='A')
my_thermo=hoomd.compute.thermo(group=g)
logger=hoomd.analyze.log(filename='mylog.log', quantities=['pressure_zz_typeA'], period=1000, overwrite=True,header_prefix='#');
hoomd.run(1e6)

Any suggestions would be appreciated. 

Best regards,

Yunhan

Reply all
Reply to author
Forward
0 new messages