Open vymetal opened 3 months ago
@ijpulidos @yuanqing-wang Thoughts?
This doesn't seem to be an issue when using the openff-toolkit to charge, if that is a work-around or indicates where the issue might be coming from
from espaloma_charge import charge
from rdkit import Chem
from openff.toolkit.topology import Molecule
from rdkit import Chem
from rdkit.Chem import AllChem
from espaloma_charge.openff_wrapper import EspalomaChargeToolkitWrapper
toolkit_registry = EspalomaChargeToolkitWrapper()
smiles = "[NH4+]"
molecule = Molecule.from_smiles(smiles)
molecule.assign_partial_charges('espaloma-am1bcc', toolkit_registry=toolkit_registry)
espaloma_charges = molecule.partial_charges
print(espaloma_charges)
print(sum(molecule.partial_charges))
mol=Chem.MolFromSmiles(smiles)
mol=Chem.AddHs(mol)
tc=Chem.GetFormalCharge(mol)
print(tc);
print([atom.GetFormalCharge() for atom in mol.GetAtoms()])
c=charge(mol,total_charge=tc)
print(c)
print(sum(c))
This is an issue that we've fixed a while ago. Could you try pulling from the source again?
Dear developers, I tried to calculate charge distribution of positively charged molecules using espaloma charge v 0.0.8 from pip distribution, but the resulting partial atomic charges always sum to 0.0. The following piece of code demonstrates the behavior
The corresponding output is
Is it a bug or I just missinterpreted the output?
Thank you
Jiri