Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit class to FlowerMD and allow using real units in Simulation runs #137

Open
wants to merge 54 commits into
base: main
Choose a base branch
from

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

@marjanalbooyeh marjanalbooyeh linked an issue May 2, 2024 that may be closed by this pull request
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.

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