diff --git a/resultsFile/Modules/gamessFile.py b/resultsFile/Modules/gamessFile.py index 7734f67..d898000 100755 --- a/resultsFile/Modules/gamessFile.py +++ b/resultsFile/Modules/gamessFile.py @@ -38,7 +38,7 @@ gamessFile_defined_vars = [ "date", "version", "machine", "memory", "disk",\ "Ne_pot_energies", "pot_energies", \ "kin_energies", "virials", "point_group", "num_elec", \ "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",\ "two_e_int_ao", "determinants", "num_alpha", "num_beta",\ "closed_mos", "active_mos", "virtual_mos", \ @@ -1348,6 +1348,59 @@ class gamessFile(resultsFile): pass 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 # ---------- to_remove = [] diff --git a/resultsFile/resultsFile.py b/resultsFile/resultsFile.py index 06e06d2..7dbb587 100755 --- a/resultsFile/resultsFile.py +++ b/resultsFile/resultsFile.py @@ -69,19 +69,21 @@ local_vars = [ \ ( 'quadrupole' , "Quadrupole moment"), ( 'num_states' , "Number of electronic states"), # Geometry properties - ( 'point_group' , "Symmetry used."), - ( 'geometry' , "Atom types and coordinates."), - ( 'symmetries' , "Irreducible representations"), - ( 'num_elec' , "Number of electrons."), - ( 'num_alpha' , "Number of Alpha electrons."), - ( 'num_beta' , "Number of Beta electrons."), - ( 'charge' , "Charge of the system."), - ( 'multiplicity' , "Spin multiplicity of the system."), - ( 'nuclear_energy', "Repulsion of the nuclei."), + ( 'point_group' , "Symmetry used."), + ( 'geometry' , "Atom types and coordinates."), + ( 'symmetries' , "Irreducible representations"), + ( 'num_elec' , "Number of electrons."), + ( 'num_alpha' , "Number of Alpha electrons."), + ( 'num_beta' , "Number of Beta electrons."), + ( 'charge' , "Charge of the system."), + ( 'multiplicity' , "Spin multiplicity of the system."), + ( 'nuclear_energy ', "Repulsion of the nuclei."), ( 'gradient_energy', "Gradient of the Energy wrt nucl coord."), # Basis set - ( 'basis' , "Basis set definition"), + ( 'basis' , "Basis set definition"), ( 'uncontracted_basis', "Uncontracted Basis set"), + # Pseudo + ('pseudo' , 'Pseudopotential (gamess input format)'), # Orbitals ( 'mo_sets' , "List of molecular orbitals"), ( 'mo_types' , "Types of molecular orbitals (canonical, natural,...)"),