Skip to content

Conversation

@marjanalbooyeh
Copy link
Collaborator

@marjanalbooyeh marjanalbooyeh commented May 2, 2024

This PR introduces a new Unit class to FlowerMD, which contains commonly used units from unyt package.

With this change, all values with units in FlowerMD are formatted as value * flower.Units.<unit>. For example, a temperature in Kelvin is 300 * flowermd.Units.K.

This PR also makes the following changes to the interface of run functions in Simulation class:

  • The variable kT is now temperature , which can handle both kT values (unitless) and temperature values with units.
  • The n_steps variable is now called duration, which can be both a number (number of steps) or time length with units.

ToDo:

  • Make same changes for pressure and add pressure units

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@marjanalbooyeh marjanalbooyeh marked this pull request as ready for review November 29, 2024 00:28
@marjanalbooyeh
Copy link
Collaborator Author

Couple of issues that we need to look into:

  • Build workflow fails due to some mamba env error. This happens only for Ubuntu. I couldn't pinpoint the error, it seems to be __glibc version.
  • Some tests are failing. In test_molecules.test_polymer_different_num_mol, looks like there's a key error with mbuild compound. this might be because of recent changes on mbuild side that we need to account for. I'll look into it more closely.
  • A new error has showed up in coarse graining tutorials when we want to visualize the coarse grained compounds in jupyter nb. It's coming from the Grits's CG_Compound.visualize() but once I narrowed it down, the error initiates from mbuild clone in method called by grits. This clone method doesn't copy all CG_Compound attributes including atomistic which causes error here.
  • We also need to discuss how we want to handle temperature ramps in simulation run functions. Right now, the assumption is that temperature is passed either as a float (i.e. kT) or a unit value (for example 200 * Units.k). But we also support Hoomd ramps that have two kT values in them. We need to manage the temperatures in the Ramp object similarly. My suggestion is to define a Ramp class for flowermd with similar methods for temperature check. Users can only use flowermd's Ramp if they want to use a ramp. Same argument with pressure ramps.

@codecov
Copy link

codecov bot commented Dec 24, 2024

Codecov Report

Attention: Patch coverage is 92.55814% with 16 lines in your changes missing coverage. Please review.

Project coverage is 95.04%. Comparing base (a600b73) to head (807fdea).
Report is 55 commits behind head on main.

Files with missing lines Patch % Lines
flowermd/base/simulation.py 87.71% 14 Missing ⚠️
flowermd/internal/utils.py 90.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #137      +/-   ##
==========================================
+ Coverage   94.77%   95.04%   +0.27%     
==========================================
  Files          26       27       +1     
  Lines        1970     2160     +190     
==========================================
+ Hits         1867     2053     +186     
- Misses        103      107       +4     
Files with missing lines Coverage Δ
flowermd/__init__.py 100.00% <100.00%> (ø)
flowermd/base/system.py 92.55% <100.00%> (+0.16%) ⬆️
flowermd/internal/__init__.py 100.00% <100.00%> (ø)
flowermd/internal/exceptions.py 89.74% <100.00%> (ø)
flowermd/internal/units.py 100.00% <100.00%> (ø)
flowermd/library/simulations/tensile.py 100.00% <100.00%> (ø)
...lowermd/modules/surface_wetting/surface_wetting.py 94.78% <100.00%> (+0.04%) ⬆️
flowermd/utils/utils.py 93.47% <100.00%> (+0.14%) ⬆️
flowermd/internal/utils.py 93.75% <90.00%> (-6.25%) ⬇️
flowermd/base/simulation.py 93.76% <87.71%> (+1.74%) ⬆️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add units to FlowerMD

2 participants