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

Speed up json loader #1163

Merged
merged 7 commits into from
Feb 5, 2024
Merged

Conversation

daico007
Copy link
Member

PR Summary:

Address #1162. Add some workaround to the ind particle bond graph before adding to the main compound and speed up the loader in general.

import mbuild as mb#
eth = mb.load("CC", smiles=True)
eth.name = "Ethane"
eth_box = mb.packing.fill_box(
    compound=eth,
    n_compounds=1000,
    box=[5, 5, 5]
)
eth_box.name = "EthaneBox"
eth_box.save("eth_box1000.json", overwrite=True)

comp = mb.load("eth_box1000.json") # This now takes a few second. 

PR Checklist


  • Includes appropriate unit test(s)
  • Appropriate docstring(s) are added/updated
  • Code is (approximately) PEP8 compliant
  • Issue(s) raised/addressed?

Copy link

codecov bot commented Dec 15, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9d20e3d) 87.18% compared to head (0908345) 87.27%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1163      +/-   ##
==========================================
+ Coverage   87.18%   87.27%   +0.09%     
==========================================
  Files          62       62              
  Lines        6492     6499       +7     
==========================================
+ Hits         5660     5672      +12     
+ Misses        832      827       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@CalCraven CalCraven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I this exact change looks fine. I would modify the Compound.save function to go along with this though. The argument "include_port" doesn't make a lot of sense to me while saving. I think the argument should be changed to include_port.

My suggestion is here, and includes changing the default behavior.

        include_ports : bool, optional, default=True
            When saving out with .json extension, be sure to include any `Compound.ports`

@daico007 daico007 merged commit f50fb61 into mosdef-hub:main Feb 5, 2024
15 checks passed
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