Skip to content

Commit 7e7b375

Browse files
committed
Allow 1 atom functionalizations.
1 parent 290632b commit 7e7b375

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

architector/io_molecule.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -1833,8 +1833,12 @@ def functionalize_3D(self,
18331833
self.ase_atoms.set_positions(mol_coords)
18341834

18351835
# 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+
18381842

18391843
funct_mol.ase_atoms.set_positions(funct_coords)
18401844

@@ -1945,8 +1949,11 @@ def functionalize_3D(self,
19451949
self.ase_atoms.set_positions(mol_coords)
19461950

19471951
# 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
19501957

19511958
funct_mol.ase_atoms.set_positions(funct_coords)
19521959

0 commit comments

Comments
 (0)