Skip to content

Commit

Permalink
add verbose option for add
Browse files Browse the repository at this point in the history
  • Loading branch information
daico007 committed Oct 17, 2023
1 parent 7142f41 commit f28184b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions mbuild/compound.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ def add(
inherit_periodicity=None,
inherit_box=False,
reset_rigid_ids=True,
verbose=True,
):
"""Add a part to the Compound.
Expand Down Expand Up @@ -843,6 +844,8 @@ def add(
rigid_ids such that values remain distinct from rigid_ids
already present in `self`. Can be set to False if attempting
to add Compounds to an existing rigid body.
verbose : bool, optional, default=True
Warns if compound box is smaller than its bounding box after adding new_child.
"""
# Support batch add via lists, tuples and sets.
# If iterable, we will first compose all the bondgraphs of individual
Expand Down Expand Up @@ -891,9 +894,12 @@ def add(
child,
label=label_list[i],
reset_rigid_ids=reset_rigid_ids,
verbose=False,
)
else:
self.add(child, reset_rigid_ids=reset_rigid_ids)
self.add(
child, reset_rigid_ids=reset_rigid_ids, verbose=False
)

return

Expand Down Expand Up @@ -995,7 +1001,7 @@ def add(
)

# Check that bounding box is within box after adding compound
if self.box:
if self.box and verbose:
if (
np.array(self.box.lengths)
< np.array(self.get_boundingbox().lengths)
Expand Down

0 comments on commit f28184b

Please sign in to comment.