root_atom = atom.GetNeighbors()[0]
if root_atom.HasProp("_GasteigerHCharge"):
charge = float(root_atom.GetProp("_GasteigerHCharge"))
if charge is None:
raise ValueError("No charge information")
if isnan(charge) or isinf(charge): // FIXME: this should not happen, blame RDKit
charge = 0.
pdbqt_line += ("%.3f" % charge).rjust(6)
// Get atom type
// TODO: do proper atom typing here
pdbqt_line += " "
atomicnum = atom.GetAtomicNum()
if atomicnum == 6:
if atom.GetIsAromatic():
pdbqt_line += "A"
else:
pdbqt_line += "C"
elif atomicnum == 7 and idx in acceptors:
pdbqt_line += "NA"
elif atomicnum == 8 and idx in acceptors:
pdbqt_line += "OA"
After Change
if atom.HasProp("_GasteigerCharge"):
charge = float(atom.GetProp("_GasteigerCharge"))
if atom.HasProp("_TriposPartialCharge"):
charge = float(atom.GetProp("_TriposPartialCharge"))
elif atom.GetAtomicNum() == 1:
root_atom = atom.GetNeighbors()[0]
if root_atom.HasProp("_GasteigerHCharge"):
charge = float(root_atom.GetProp("_GasteigerHCharge"))