MPI Differences with Rotational Degrees of Freedom in ALJ #2076
-
Hello, I am working on a cubes system using ALJ without thermostat in HOOMD 5.2.0. The codes in import os
import numpy as np
import hoomd
cpu = hoomd.device.CPU()
simulation = hoomd.Simulation(device=cpu, seed=0)
simulation.create_state_from_gsd(filename='lattice.gsd')
simulation.state.replicate(2, 2, 2)
integrator = hoomd.md.Integrator(dt=1.0E-4, integrate_rotational_dof=True)
cell = hoomd.md.nlist.Cell(buffer=0.4)
alj = hoomd.md.pair.aniso.ALJ(nlist=cell, default_r_cut=2.5)
alj.params[('cube', 'cube')] = dict(
epsilon=1,
sigma_i=2,
sigma_j=2,
alpha=3
)
alj.r_cut[('cube', 'cube')] = 2.5
vertices = [
(0.5, 0.5, 0.5),
(0.5, -0.5, 0.5),
(-0.5, -0.5, 0.5),
(-0.5, 0.5, 0.5),
(0.5, 0.5, -0.5),
(0.5, -0.5, -0.5),
(-0.5, -0.5, -0.5),
(-0.5, 0.5, -0.5),
]
faces = [
(2, 1, 0),
(0, 3, 2),
(5, 6, 4),
(4, 6, 7),
(1, 2, 5),
(5, 2, 6),
(4, 7, 3),
(3, 0, 4),
(0, 1, 5),
(5, 4, 0),
(3, 7, 6),
(6, 2, 3)
]
alj.shape['cube'] = dict(
vertices=vertices,
rounding_radii=(0.15, 0.15, 0.15),
faces=faces
)
integrator.forces.append(alj)
nvt = hoomd.md.methods.ConstantVolume(
filter=hoomd.filter.All(),
thermostat=None
)
integrator.methods.append(nvt)
simulation.operations.integrator = integrator
thermodynamic_properties = hoomd.md.compute.ThermodynamicQuantities(
filter=hoomd.filter.All()
)
simulation.operations.computes.append(thermodynamic_properties)
logger = hoomd.logging.Logger()
logger.add(
thermodynamic_properties,
quantities=[
'kinetic_temperature',
'kinetic_energy',
'translational_kinetic_energy',
'rotational_kinetic_energy',
'potential_energy'
]
)
logger.add(alj, quantities=['type_shapes', 'energies', 'forces', 'torques'])
gsd_writer = hoomd.write.GSD(
filename='trajectoryCubes.gsd',
trigger=hoomd.trigger.Periodic(100),
mode='xb',
filter=hoomd.filter.All(),
dynamic=['property', 'momentum', 'attribute'],
logger=logger
)
simulation.operations.writers.append(gsd_writer)
simulation.run(2.0E4)
gsd_writer.flush()
print(thermodynamic_properties.kinetic_energy) When I ran the simulation with different MPI process counts:
The results differ depending on the number of MPI processes. However, when I set This leads me to suspect that MPI might not properly handle the rotational degrees of freedom in ALJ, but it could also be due to incorrect settings on my part. Any comments or suggestions would be greatly appreciated. Attached are Thank you, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Your r_cut is too small, leading to the evaluation of discontinuous forces that destabilize the integrator. See the "Choosing r_cut" section in the documentation: https://hoomd-blue.readthedocs.io/en/v5.2.0/hoomd/md/pair/aniso/alj.html . Also, you should not use |
Beta Was this translation helpful? Give feedback.
If you want the highest accuracy for simulations of shapes, use HPMC: https://hoomd-blue.readthedocs.io/en/v5.2.0/hoomd/hpmc/integrate/convexspheropolyhedron.html . HPMC will also perform much faster than ALJ with very small
dt
values. Read on to learn about some of the difficulties with ALJ.You should not expect identical trajectories. MD simulations are chaotic. Even a single bit changed in one of the force calculations will cause an exponential divergence in the following trajectory. When you change the number of ranks, you change the order in which forces are summed which causes the net force to be rounded differently. If using the GPU, simulations even on a single GPU will not be id…