mbuild icon indicating copy to clipboard operation
mbuild copied to clipboard

Rigid Bodies By Index

Open mikemhenry opened this issue 7 years ago • 1 comments

So far I've found rigid bodies to work quite well, assuming that I want the entire compound to be a rigid body. Is there a way to created a rigid body by index with in a mBuild compound? Something like: self.label_rigid_bodies(rigid_particles=[self[6], self[7], self[8], self[9], self[10]])

Something else to consider would be to create rigid bodies by SMARTS strings:

>>> import mbuild as mb
>>> from mbuild.utils.io import get_fn
>>> benzene = mb.load(get_fn('benzene.mol2'))
>>> benzene.name = 'Benzene'
>>> filled = mb.fill_box(benzene,
...                      n_compounds=10,
...                      box=[0, 0, 0, 4, 4, 4])
>>> filled.label_rigid_bodies(distinct_bodies='Benzene',
...                           rigid_particles_by_smarts='c12ccccc1cccc2')

This would help to automate creation of rigid body motifs.

mikemhenry avatar Mar 29 '17 16:03 mikemhenry

There isn't currently a way to specify particles in rigid bodies by index, but that is something that would probably be good to add. I see where the current functionality could become a problem if, for example, you had a benzene ring with a carbon chain coming off of it and wanted to only treat the carbons in the ring as a rigid body. In that case if rigid_particles='C' was passed to label_rigid_bodies, the carbons in the chain would get included in the rigid body as well. Having a rigid_indices argument or something of that sort could fix this.

Labelling rigid bodies by SMARTS would be cool as well. I think a method for creating Compounds from SMARTS is in the works right now, so presumably once that gets merged Compounds could be created that way and provided with labels that are passed to label_rigid_bodies via discrete_bodies. Not exactly as straightforward as passing the SMARTS to label_rigid_bodies directly however.

summeraz avatar Mar 29 '17 16:03 summeraz

This is probably a bit outdated with the new HOOMD release + probably more relevant for GMSO

daico007 avatar Apr 04 '24 02:04 daico007