mosdef-hub / mbuild

A hierarchical, component based molecule builder
https://mbuild.mosdef.org
Other
171 stars 79 forks source link

`Compound.add` scale quite badly with big list #1150

Closed daico007 closed 10 months ago

daico007 commented 10 months ago

Bug summary

When trying to add a list of compound to a container, the add method can take quite long (in the scales of 10,000 atoms). This can due to the recursively nature of the method (each particle is added separately). The culprit seems to be the check at the very end of this method, where we are checking if the new compound (with added molecules) box is bigger than it's bounding box. A solution for this would be have a way to skip this check for the individual add and only have one check at the very end. Optimizing the Compound.get_boundingbox() would be beneficial.