Skip to content

Commit

Permalink
modify format of density_CSM_print function
Browse files Browse the repository at this point in the history
  • Loading branch information
abelcarreras committed Apr 1, 2022
1 parent 7116c17 commit c483d94
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions cosymlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,17 @@ def _print_electronic_symmetry_measure(self, group, axis=None, axis2=None, cente
wf_measure = molecule.get_wf_symmetry(group, axis=axis, axis2=axis2, center=center)

if first:
axes_information = molecule.get_symmetry_axes(group, axis=axis, axis2=axis2, center=center)
txt += '\nSymmetry parameters\n'
txt += 'center: ' + ' '.join(['{:12.8f}'.format(s) for s in axes_information['center']])
txt += '\n'
txt += 'axis : ' + ' '.join(['{:12.8f}'.format(s) for s in axes_information['axis']])
txt += '\n'
txt += 'axis2 : ' + ' '.join(['{:12.8f}'.format(s) for s in axes_information['axis2']])
txt += '\n'
sep_line = ' ' + '---------' * len(wf_measure['labels']) + '\n'

txt += '\nWaveFunction: CSM-like values\n'
txt += '\nWaveFunction: normalized SOEV values\n'
txt += sep_line
txt += ' ' + ' '.join(['{:^7}'.format(s) for s in wf_measure['labels']])
txt += '\n'
Expand All @@ -389,14 +397,7 @@ def _print_electronic_symmetry_measure(self, group, axis=None, axis2=None, cente
txt += '{:<9} '.format(molecule.name) + ' '.join(['{:7.3f}'.format(s) for s in wf_measure['csm']])
txt += '\n'
first = False
axes_information = molecule.get_symmetry_axes(group, axis=axis, axis2=axis2, center=center)
txt += '\nSymmetry parameters\n'
txt += 'center: ' + ' '.join(['{:12.8f}'.format(s) for s in axes_information['center']])
txt += '\n'
txt += 'axis : ' + ' '.join(['{:12.8f}'.format(s) for s in axes_information['axis']])
txt += '\n'
txt += 'axis2 : ' + ' '.join(['{:12.8f}'.format(s) for s in axes_information['axis2']])
txt += '\n'


output.write(txt)

Expand All @@ -410,10 +411,20 @@ def print_edensity_measure(self, group, axis=None, axis2=None, center=None, outp
center=center)

sep_line = ' ' + '---------' * len(dens_measure['labels']) + '\n'
axes_information = molecule.get_symmetry_axes(group, axis=axis, axis2=axis2, center=center)

txt += '\nSymmetry axes\n'
txt += 'center: ' + ' '.join(['{:12.8f}'.format(s) for s in axes_information['center']])
txt += '\n'
txt += 'axis : ' + ' '.join(['{:12.8f}'.format(s) for s in axes_information['axis']])
txt += '\n'
txt += 'axis2 : ' + ' '.join(['{:12.8f}'.format(s) for s in axes_information['axis2']])
txt += '\n'
txt += '\n'

txt += _get_geometry_coordinates(molecule.geometry)

txt += '\nDensity: CSM-like values\n'
txt += '\nDensity: normalized SOEV values\n'
txt += sep_line
txt += ' ' + ' '.join(['{:^7}'.format(s) for s in dens_measure['labels']])
txt += '\n'
Expand All @@ -422,21 +433,15 @@ def print_edensity_measure(self, group, axis=None, axis2=None, center=None, outp
txt += '{:<9} '.format(molecule.name) + ' '.join(['{:7.3f}'.format(s) for s in dens_measure['csm_coef']])
txt += '\n\n'

axes_information = molecule.get_symmetry_axes(group, axis=axis, axis2=axis2, center=center)

txt += '----------------------------\n'
txt += 'Total density symmetry: {}\n'.format(group)
txt += 'Total density CSM: {}\n'.format(group)
txt += '----------------------------\n'
txt += '{:<9} '.format(molecule.name) + '{:7.3f}\n'.format(dens_measure['csm'])

txt += '\nSelf Similarity: {:7.3f}\n\n'.format(dens_measure['self_similarity'])

txt += '\nSymmetry axes\n'
txt += 'center: ' + ' '.join(['{:12.8f}'.format(s) for s in axes_information['center']])
txt += '\n'
txt += 'axis : ' + ' '.join(['{:12.8f}'.format(s) for s in axes_information['axis']])
txt += '\n'
txt += 'axis2 : ' + ' '.join(['{:12.8f}'.format(s) for s in axes_information['axis2']])
txt += '\n'


output.write(txt)

Expand Down Expand Up @@ -813,11 +818,14 @@ def print_minimum_distortion_path_shape(self, shape_label1, shape_label2, centra
positions=structure, name='map_structure{}'.format(ids)))
output2.write(file_io.get_file_xyz_txt(test_structures))

fig,axes = plt.subplots(1,1)
plt.plot(path[0], path[1], 'k', linewidth=2.0)
plt.scatter(np.array(csm[label1_name])[filter_mask],
np.array(csm[label2_name])[filter_mask], linewidths=0.01)
plt.xlabel(label1_name)
plt.ylabel(label2_name)
axes.set_aspect('equal')

plt.savefig('shape_map.png')
if output1 is sys.stdout:
plt.show()
Expand Down

0 comments on commit c483d94

Please sign in to comment.