MolSSI / mmic_openff

Tactic MMIC translator for OpenFF/MMSchema
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Dynamic/static units #3

Open anabiman opened 3 years ago

anabiman commented 3 years ago

The mol and ff converters assume that any unit used for a particular variable in the OpenFF schema remains constant throughout. This assumption is made for the sake of code clarity and better performance. Also MMSchema does not support dynamic units for the same field. Should it?

Example:

>>> smirnoff_data["ProperTorsions"]["Proper"][0]["k1"]
    '0.1703506220295 * mole**-1 * kilocalorie'
>>> smirnoff_data["ProperTorsions"]["Proper"][-1]["k1"]
    '0.0 * mole**-1 * kilocalorie'

The converters extract the units for k1 in this case from smirnoff_data["ProperTorsions"]["Proper"][0] and assume it is the same for the [-1] entry.

j-wags commented 3 years ago

This isn't a safe assumption in the long run. While it will work for our current released FFs, the 0.3 SMIRNOFF spec explicitly requires units to be on each quantity to allow for this sort of flexibility.