-
Notifications
You must be signed in to change notification settings - Fork 875
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 pymatgen.io.openff
module
#3729
Changes from 48 commits
f52a8df
d360549
d1a9ace
7328391
b9b36b9
c173c71
8f5090f
2902ea4
d1b7d43
1a2afe4
8660c1b
8eb6b4c
e08161f
09f1e34
de88ef8
8a7d9c0
8b5528b
f95e2d5
305945c
8cf2cc4
1a5ebf2
25f44e9
d937bca
dc06e5d
186e365
b243e2a
3b88415
0b7b6eb
b200a78
49bb35f
859e83d
fe1a85a
45810d8
25dbd7e
040e701
a9bad6b
cf2df32
930c801
4802525
ba19c29
7c26ddf
e07eb56
39fe79e
347008e
220af2f
005f610
93406b8
c837d78
7389f30
db4e324
30be59a
e023eec
1410a2e
a3e9c17
780394d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -70,7 +70,7 @@ def __init__(self, mol: Molecule | openbabel.OBMol | pybel.Molecule) -> None: | |||||||||||||||||||
ob_atom = openbabel.OBAtom() | ||||||||||||||||||||
ob_atom.thisown = 0 | ||||||||||||||||||||
ob_atom.SetAtomicNum(atom_no) | ||||||||||||||||||||
ob_atom.SetVector(*coords) | ||||||||||||||||||||
ob_atom.SetVector(*map(float, coords)) | ||||||||||||||||||||
ob_mol.AddAtom(ob_atom) | ||||||||||||||||||||
del ob_atom | ||||||||||||||||||||
ob_mol.ConnectTheDots() | ||||||||||||||||||||
|
@@ -182,14 +182,14 @@ def rotor_conformer(self, *rotor_args, algo: str = "WeightedRotorSearch", forcef | |||||||||||||||||||
else: | ||||||||||||||||||||
self.add_hydrogen() | ||||||||||||||||||||
|
||||||||||||||||||||
ff = openbabel.OBForceField_FindType(forcefield) | ||||||||||||||||||||
ff = openbabel.OBForceField.FindType(forcefield) | ||||||||||||||||||||
if ff == 0: | ||||||||||||||||||||
warnings.warn( | ||||||||||||||||||||
f"This input {forcefield=} is not supported " | ||||||||||||||||||||
"in openbabel. The forcefield will be reset as " | ||||||||||||||||||||
"default 'mmff94' for now." | ||||||||||||||||||||
) | ||||||||||||||||||||
ff = openbabel.OBForceField_FindType("mmff94") | ||||||||||||||||||||
ff = openbabel.OBForceField.FindType("mmff94") | ||||||||||||||||||||
|
||||||||||||||||||||
try: | ||||||||||||||||||||
rotor_search = getattr(ff, algo) | ||||||||||||||||||||
|
@@ -264,10 +264,10 @@ def confab_conformers( | |||||||||||||||||||
else: | ||||||||||||||||||||
self.add_hydrogen() | ||||||||||||||||||||
|
||||||||||||||||||||
ff = openbabel.OBForceField_FindType(forcefield) | ||||||||||||||||||||
ff = openbabel.OBForceField.FindType(forcefield) | ||||||||||||||||||||
if ff == 0: | ||||||||||||||||||||
print(f"Could not find {forcefield=} in openbabel, the forcefield will be reset as default 'mmff94'") | ||||||||||||||||||||
ff = openbabel.OBForceField_FindType("mmff94") | ||||||||||||||||||||
ff = openbabel.OBForceField.FindType("mmff94") | ||||||||||||||||||||
Comment on lines
+267
to
+270
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace the print statement with a warning to maintain consistency and provide users with better control over error messages. - print(f"Could not find {forcefield=} in openbabel, the forcefield will be reset as default 'mmff94'")
+ warnings.warn(f"Could not find {forcefield=} in openbabel, the forcefield will be reset as default 'mmff94'") Committable suggestion
Suggested change
|
||||||||||||||||||||
|
||||||||||||||||||||
if freeze_atoms: | ||||||||||||||||||||
print(f"{len(freeze_atoms)} atoms will be freezed") | ||||||||||||||||||||
|
@@ -346,8 +346,8 @@ def from_molecule_graph(cls, mol: MoleculeGraph) -> Self: | |||||||||||||||||||
""" | ||||||||||||||||||||
return cls(mol.molecule) | ||||||||||||||||||||
|
||||||||||||||||||||
@needs_openbabel | ||||||||||||||||||||
@classmethod | ||||||||||||||||||||
@needs_openbabel | ||||||||||||||||||||
def from_str(cls, string_data: str, file_format: str = "xyz") -> Self: | ||||||||||||||||||||
""" | ||||||||||||||||||||
Uses OpenBabel to read a molecule from a string in all supported | ||||||||||||||||||||
|
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.
Consider pinning the versions of
enumlib
,packmol
,bader
,openbabel
, andopenff-toolkit
to ensure reproducibility and stability in your CI/CD pipeline.Committable suggestion