10
0
mirror of https://gitlab.com/scemama/resultsFile.git synced 2024-11-07 06:33:41 +01:00

Merge pull request #3 from TApplencourt/master

Add pseudo
This commit is contained in:
Thomas Applencourt 2016-11-08 15:26:05 -06:00 committed by GitHub
commit 96935e5fe7
2 changed files with 66 additions and 11 deletions

View File

@ -38,7 +38,7 @@ gamessFile_defined_vars = [ "date", "version", "machine", "memory", "disk",\
"Ne_pot_energies", "pot_energies", \ "Ne_pot_energies", "pot_energies", \
"kin_energies", "virials", "point_group", "num_elec", \ "kin_energies", "virials", "point_group", "num_elec", \
"charge", "multiplicity","nuclear_energy","dipole","geometry",\ "charge", "multiplicity","nuclear_energy","dipole","geometry",\
"basis","mo_sets","mo_types","mulliken_mo","mulliken_ao",\ "basis","pseudo", "mo_sets","mo_types","mulliken_mo","mulliken_ao",\
"mulliken_atom","lowdin_ao", "mulliken_atom","lowdin_atom",\ "mulliken_atom","lowdin_ao", "mulliken_atom","lowdin_atom",\
"two_e_int_ao", "determinants", "num_alpha", "num_beta",\ "two_e_int_ao", "determinants", "num_alpha", "num_beta",\
"closed_mos", "active_mos", "virtual_mos", \ "closed_mos", "active_mos", "virtual_mos", \
@ -1348,6 +1348,59 @@ class gamessFile(resultsFile):
pass pass
return self._num_states return self._num_states
def get_pseudo(self):
try:
self.find_string('ECP POTENTIALS')
except IndexError:
raise TypeError('No ECP')
else:
pos_begin = self._pos
try:
self.find_string('THE ECP RUN REMOVES')
except IndexError:
raise TypeError('Cannot parse ECP')
else:
pos_end = self._pos
raw_str = ''.join(self.text[pos_begin+2:pos_end])
l_param_atom = raw_str.split('\n\n')
import re
regex = r"PARAMETERS FOR \"(.*)\" ON ATOM\s+(\d+) WITH ZCORE\s+(\d+) AND LMAX\s+(\d+) ARE"
regex_l = r"FOR L=\s+\d+\s+COEFF\s+N\s+ZETA\s*"
regex_already_existing_atom = r"PARAMETERS FOR \"(.*)\" ON ATOM\s+(\d+) ARE THE SAME AS ATOM\s+(\d+)\s*$"
d = dict()
for param in [i for i in l_param_atom if i]:
matches = re.findall(regex, param)
if matches:
name, label,zcore, lmax = matches[0]
l_str = ['{0} GEN {1} {2}'.format(name, zcore, lmax)]
#l_bloc
l_lblock = re.split(regex_l,param)[1:]
for l in l_lblock:
lignes = [i.strip() for i in l.split('\n') if i.strip()]
l_str.append(len(lignes))
l_str += lignes
l_str.append('')
d[int(label)] = '\n'.join(map(str,l_str))
else:
matches = re.findall(regex_already_existing_atom, param)
name, label, label_ref = matches[0]
d[int(label)] = d[int(label_ref)]
result = ""
for i in range(len(d)):
result+= d[i+1]
result+= '\n'
return result
# Properties # Properties
# ---------- # ----------
to_remove = [] to_remove = []

View File

@ -77,11 +77,13 @@ local_vars = [ \
( 'num_beta' , "Number of Beta electrons."), ( 'num_beta' , "Number of Beta electrons."),
( 'charge' , "Charge of the system."), ( 'charge' , "Charge of the system."),
( 'multiplicity' , "Spin multiplicity of the system."), ( 'multiplicity' , "Spin multiplicity of the system."),
( 'nuclear_energy', "Repulsion of the nuclei."), ( 'nuclear_energy ', "Repulsion of the nuclei."),
( 'gradient_energy', "Gradient of the Energy wrt nucl coord."), ( 'gradient_energy', "Gradient of the Energy wrt nucl coord."),
# Basis set # Basis set
( 'basis' , "Basis set definition"), ( 'basis' , "Basis set definition"),
( 'uncontracted_basis', "Uncontracted Basis set"), ( 'uncontracted_basis', "Uncontracted Basis set"),
# Pseudo
('pseudo' , 'Pseudopotential (gamess input format)'),
# Orbitals # Orbitals
( 'mo_sets' , "List of molecular orbitals"), ( 'mo_sets' , "List of molecular orbitals"),
( 'mo_types' , "Types of molecular orbitals (canonical, natural,...)"), ( 'mo_types' , "Types of molecular orbitals (canonical, natural,...)"),