mdanalysis icon indicating copy to clipboard operation
mdanalysis copied to clipboard

changing DL_Poly units

Open lexi-x opened this issue 1 year ago • 10 comments

Fixes #2393

Changes made in this Pull Request:

  • Added unit conversion to DL_Poly
  • ~~Removed forces from TRZ~~
  • Updated test values for DL_Poly

As mentioned in #2393, this likely requires more work with test cases and code modifications regarding where the DL_Poly conversions are made, so any feedback is appreciated!

PR Checklist

  • [x] Issue raised/referenced?
  • [x] Tests updated/added?
  • [ ] Documentation updated/added?
  • [ ] package/CHANGELOG file updated?
  • [ ] Is your name in package/AUTHORS? (If it is not, add it!)

Developers Certificate of Origin

I certify that I can submit this code contribution as described in the Developer Certificate of Origin, under the MDAnalysis LICENSE.


📚 Documentation preview 📚: https://mdanalysis--4983.org.readthedocs.build/en/4983/

lexi-x avatar Mar 20 '25 01:03 lexi-x

Codecov Report

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

Project coverage is 93.41%. Comparing base (dcaa087) to head (a267752). Report is 20 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4983      +/-   ##
===========================================
- Coverage    93.42%   93.41%   -0.02%     
===========================================
  Files          177      189      +12     
  Lines        21859    22925    +1066     
  Branches      3078     3078              
===========================================
+ Hits         20422    21415     +993     
- Misses         986     1059      +73     
  Partials       451      451              

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

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Mar 21 '25 03:03 codecov[bot]

Based on feedback about TRZ being dropped, I removed the parts regarding TRZ in the latest commit.

lexi-x avatar Mar 21 '25 04:03 lexi-x

@cbouy and @talagayev could you please review and shepherd this PR? This is a GSOC applicant for one of your projects.

orbeckst avatar Mar 30 '25 00:03 orbeckst

@orbeckst @cbouy Thank you for your recommendations! Sorry for the delayed response, I was caught up in making the proposal and another pull request. I made the changes you recommended and I wanted to make sure that my thought process was valid in implementing them before making commits.

  1. After changing the DL_POLY force units to Da*Angstrom/ps, I added the conversion factor to units.py based on my understanding of the unit conversions:
forceUnit_factor = {
    "kJ/(mol*Angstrom)": 1.0,
    "kJ/(mol*A)": 1.0,
    "kJ/(mol*\u212b)": 1.0,
    "kJ/(mol*nm)": 10.0,
    "Newton": 1e13 / constants["N_Avogadro"],
    "N": 1e13 / constants["N_Avogadro"],
    "J/m": 1e13 / constants["N_Avogadro"],
    "kcal/(mol*Angstrom)": 1 / constants["calorie"],
    "Da*Angstrom/ps": 1000.0 / constants["N_Avogadro"] / 1e10 * 1e12
} 
  1. Regarding making the same unit conversions for History Reader, when I originally added the conversion to both functions, the test cases returned results that were scaled by 10000 instead of 100, so I suspect it was making double conversions. Would this still be an issue when using native force units instead of direct conversion? Thank you!

lexi-x avatar Apr 03 '25 20:04 lexi-x

@lexi-x if all conversions are done in the standard way then there shouldn't be any double conversions. Try it and make the tests pass.

orbeckst avatar Apr 11 '25 06:04 orbeckst

Explain to us why what you're doing is correct — that's the best way to be sure that you're right and makes it easy for us to review.

orbeckst avatar Apr 11 '25 06:04 orbeckst

@lexi-x do you have some time to complete the PR? Would be great to get it done.

orbeckst avatar Jun 12 '25 16:06 orbeckst

@lexi-x do you think you'll continue on the PR?

orbeckst avatar Jun 26 '25 20:06 orbeckst

@lexi-x do you think you'll continue on the PR?

Yes sorry, I have been a bit busy lately but I'm making the edits right now.

lexi-x avatar Jun 27 '25 20:06 lexi-x

@lexi-x do you have some time to complete the PR? Would be great to get it done.

I added the unit conversions and modified the tests accordingly, let me know if anything needs to be changed. Thanks!

lexi-x avatar Aug 10 '25 21:08 lexi-x