mosdef-hub / gmso

Flexible storage of chemical topology for molecular simulation
https://gmso.mosdef.org
MIT License
53 stars 32 forks source link

Sorting of improper types #796

Closed CalCraven closed 6 months ago

CalCraven commented 6 months ago

Recently, some utilities have been added to gmso/utils/sorting.py. These helped to write out or reorder improper types in the forcefield in a way that was consistent. However, the improper sorting was allowing for the following conditions.

i, j, k, l == i, sorted(k, l, j)

In reality, we need to use the following equivalence:

i, j, k, l == i, sorted(k, l), j

This is because it matters in the improper which atom is considered as the last atom in the list, since the angle from the improper is the angle between planes i,j,k and j,k,l. So only j and k are interchangeable.

Now technically i and l are interchangeable as well, but for the sake of consistency we are defining that the central atom always must go first, so I believe it is useful to stay consistent and leave i and l in their positions, even if mathematically they're equivalent.

codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (bde9f1b) 92.39% compared to head (d1bd61c) 92.39%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #796 +/- ## ======================================= Coverage 92.39% 92.39% ======================================= Files 66 66 Lines 6860 6860 ======================================= Hits 6338 6338 Misses 522 522 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.