From b502a622cc4a280610d567d298e872e3818ab6fa Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 7 Nov 2018 15:29:32 +0100 Subject: [PATCH] Fixed Gamess with symmetry --- resultsFile/Modules/gamessFile.py | 55 ++++++++++++++++++------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/resultsFile/Modules/gamessFile.py b/resultsFile/Modules/gamessFile.py index 74ed09f..6681802 100755 --- a/resultsFile/Modules/gamessFile.py +++ b/resultsFile/Modules/gamessFile.py @@ -599,15 +599,19 @@ class gamessFile(resultsFile): except IndexError: return None end = self._pos - pos += 4 + pos += 2 basis_read = [] + basis_read_dict = {} + atom_label = None atom = [] while pos < end: line = self.text[pos].split() bf = [] if len(line) == 1: basis_read.append(atom) + basis_read_dict[atom_label] = atom atom = [] + atom_label = line[0] while len(line) > 1: index = int(line[0]) sym = line[1] @@ -625,20 +629,29 @@ class gamessFile(resultsFile): pos += 1 basis_read.append(atom) + basis_read_dict[atom_label] = atom + +# new_basis_read = [] +# ib = 1 +# for iatom in range(len(basis_read)): +# atom = basis_read[iatom] +# for (i, s, b) in atom: +# new_basis_read += [ [ib, s, b] ] +# ib += 1 +# if iatom+1 < len(basis_read): +# while ib < basis_read[iatom+1][0][0]: +# for (i, s, b) in atom: +# new_basis_read += [ [ib, s, b] ] +# ib += 1 +# +# basis_read = new_basis_read new_basis_read = [] - ib = 1 for iatom in range(len(basis_read)): atom = basis_read[iatom] - for (i, s, b) in atom: - new_basis_read += [ [ib, s, b] ] - ib += 1 - if iatom+1 < len(basis_read): - while ib < basis_read[iatom+1][0][0]: - for (i, s, b) in atom: - new_basis_read += [ [ib, s, b] ] - ib += 1 - + for a in atom: + new_basis_read += [ a ] + basis_read = new_basis_read Nmax = basis_read[len(basis_read)-1][0] @@ -646,18 +659,15 @@ class gamessFile(resultsFile): for b in basis_read: basis[b[0]-1] = [b[1],b[2]] + # If symmetry is used, rebuild the basis taking the infos of the atoms + if None in basis: + basis_aux = [] + for atom in self.geometry: + basis_aux += basis_read_dict[atom._name] - NotNone = 0 - ReadNone = False - for i in range(len(basis)-1,-1,-1): - if basis[i] == None: - ReadNone = True - basis[i] = list(basis[i+NotNone]) - else: - if ReadNone: - NotNone = 0 - ReadNone = False - NotNone += 1 + for i,b in enumerate(basis): + if b is None: + basis[i] = [ basis_aux[i][1], basis_aux[i][2] ] k=0 while k