orionarcher / pymatgen-io-openmm

A Pymatgen IO module for setting up OpenMM simulations.
11 stars 5 forks source link

handle charge assignment for single atom residues #7

Closed rkingsbury closed 2 years ago

rkingsbury commented 2 years ago

The built-in charge assignment methods like am1bcc fail in the case of a single-atom residue like a dissolved ion. This PR adds a fix to assign_charges_to_mols to catch such a case, and assign the total_charge on the atom to the partial_charges attribute.

rkingsbury commented 2 years ago

@orionarcher I've added a test for this now. In the course of doing that, I noticed that charge scaling doesn't work for the single atom. Right now I have a workaround in the test so that it will pass anyway, but before merging it would be good to track down why the charge scaling isn't being applied. Can you provide any guidance there?

orionarcher commented 2 years ago

You had practically solve the issue but you missed actually multiplying the single ion charge by the charge scaling factor :)

Merging now!