Skip to content

Conversation

@marjanalbooyeh
Copy link
Collaborator

This pull request focuses on the initial implementation of machine learning models for coarse-graining simulations. The changes include adding new utility functions, creating a custom force class, defining a neural network model, and providing a tutorial notebook.

Changes:
Introduced IsotropicCustomForce in flowermd/library/ml_forces.py to integrate a PyTorch model with the simulation framework.

Defined LennardJonesNeighborModel and its configuration in flowermd/modules/coarse_graining_ML/isotropic_coarse_graining.py for predicting forces based on neighbor distances.

Added functions adjust_periodic_boundary, find_neighbors, and neighbors_dr to flowermd/internal/box_neighbors_utils.py for handling periodic boundary conditions and neighbor calculations.

Added a new Jupyter notebook tutorials/6-flowermd-ML-coarse-graining.ipynb to demonstrate the usage of the pre-trained machine learning model for coarse-graining simulations.

Note: I'll wait for the units PR to be merged before merging this one.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@chrisjonesBSU
Copy link
Member

Since we probably don't want to add pytorch as a hard depdency, anywhere we import we should check if it's installed and give an error message if it's not. Maybe it says something like

You need to have pytorch installed to use this functionality. You can install it with conda or mamba using mamba install -c conda-forge pytorch

@codecov
Copy link

codecov bot commented Dec 24, 2024

Codecov Report

Attention: Patch coverage is 79.62963% with 55 lines in your changes missing coverage. Please review.

Project coverage is 93.40%. Comparing base (a600b73) to head (8b312c5).
Report is 49 commits behind head on main.

Files with missing lines Patch % Lines
flowermd/library/ml_forces.py 27.58% 21 Missing ⚠️
flowermd/internal/box_neighbors_utils.py 25.00% 18 Missing ⚠️
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     #178      +/-   ##
==========================================
- Coverage   94.77%   93.40%   -1.37%     
==========================================
  Files          26       29       +3     
  Lines        1970     2213     +243     
==========================================
+ Hits         1867     2067     +200     
- Misses        103      146      +43     
Files with missing lines Coverage Δ
flowermd/__init__.py 100.00% <100.00%> (ø)
flowermd/base/system.py 92.52% <100.00%> (+0.13%) ⬆️
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/__init__.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%) ⬇️
... and 3 more

@marjanalbooyeh
Copy link
Collaborator Author

Since we probably don't want to add pytorch as a hard depdency, anywhere we import we should check if it's installed and give an error message if it's not. Maybe it says something like

You need to have pytorch installed to use this functionality. You can install it with conda or mamba using mamba install -c conda-forge pytorch

Yeah I agree. I'll add that condition.

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.

2 participants