@@ -1833,8 +1833,12 @@ def functionalize_3D(self,
1833
1833
self .ase_atoms .set_positions (mol_coords )
1834
1834
1835
1835
# rotate functional group to +z
1836
- r = Rot .align_vectors (np .array ([[0. ,0. ,1. ]]* len (funct_coords )), funct_coords )#.reshape(1,-1))
1837
- funct_coords = r [0 ].apply (funct_coords ) + np .array ((0. ,0. ,2. )) # Move to 2
1836
+ if len (funct_coords ) > 1 :
1837
+ r = Rot .align_vectors (np .array ([[0. ,0. ,1. ]]* len (funct_coords )), funct_coords )#.reshape(1,-1))
1838
+ funct_coords = r [0 ].apply (funct_coords ) + np .array ((0. ,0. ,2. )) # Move to 2
1839
+ else :
1840
+ funct_coords = np .array ((0. ,0. ,2. )).reshape (1 , - 1 ) # Move to 2
1841
+
1838
1842
1839
1843
funct_mol .ase_atoms .set_positions (funct_coords )
1840
1844
@@ -1945,8 +1949,11 @@ def functionalize_3D(self,
1945
1949
self .ase_atoms .set_positions (mol_coords )
1946
1950
1947
1951
# rotate functional group to +z
1948
- r = Rot .align_vectors (np .array ([[0. ,0. ,1. ]]* len (funct_coords )), funct_coords )
1949
- funct_coords = r [0 ].apply (funct_coords ) + np .array ((0. ,0. ,2. )) # Move to 2
1952
+ if len (funct_coords ) > 1 :
1953
+ r = Rot .align_vectors (np .array ([[0. ,0. ,1. ]]* len (funct_coords )), funct_coords )#.reshape(1,-1))
1954
+ funct_coords = r [0 ].apply (funct_coords ) + np .array ((0. ,0. ,2. )) # Move to 2
1955
+ else :
1956
+ funct_coords = np .array ((0. ,0. ,2. )).reshape (1 ,- 1 ) # Move to 2
1950
1957
1951
1958
funct_mol .ase_atoms .set_positions (funct_coords )
1952
1959
0 commit comments