Skip to content
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

Fix charge parsing #117

Merged
merged 2 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion meeko/molecule_pdbqt.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def _read_ligand_pdbqt_file(pdbqt_string, poses_to_read=-1, energy_range=-1, is_
xyz = np.array([line[30:38].strip(), line[38:46].strip(), line[46:54].strip()], dtype=float)
try:
# PDBQT files from dry.py script are stripped from their partial charges. sigh...
partial_charges = float(line[71:77].strip())
partial_charges = float(line[70:76].strip())
except:
partial_charges = 0.0
atom_type = line[77:-1].strip()
Expand Down
4 changes: 4 additions & 0 deletions test/rdkitmol_from_docking_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from meeko import MoleculePreparation
from meeko import PDBQTWriterLegacy
from rdkit import Chem
import numpy as np
import pathlib
import json
import io
Expand Down Expand Up @@ -108,6 +109,9 @@ def test_small_04(): run("small-04.sdf", wet=True)
def test_meeko_free_energy_prop_vina():
fpath = datadir/ "vina-result-ethanol.pdbqt"
pdbqt_mol = PDBQTMolecule.from_file(fpath)
ref_charges = [0.034, 0.152, -0.397, 0.21]
tolerance = 0.01
assert np.all(np.abs(pdbqt_mol.atoms()["partial_charges"] - ref_charges) < tolerance)
sd_string, failures = RDKitMolCreate.write_sd_string(pdbqt_mol)
assert len(failures) == 0
sio = io.BytesIO(sd_string.encode())
Expand Down
Loading