-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add delete_atoms method and use bonding info for add_hatoms SO107 #178
base: trunk
Are you sure you want to change the base?
Conversation
mol/molecule.py
Outdated
@@ -3354,6 +3374,8 @@ def add_hatoms(self) -> "Molecule": | |||
) | |||
p.communicate() | |||
retmol = self.__class__(f_out.name) | |||
if any(self.bonds): | |||
retmol.guess_bonds() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not understand why we should guess bonds by default. I would remove this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously the behaviour was that if you do add_hatoms
to a molecule that already has bonds, the result will have no bonds at all, as it recreates a molecule from an xyz. This change means that if the previous molecule has bonds, it will guess them. But I can remove it if you think it is unexpected here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah true it makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have found a way to get the bonding information out of amsprep
, so have used this instead of guess bonds
f83dda7
to
995b199
Compare
995b199
to
384a7dd
Compare
Description
Two small changes to
Molecule
:delete_atoms
: add a method to delete multiple atoms in a single call. This uses "partial success" so that all passed atoms will attempted to be deleted, even if one of them fails.add_hatoms
: use a.in
file to amsprep instead of a.xyz
so bonding information is respected when adding h-atoms. Also perform a guess bonds on the output, if there were bonds on the original molecule.