Fix rigid/small manually update COM velocities

Dear LAMMPS users,

I am working on a hybrid MD/MC algorithm that involves rigid bodies by using a python wrapper script. Each monte carlo step requires reinitialization of velocities (for the case of rigid bodies, 3 linear and 3 angular center of mass (COM) velocities should be drawn from Maxwell-Boltzmann distribution.)

Upon examination of the source code and the relevant paper describing the algorithm (Miller), I found that Lammps calculates the COM positions, rotations and velocities from the initial particle positions and velocities at the start of the first run after the fix is defined, then the rotations and angular momenta are updated internally. For my case, I want to be able to update these internal COM linear and angular velocities directly at the start of each monte carlo step.

I was wondering if there is a way to manually alter the COM velocities of each body using the python library interface. I checked the previous relevant threads in the e-mail list, but could not find an answer to my specific question. I know that some per-atom properties can be manually updated using the scatter_atoms command, but not sure if this can be applied to per-body properties.

Any input would be greatly appreciated.


to do what you are asking for, you would have to first do some C++ programming to make the internal data structures accessible, then extend the C library interface to support accessing and updating them and finally update the python wrapper to support the newly added functionality.

it may be easier to just unfix and fix the rigid/small fix and re-initialize the velocities in between.


Dear Axel,

Thanks for your reply. I agree that unfixing and fixing rigid/small will be easier, but sadly it will not be efficient since I will have to do the moment of inertia and axes of rotation computations manually to get the velocities, then the same computations will be done by the rigid fix again. However, this seems like the only way to do what I want without a lot of programming.