Closed taidbui closed 1 year ago
Nice find.
Since that particular line is just used to load the coordinates, I wonder if we could use another tool like MDTraj in an except:
block.
This diff appears to fix your MRE:
diff --git a/openff/interchange/components/_packmol.py b/openff/interchange/components/_packmol.py
index 578b6594..0fea45ad 100644
--- a/openff/interchange/components/_packmol.py
+++ b/openff/interchange/components/_packmol.py
@@ -707,15 +707,21 @@ def pack_box(
if not packmol_succeeded:
raise PACKMOLRuntimeError(result)
- # Load the coordinates from the PDB file with RDKit (because its already
- # a dependency)
- rdmol = rdkit.Chem.rdmolfiles.MolFromPDBFile(
- output_file_path,
- sanitize=False,
- removeHs=False,
- proximityBonding=False,
- )
- positions = rdmol.GetConformers()[0].GetPositions()
+ try:
+ # Load the coordinates from the PDB file with RDKit (because its already
+ # a dependency)
+ rdmol = rdkit.Chem.rdmolfiles.MolFromPDBFile(
+ output_file_path,
+ sanitize=False,
+ removeHs=False,
+ proximityBonding=False,
+ )
+
+ positions = rdmol.GetConformers()[0].GetPositions()
+ except AttributeError:
+ import mdtraj
+
+ positions = mdtraj.load(output_file_path).xyz[0] * 0.1
# TODO: This currently does not run if we encountered an error in the
# context manager
Great, thanks. This works.
Thanks, this should land in the next release (probably 0.3.14).
Description
When there are more than 99999 atoms in a system, the pdb output from packmol will have the second column containing Non-integer serial number. This leads to an issue with extracting positions from the pdb file later on using rdkit.Chem.rdmolfiles.MolFromPDBFile.
Reproduction
Output
Software versions
conda list
?