Skip to content

Commit

Permalink
modified name reading from fchk
Browse files Browse the repository at this point in the history
added density getter functions in molecule class
added a new print option for density measure files + updated version
  • Loading branch information
efrembernuz committed Aug 5, 2020
1 parent f8399e4 commit 105f8dc
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
38 changes: 37 additions & 1 deletion cosymlib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.8.4'
__version__ = '0.8.5'

from cosymlib.molecule import Molecule, Geometry
from cosymlib import file_io
Expand Down Expand Up @@ -278,6 +278,42 @@ def print_electronic_symmetry_measure(self, group, axis=None, axis2=None, center

output.write(txt)

def print_electronic_density_measure(self, group, axis=None, axis2=None, center=None, output=sys.stdout):

txt = ''
txt2 = ''
first = True
for molecule in self._molecules:
dens_measure = molecule.get_dens_symmetry(group, axis=axis, axis2=axis2, center=center)

if first:
sep_line = ' ' + '---------' * len(dens_measure['labels']) + '\n'

txt += '\nDensity: CSM-like values\n'
txt += sep_line
txt += ' ' + ' '.join(['{:^7}'.format(s) for s in dens_measure['labels']])
txt += '\n'
txt += sep_line

txt2 += '--------------\n'
txt2 += 'Total CSM {}\n'.format(group)
txt2 += '--------------\n'

txt += '{:<9} '.format(molecule.name) + ' '.join(['{:7.3f}'.format(s) for s in dens_measure['csm_coef']])
txt += '\n'
first = False
axes_information = molecule.get_symmetry_axes(group, axis=axis, axis2=axis2, center=center)
txt2 += '{:<9} '.format(molecule.name) + '{:7.3f}\n'.format(dens_measure['csm'])
txt2 += '\ncenter: ' + ' '.join(['{:12.8f}'.format(s) for s in axes_information['center']])
txt2 += '\n'
txt2 += 'axis : ' + ' '.join(['{:12.8f}'.format(s) for s in axes_information['axis']])
txt2 += '\n'
txt2 += 'axis2 : ' + ' '.join(['{:12.8f}'.format(s) for s in axes_information['axis2']])

txt += '\n' + txt2

output.write(txt)

def print_wnfsym_sym_matrices(self, group, axis=None, axis2=None, center=None, output=sys.stdout):

txt = ''
Expand Down
2 changes: 1 addition & 1 deletion cosymlib/file_io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def get_molecule_from_file_fchk(file_name, read_multiple=False):
input_molecule = [[] for _ in range(len(key_list))]
read = False
with open(file_name, mode='r') as lines:
name = lines.readline().strip('\n')
name = lines.readline().split()[0]#.strip('\n')
line = lines.readline().split()
basis_set = line[-1]
if 'R' in line[1]:
Expand Down
8 changes: 8 additions & 0 deletions cosymlib/molecule/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ def get_symmetry_matrix(self, group, axis=None, axis2=None, center=None):
def get_wf_symmetry(self, group, axis=None, axis2=None, center=None):
return self._symmetry.wf_measure(group)

@set_parameters
def get_dens_symmetry(self, group, axis=None, axis2=None, center=None):
return self._symmetry.dens_measure(group)

@set_parameters
def get_symmetry_axes(self, group, axis=None, axis2=None, center=None):
return self._symmetry.axes(group)

@set_parameters
def get_ideal_group_table(self, group, axis=None, axis2=None, center=None):
return self._symmetry.wf_ideal_group_table(group)

0 comments on commit 105f8dc

Please sign in to comment.