duartegroup / autodE

automated reaction profile generation
https://duartegroup.github.io/autodE/
MIT License
171 stars 52 forks source link

Division and multiplication of `autode.values.Value` creates wrong units #241

Closed t-young31 closed 1 year ago

t-young31 commented 1 year ago

Describe the bug

Multiplication and division do not generate autode.values with the correct units. As a simple fix multiplication could return a float, given it's (potentially) an uncommon occurrence.

To Reproduce

>>> import autode as ade
>>> e = ade.values.PotentialEnergy(1)
>>> e
Energy(1.0 Ha)
>>> e * e
Energy(1.0 Ha)
>>> e / e
Energy(1.0 Ha)
>>> # Addition and subtraction are okay
>>> e + e
Energy(2.0 Ha)
>>> e - e
Energy(0.0 Ha)

Expected behavior

Division results in no units and multiplication Ha^2

Environment