@@ -720,33 +720,49 @@ def test_freud_generated_bonds_periodicity(self, ch3):
720
720
ch3_clone = mb .clone (ch3 )
721
721
ch3_clone .box = mb .Box (lengths = [max (bounding_box .lengths ) + 1 ] * 3 )
722
722
ch3_clone .periodicity = (True , True , True )
723
- ch3_clone .freud_generate_bonds (
724
- "H" , "H" , dmin = 0.01 , dmax = 0.2 , exclude_ii = True
725
- )
723
+ ch3_clone .freud_generate_bonds ("H" , "H" , dmin = 0.01 , dmax = 0.2 )
726
724
assert ch3_clone .n_bonds == 3 + 3
727
725
728
726
ch3_clone2 = mb .clone (ch3 )
729
727
ch3_clone2 .box = mb .Box (lengths = [max (bounding_box .lengths ) + 1 ] * 3 )
730
728
ch3_clone2 .periodicity = (True , True , False )
731
- ch3_clone2 .freud_generate_bonds (
732
- "H" , "H" , dmin = 0.01 , dmax = 0.2 , exclude_ii = True
733
- )
729
+ ch3_clone2 .freud_generate_bonds ("H" , "H" , dmin = 0.01 , dmax = 0.2 )
734
730
assert ch3_clone2 .n_bonds == 3 + 3
735
731
736
732
@pytest .mark .skipif (not has_freud , reason = "Freud not installed." )
737
733
def test_freud_generate_bonds (self , ch3 ):
738
734
bounding_box = ch3 .get_boundingbox ()
739
735
ch3 .box = mb .Box (lengths = [max (bounding_box .lengths ) + 1 ] * 3 )
740
- ch3 .freud_generate_bonds ("H" , "H" , dmin = 0.01 , dmax = 0.2 , exclude_ii = True )
736
+ ch3 .freud_generate_bonds ("H" , "H" , dmin = 0.01 , dmax = 0.2 )
741
737
assert ch3 .n_bonds == 3 + 3
742
738
743
739
@pytest .mark .skipif (not has_freud , reason = "Freud not installed." )
744
740
def test_freud_generate_bonds_expected (self , ch3 ):
745
741
bounding_box = ch3 .get_boundingbox ()
746
742
ch3 .box = mb .Box (lengths = [max (bounding_box .lengths ) + 1 ] * 3 )
747
- ch3 .freud_generate_bonds ("H" , "H" , dmin = 0.01 , dmax = 0.1 , exclude_ii = True )
743
+ ch3 .freud_generate_bonds ("H" , "H" , dmin = 0.01 , dmax = 0.1 )
748
744
assert ch3 .n_bonds == 3
749
745
746
+ @pytest .mark .skipif (not has_freud , reason = "Freud not installed." )
747
+ def test_freud_generate_bonds_mixed (self ):
748
+ carbon_atom = mb .Compound (name = "C" , element = "C" )
749
+
750
+ grid_pattern = mb .Grid3DPattern (2 , 2 , 2 )
751
+
752
+ grid_pattern .scale ([0.25 , 0.25 , 0.25 ])
753
+ carbon_list = grid_pattern .apply (carbon_atom )
754
+ co_system = mb .Compound (carbon_list )
755
+ co_system .box = mb .Box ([1 , 1 , 1 ])
756
+ for i , child in enumerate (co_system .children ):
757
+ if i % 2 == 0 :
758
+ child .name = "O"
759
+ child .element = "O"
760
+
761
+ co_system .freud_generate_bonds (
762
+ name_a = "C" , name_b = "O" , dmin = 0.0 , dmax = 0.16
763
+ )
764
+ assert co_system .n_bonds == 4
765
+
750
766
def test_remove_from_box (self , ethane ):
751
767
n_ethanes = 5
752
768
box = mb .fill_box (ethane , n_ethanes , [3 , 3 , 3 ])
0 commit comments