mattwthompson / scattering

Functions for analyzing molecular simulations according to scattering experiments
MIT License
9 stars 9 forks source link

Refactor form factor functions to handle solutions with water when `water=True` #31

Open rmatsum836 opened 3 years ago

rmatsum836 commented 3 years ago

I'm running into an issue with solutions of water and ions. I am wanting to use the specific form factors for water using the argument water=True. However, an error occurs when trying to get a form factor for a non-water element when water=True. To handle this, I moved the element conditionals in get_water_form_factor to get_form_factor. If water=True AND the element has the atomic number of O or H, the get_water_form_factor will get called. However, if the atomic number does not match that of O or H, then a warning gets raise and the atomic form factor is returned as the atomic number. Tests have also been added to check this behavior.