From: <bao...@us...> - 2006-05-19 21:13:34
|
Revision: 132 Author: baoilleach Date: 2006-05-19 14:13:29 -0700 (Fri, 19 May 2006) ViewCVS: http://svn.sourceforge.net/cclib/?rev=132&view=rev Log Message: ----------- Normalised the aonames a little bit more. Have realised that it is not possible to normalise completely...oh well. Modified Paths: -------------- trunk/src/cclib/parser/gamessparser.py Modified: trunk/src/cclib/parser/gamessparser.py =================================================================== --- trunk/src/cclib/parser/gamessparser.py 2006-05-19 20:50:15 UTC (rev 131) +++ trunk/src/cclib/parser/gamessparser.py 2006-05-19 21:13:29 UTC (rev 132) @@ -68,23 +68,27 @@ >>> t = GAMESS("dummyfile") >>> data = [' 5 C 1 S ', ' 6 C 1 S ',\ - ' 7 C 1 S ', ' 56 C 1XXXX '] + ' 7 C 1 S ', ' 56 C 1XXXX ',\ + ' 100 C 2 S ' ] >>> print t.normalise_aonames(data) - ['C1_1S', 'C1_2S', 'C1_3S', 'C1_4XXXX'] + ['C1_1S', 'C1_2S', 'C1_3S', 'C1_4XXXX', 'C2_1S'] """ p = re.compile("(\d+)\s*([A-Z][a-z]?)\s*(\d+)\s*([A-Z]+)") ans = [] i = 0 + oldatom = "0" for line in listoflines: m = p.search(line.strip()) assert m, "Cannot pick out the aoname from this information: %s" % line g = m.groups() if g[3] in ['S','X','XX','XXX','XXXX']: i += 1 + if g[2]!=oldatom: # Reset for a new atom + i = 1 aoname = "%s%s_%d%s" % (g[1],g[2],i,g[3]) + oldatom = g[2] ans.append(aoname) - return ans def parse(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |