mosdef-hub / mbuild

A hierarchical, component based molecule builder
https://mbuild.mosdef.org
Other
173 stars 81 forks source link

What is the proper way to add a non-elemental particle to a system? #796

Closed oakif closed 3 years ago

oakif commented 4 years ago

I'm trying to add a non-elemental particle to my system using mb.Particle(name='Z1', charge=1). However, it seems like mbuild isn't liking this all that much:

/home/oakif/.conda/envs/hoomd-tf/lib/python3.6/site-packages/mbuild/compound.py:2412: UserWarning: Guessing that "<_Z1 pos=( 0.5566, 0.1048, 0.3061), 0 bonds, id: 47275562201776>" is element: "EP"
  atom, element))

What's the proper way to do this? I tried adding an underscore _ (I think that was the proper way to add a non-elemental particle) but that didn't work either—I still get the error. Normally I'd ignore this but this shows up when I view the file in OVITO:

image

So the charges seem to be incorrectly scaled as well, and I guess that has something to do with the "EP" element guessing?

rsdefever commented 4 years ago

@oakif what version of mbuild are you using? The EP is a parmed thing -- its the parmed way of storing anything that is not an element. Off the top of my head I'm not sure how its related to the charge scaling. I can't trace down that exact line in the current version of mbuild though, so it's a bit hard to say exactly what is going on.

justinGilmer commented 4 years ago

Hey @oakif , adding an underscore _ to the beginning of your particle name is the correct way to handle this in mBuild.

I will also note that the message being presented to you is a warning not an error, this is more a way to inform the user that these particles are being treated as non-elemental atoms. Do you have the charges set correctly in your forcefield file? That is, if you are parametrizing the system using foyer and a foyer XML file.