choderalab / saltswap

Package to fluctuate the number of counterions in an OpenMM simulation
MIT License
6 stars 3 forks source link

Bug in update_fractional_ion #25

Closed bas-rustenburg closed 6 years ago

bas-rustenburg commented 6 years ago
        atm_index = 0
        for atom in molecule:
>           charge = (1 - fraction) * initial_force[atm_index]["charge"] + fraction * final_force["charge"]
E           TypeError: list indices must be integers or slices, not str /home/rustenburg/miniconda3/lib/python3.6/site-packages/saltswap/swapper.py:811 

My guess is that it should be final_force[atm_index]["charge"] instead of final_force["charge"]. Will put in a PR with fix in a minute, and a unit test for this function to capture any other errors with this feature.

gregoryross commented 6 years ago

You're absolutely correct @bas-rustenburg, your suggestion should fix it. Thanks a lot for going ahead with the PR and unit test.