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

Improve performance of from_mbuild #470

Merged
merged 4 commits into from
Oct 29, 2020
Merged

Conversation

uppittu11
Copy link
Member

The from_mbuild conversion is very costly. As per previous discussions, we hypothesized that this was because we are repeatedly and unnecessarily running update_types/update_connections/etc. commands which loop through every atom (O(N^2) complexity). Here I'm trying to reduce the number of calls to cut down the time it takes to convert from mbuild by applying the update_types=False flag when adding sites and connections. As of this first commit, here are the performance gains for from_mbuild conversions for boxes of tip3p water.

image

@codecov
Copy link

codecov bot commented Oct 8, 2020

Codecov Report

Merging #470 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #470   +/-   ##
=======================================
  Coverage   88.96%   88.96%           
=======================================
  Files          46       46           
  Lines        3027     3028    +1     
=======================================
+ Hits         2693     2694    +1     
  Misses        334      334           
Impacted Files Coverage Δ
gmso/core/subtopology.py 90.47% <100.00%> (ø)
gmso/core/topology.py 96.72% <100.00%> (+0.02%) ⬆️
gmso/external/convert_mbuild.py 98.76% <100.00%> (-0.02%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 78a3114...a05d9a6. Read the comment docs.

Copy link
Member

@daico007 daico007 left a comment

Choose a reason for hiding this comment

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

LGTM! Only some nitpicking with the docstring.

Comment on lines +81 to +82
is an gmso.AtomType associated with the site and
it to the sub-topology's AtomTypes collection.
Copy link
Member

Choose a reason for hiding this comment

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

I think you miss a word here. Is it supposed to be ... the site and add it to the sub-...


Parameters
----------
site : gmso.Atom
The site to be added to this sub-topology
update_types : (bool), default=True
Copy link
Member

Choose a reason for hiding this comment

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

This is just nitpicking, but can you remove the parentheses (so just update_types : bool, default=True) just so we are consistent with other method.

@daico007 daico007 merged commit c4bfb8c into mosdef-hub:master Oct 29, 2020
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.

3 participants