Skip to content

Commit

Permalink
Added connectivity to molecule info
Browse files Browse the repository at this point in the history
  • Loading branch information
abelcarreras committed May 19, 2020
1 parent 88c35e4 commit 00372c1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cosymlib/file_io/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ def print_input_info(initial_geometries, output=sys.stdout):

for idn, array in enumerate(geometry.get_positions()):
output.write('{:2s}'.format(geometry.get_symbols()[idn]))
output.write(' {:11.7f} {:11.7f} {:11.7f}\n'.format(array[0], array[1], array[2]))
output.write(' {:11.7f} {:11.7f} {:11.7f}'.format(array[0], array[1], array[2]))

if geometry.get_connectivity() is not None:
output.write(' ' +
' '.join(['{:3}'.format(i+1) for i in range(geometry.get_n_atoms())
if [idn+1, i+1] in geometry.get_connectivity()])+
'\n')
output.write('\n')


Expand Down
7 changes: 7 additions & 0 deletions cosymlib/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,10 @@ def generate_connectivity_from_geometry(geometry, thresh=1.1):
return None

return (np.array(np.where(relative_differences < thresh - 1)).T + 1).tolist()


def get_connectivity_matrix(connectivity, ndim):
cm = np.zeros((ndim, ndim), dtype=int)
for pair in connectivity:
cm[pair[0]-1, pair[1]-1] = 1
return cm

0 comments on commit 00372c1

Please sign in to comment.