From f28184b1432ac381631ce8d548c98b806110bad9 Mon Sep 17 00:00:00 2001 From: Co Quach Date: Tue, 17 Oct 2023 14:36:41 -0500 Subject: [PATCH 1/3] add verbose option for add --- mbuild/compound.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mbuild/compound.py b/mbuild/compound.py index 5c2e7d000..a8f174fa1 100644 --- a/mbuild/compound.py +++ b/mbuild/compound.py @@ -815,6 +815,7 @@ def add( inherit_periodicity=None, inherit_box=False, reset_rigid_ids=True, + verbose=True, ): """Add a part to the Compound. @@ -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 @@ -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 @@ -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) From 69eb1add5690e26f182db974417d5ce83fe41227 Mon Sep 17 00:00:00 2001 From: Co Quach Date: Wed, 18 Oct 2023 22:34:30 -0500 Subject: [PATCH 2/3] change var name to be more intuitive --- mbuild/compound.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mbuild/compound.py b/mbuild/compound.py index a8f174fa1..538beb5c9 100644 --- a/mbuild/compound.py +++ b/mbuild/compound.py @@ -815,7 +815,7 @@ def add( inherit_periodicity=None, inherit_box=False, reset_rigid_ids=True, - verbose=True, + check_box_size=True, ): """Add a part to the Compound. @@ -844,8 +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. + check_box_size : bool, optional, default=True + Checks and 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 @@ -898,7 +898,9 @@ def add( ) else: self.add( - child, reset_rigid_ids=reset_rigid_ids, verbose=False + child, + reset_rigid_ids=reset_rigid_ids, + check_box_size=False, ) return From 60f400e257130fb7ef9e0f18ecb23b3fd32b3a52 Mon Sep 17 00:00:00 2001 From: Co Quach Date: Wed, 18 Oct 2023 22:43:39 -0500 Subject: [PATCH 3/3] change remaining verbose to check_box_size --- mbuild/compound.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mbuild/compound.py b/mbuild/compound.py index 538beb5c9..6deb5f0de 100644 --- a/mbuild/compound.py +++ b/mbuild/compound.py @@ -894,7 +894,7 @@ def add( child, label=label_list[i], reset_rigid_ids=reset_rigid_ids, - verbose=False, + check_box_size=False, ) else: self.add( @@ -1003,7 +1003,7 @@ def add( ) # Check that bounding box is within box after adding compound - if self.box and verbose: + if self.box and check_box_size: if ( np.array(self.box.lengths) < np.array(self.get_boundingbox().lengths)