Debian Codegraph @

cclib/parser/jaguarparser.py

raw
1 # -*- coding: utf-8 -*-
2 #
3 # Copyright (c) 2018, the cclib development team
4 #
5 # This file is part of cclib (http://cclib.github.io) and is distributed under
6 # the terms of the BSD 3-Clause License.
7
8 """Parser for Jaguar output files"""
9
10
11 import re
12
13 import numpy
14
15 from cclib.parser import logfileparser
16 from cclib.parser import utils
17
18
19 class Jaguar(logfileparser.Logfile):
20 """A Jaguar output file"""
21
22 def __init__(self, *args, **kwargs):
23
24 # Call the __init__ method of the superclass
25 super(Jaguar, self).__init__(logname="Jaguar", *args, **kwargs)
26
27 def __str__(self):
28 """Return a string representation of the object."""
29 return "Jaguar output file %s" % (self.filename)
30
31 def __repr__(self):
32 """Return a representation of the object."""
33 return 'Jaguar("%s")' % (self.filename)
34
35 def normalisesym(self, label):
36 """Normalise the symmetries used by Jaguar.
37
38 To normalise, three rules need to be applied:
39 (1) To handle orbitals of E symmetry, retain everything before the /
40 (2) Replace two p's by "
41 (2) Replace any remaining single p's by '
42 """
43 ans = label.split("/")[0].replace("pp", '"').replace("p", "'")
44 return ans
45
46 def before_parsing(self):
47
48 # We need to track whether we are inside geometry optimization in order
49 # to parse SCF targets/values correctly.
50 self.geoopt = False
51
52 def after_parsing(self):
53
54 # This is to make sure we always have optdone after geometry optimizations,
55 # even if it is to be empty for unconverged runs. We have yet to test this
56 # with a regression for Jaguar, though.
57 if self.geoopt and not hasattr(self, 'optdone'):
58 self.optdone = []
59
60 def extract(self, inputfile, line):
61 """Extract information from the file object inputfile."""
62
63 # Extract the package version number.
64 if "Jaguar version" in line:
65 tokens = line.split()
66 # Don't add revision information to the main package
67 # version for now.
68 # package_version = "{}.r{}".format(tokens[3][:-1], tokens[5])
69 package_version = tokens[3][:-1]
70 self.metadata["package_version"] = package_version
71
72 # Extract the basis set name
73 if line[2:12] == "basis set:":
74 self.metadata["basis_set"] = line.split()[2]
75
76 # Extract charge and multiplicity
77 if line[2:22] == "net molecular charge":
78 self.set_attribute('charge', int(line.split()[-1]))
79 self.set_attribute('mult', int(next(inputfile).split()[-1]))
80
81 # The Gaussian basis set information is printed before the geometry, and we need
82 # to do some indexing to get this into cclib format, because fn increments
83 # for each engular momentum, but cclib does not (we have just P instead of
84 # all three X/Y/Z with the same parameters. On the other hand, fn enumerates
85 # the atomic orbitals correctly, so use it to build atombasis.
86 #
87 # Gaussian basis set information
88 #
89 # renorm mfac*renorm
90 # atom fn prim L z coef coef coef
91 # -------- ----- ---- --- ------------- ----------- ----------- -----------
92 # C1 1 1 S 7.161684E+01 1.5433E-01 2.7078E+00 2.7078E+00
93 # C1 1 2 S 1.304510E+01 5.3533E-01 2.6189E+00 2.6189E+00
94 # ...
95 # C1 3 6 X 2.941249E+00 2.2135E-01 1.2153E+00 1.2153E+00
96 # 4 Y 1.2153E+00
97 # 5 Z 1.2153E+00
98 # C1 2 8 S 2.222899E-01 1.0000E+00 2.3073E-01 2.3073E-01
99 # C1 3 7 X 6.834831E-01 8.6271E-01 7.6421E-01 7.6421E-01
100 # ...
101 # C2 6 1 S 7.161684E+01 1.5433E-01 2.7078E+00 2.7078E+00
102 # ...
103 #
104 if line.strip() == "Gaussian basis set information":
105
106 self.skip_lines(inputfile, ['b', 'renorm', 'header', 'd'])
107
108 # This is probably the only place we can get this information from Jaguar.
109 self.gbasis = []
110
111 atombasis = []
112 line = next(inputfile)
113 fn_per_atom = []
114 while line.strip():
115
116 if len(line.split()) > 3:
117
118 aname = line.split()[0]
119 fn = int(line.split()[1])
120 prim = int(line.split()[2])
121 L = line.split()[3]
122 z = float(line.split()[4])
123 coef = float(line.split()[5])
124
125 # The primitive count is reset for each atom, so use that for adding
126 # new elements to atombasis and gbasis. We could also probably do this
127 # using the atom name, although that perhaps might not always be unique.
128 if prim == 1:
129 atombasis.append([])
130 fn_per_atom = []
131 self.gbasis.append([])
132
133 # Remember that fn is repeated when functions are contracted.
134 if not fn-1 in atombasis[-1]:
135 atombasis[-1].append(fn-1)
136
137 # Here we use fn only to know when a new contraction is encountered,
138 # so we don't need to decrement it, and we don't even use all values.
139 # What's more, since we only wish to save the parameters for each subshell
140 # once, we don't even need to consider lines for orbitals other than
141 # those for X*, making things a bit easier.
142 if not fn in fn_per_atom:
143 fn_per_atom.append(fn)
144 label = {'S': 'S', 'X': 'P', 'XX': 'D', 'XXX': 'F'}[L]
145 self.gbasis[-1].append((label, []))
146 igbasis = fn_per_atom.index(fn)
147 self.gbasis[-1][igbasis][1].append([z, coef])
148
149 else:
150
151 fn = int(line.split()[0])
152 L = line.split()[1]
153
154 # Some AO indices are only printed in these lines, for L > 0.
155 if not fn-1 in atombasis[-1]:
156 atombasis[-1].append(fn-1)
157
158 line = next(inputfile)
159
160 # The indices for atombasis can also be read later from the molecular orbital output.
161 self.set_attribute('atombasis', atombasis)
162
163 # This length of atombasis should always be the number of atoms.
164 self.set_attribute('natom', len(self.atombasis))
165
166 # Effective Core Potential
167 #
168 # Atom Electrons represented by ECP
169 # Mo 36
170 # Maximum angular term 3
171 # F Potential 1/r^n Exponent Coefficient
172 # ----- -------- -----------
173 # 0 140.4577691 -0.0469492
174 # 1 89.4739342 -24.9754989
175 # ...
176 # S-F Potential 1/r^n Exponent Coefficient
177 # ----- -------- -----------
178 # 0 33.7771969 2.9278406
179 # 1 10.0120020 34.3483716
180 # ...
181 # O 0
182 # Cl 10
183 # Maximum angular term 2
184 # D Potential 1/r^n Exponent Coefficient
185 # ----- -------- -----------
186 # 1 94.8130000 -10.0000000
187 # ...
188 if line.strip() == "Effective Core Potential":
189
190 self.skip_line(inputfile, 'blank')
191 line = next(inputfile)
192 assert line.split()[0] == "Atom"
193 assert " ".join(line.split()[1:]) == "Electrons represented by ECP"
194
195 self.coreelectrons = []
196 line = next(inputfile)
197 while line.strip():
198 if len(line.split()) == 2:
199 self.coreelectrons.append(int(line.split()[1]))
200 line = next(inputfile)
201
202 if line[2:14] == "new geometry" or line[1:21] == "Symmetrized geometry" or line.find("Input geometry") > 0:
203 # Get the atom coordinates
204 if not hasattr(self, "atomcoords") or line[1:21] == "Symmetrized geometry":
205 # Wipe the "Input geometry" if "Symmetrized geometry" present
206 self.atomcoords = []
207 p = re.compile("(\D+)\d+") # One/more letters followed by a number
208 atomcoords = []
209 atomnos = []
210 angstrom = next(inputfile)
211 title = next(inputfile)
212 line = next(inputfile)
213 while line.strip():
214 temp = line.split()
215 element = p.findall(temp[0])[0]
216 atomnos.append(self.table.number[element])
217 atomcoords.append(list(map(float, temp[1:])))
218 line = next(inputfile)
219 self.atomcoords.append(atomcoords)
220 self.atomnos = numpy.array(atomnos, "i")
221 self.set_attribute('natom', len(atomcoords))
222
223 # Hartree-Fock energy after SCF
224 if line[1:18] == "SCFE: SCF energy:":
225 self.metadata["methods"].append("HF")
226 if not hasattr(self, "scfenergies"):
227 self.scfenergies = []
228 temp = line.strip().split()
229 scfenergy = float(temp[temp.index("hartrees") - 1])
230 scfenergy = utils.convertor(scfenergy, "hartree", "eV")
231 self.scfenergies.append(scfenergy)
232
233 # Energy after LMP2 correction
234 if line[1:18] == "Total LMP2 Energy":
235 self.metadata["methods"].append("LMP2")
236 if not hasattr(self, "mpenergies"):
237 self.mpenergies = [[]]
238 lmp2energy = float(line.split()[-1])
239 lmp2energy = utils.convertor(lmp2energy, "hartree", "eV")
240 self.mpenergies[-1].append(lmp2energy)
241
242 if line[15:45] == "Geometry optimization complete":
243 if not hasattr(self, 'optdone'):
244 self.optdone = []
245 self.optdone.append(len(self.geovalues) - 1)
246
247 if line.find("number of occupied orbitals") > 0:
248 # Get number of MOs
249 occs = int(line.split()[-1])
250 line = next(inputfile)
251 virts = int(line.split()[-1])
252 self.nmo = occs + virts
253 self.homos = numpy.array([occs-1], "i")
254
255 self.unrestrictedflag = False
256
257 if line[1:28] == "number of occupied orbitals":
258 self.homos = numpy.array([float(line.strip().split()[-1])-1], "i")
259
260 if line[2:27] == "number of basis functions":
261 nbasis = int(line.strip().split()[-1])
262 self.set_attribute('nbasis', nbasis)
263
264 if line.find("number of alpha occupied orb") > 0:
265 # Get number of MOs for an unrestricted calc
266
267 aoccs = int(line.split()[-1])
268 line = next(inputfile)
269 avirts = int(line.split()[-1])
270 line = next(inputfile)
271 boccs = int(line.split()[-1])
272 line = next(inputfile)
273 bvirt = int(line.split()[-1])
274
275 self.nmo = aoccs + avirts
276 self.homos = numpy.array([aoccs-1, boccs-1], "i")
277 self.unrestrictedflag = True
278
279 if line[0:4] == "etot":
280 # Get SCF convergence information
281 if not hasattr(self, "scfvalues"):
282 self.scfvalues = []
283 self.scftargets = [[5E-5, 5E-6]]
284 values = []
285 while line[0:4] == "etot":
286 # Jaguar 4.2
287 # etot 1 N N 0 N -382.08751886450 2.3E-03 1.4E-01
288 # etot 2 Y Y 0 N -382.27486023153 1.9E-01 1.4E-03 5.7E-02
289 # Jaguar 6.5
290 # etot 1 N N 0 N -382.08751881733 2.3E-03 1.4E-01
291 # etot 2 Y Y 0 N -382.27486018708 1.9E-01 1.4E-03 5.7E-02
292 temp = line.split()[7:]
293 if len(temp) == 3:
294 denergy = float(temp[0])
295 else:
296 denergy = 0 # Should really be greater than target value
297 # or should we just ignore the values in this line
298 ddensity = float(temp[-2])
299 maxdiiserr = float(temp[-1])
300 if not self.geoopt:
301 values.append([denergy, ddensity])
302 else:
303 values.append([ddensity])
304 try:
305 line = next(inputfile)
306 except StopIteration:
307 self.logger.warning('File terminated before end of last SCF! Last error: {}'.format(maxdiiserr))
308 break
309 self.scfvalues.append(values)
310
311 # MO energies and symmetries.
312 # Jaguar 7.0: provides energies and symmetries for both
313 # restricted and unrestricted calculations, like this:
314 # Alpha Orbital energies/symmetry label:
315 # -10.25358 Bu -10.25353 Ag -10.21931 Bu -10.21927 Ag
316 # -10.21792 Bu -10.21782 Ag -10.21773 Bu -10.21772 Ag
317 # ...
318 # Jaguar 6.5: prints both only for restricted calculations,
319 # so for unrestricted calculations the output it looks like this:
320 # Alpha Orbital energies:
321 # -10.25358 -10.25353 -10.21931 -10.21927 -10.21792 -10.21782
322 # -10.21773 -10.21772 -10.21537 -10.21537 -1.02078 -0.96193
323 # ...
324 # Presence of 'Orbital energies' is enough to catch all versions.
325 if "Orbital energies" in line:
326
327 # Parsing results is identical for restricted/unrestricted
328 # calculations, just assert later that alpha/beta order is OK.
329 spin = int(line[2:6] == "Beta")
330
331 # Check if symmetries are printed also.
332 issyms = "symmetry label" in line
333
334 if not hasattr(self, "moenergies"):
335 self.moenergies = []
336 if issyms and not hasattr(self, "mosyms"):
337 self.mosyms = []
338
339 # Grow moeneriges/mosyms and make sure they are empty when
340 # parsed multiple times - currently cclib returns only
341 # the final output (ex. in a geomtry optimization).
342 if len(self.moenergies) < spin+1:
343 self.moenergies.append([])
344 self.moenergies[spin] = []
345 if issyms:
346 if len(self.mosyms) < spin+1:
347 self.mosyms.append([])
348 self.mosyms[spin] = []
349
350 line = next(inputfile).split()
351 while len(line) > 0:
352 if issyms:
353 energies = [float(line[2*i]) for i in range(len(line)//2)]
354 syms = [line[2*i+1] for i in range(len(line)//2)]
355 else:
356 energies = [float(e) for e in line]
357 energies = [utils.convertor(e, "hartree", "eV") for e in energies]
358 self.moenergies[spin].extend(energies)
359 if issyms:
360 syms = [self.normalisesym(s) for s in syms]
361 self.mosyms[spin].extend(syms)
362 line = next(inputfile).split()
363
364 line = next(inputfile)
365
366 # The second trigger string is in the version 8.3 unit test and the first one was
367 # encountered in version 6.x and is followed by a bit different format. In particular,
368 # the line with occupations is missing in each block. Here is a fragment of this block
369 # from version 8.3:
370 #
371 # *****************************************
372 #
373 # occupied + virtual orbitals: final wave function
374 #
375 # *****************************************
376 #
377 #
378 # 1 2 3 4 5
379 # eigenvalues- -11.04064 -11.04058 -11.03196 -11.03196 -11.02881
380 # occupations- 2.00000 2.00000 2.00000 2.00000 2.00000
381 # 1 C1 S 0.70148 0.70154 -0.00958 -0.00991 0.00401
382 # 2 C1 S 0.02527 0.02518 0.00380 0.00374 0.00371
383 # ...
384 #
385 if line.find("Occupied + virtual Orbitals- final wvfn") > 0 or \
386 line.find("occupied + virtual orbitals: final wave function") > 0:
387
388 self.skip_lines(inputfile, ['b', 's', 'b', 'b'])
389
390 if not hasattr(self, "mocoeffs"):
391 self.mocoeffs = []
392
393 aonames = []
394 lastatom = "X"
395
396 readatombasis = False
397 if not hasattr(self, "atombasis"):
398 self.atombasis = []
399 for i in range(self.natom):
400 self.atombasis.append([])
401 readatombasis = True
402
403 offset = 0
404
405 spin = 1 + int(self.unrestrictedflag)
406 for s in range(spin):
407 mocoeffs = numpy.zeros((len(self.moenergies[s]), self.nbasis), "d")
408
409 if s == 1: # beta case
410 self.skip_lines(inputfile, ['s', 'b', 'title', 'b', 's', 'b', 'b'])
411
412 for k in range(0, len(self.moenergies[s]), 5):
413 self.updateprogress(inputfile, "Coefficients")
414
415 # All known version have a line with indices followed by the eigenvalues.
416 self.skip_lines(inputfile, ['numbers', 'eigens'])
417
418 # Newer version also have a line with occupation numbers here.
419 line = next(inputfile)
420 if "occupations-" in line:
421 line = next(inputfile)
422
423 for i in range(self.nbasis):
424
425 info = line.split()
426
427 # Fill atombasis only first time around.
428 if readatombasis and k == 0:
429 orbno = int(info[0])
430 atom = info[1]
431 if atom[1].isalpha():
432 atomno = int(atom[2:])
433 else:
434 atomno = int(atom[1:])
435 self.atombasis[atomno-1].append(orbno-1)
436
437 if not hasattr(self, "aonames"):
438 if lastatom != info[1]:
439 scount = 1
440 pcount = 3
441 dcount = 6 # six d orbitals in Jaguar
442
443 if info[2] == 'S':
444 aonames.append("%s_%i%s" % (info[1], scount, info[2]))
445 scount += 1
446
447 if info[2] == 'X' or info[2] == 'Y' or info[2] == 'Z':
448 aonames.append("%s_%iP%s" % (info[1], pcount / 3, info[2]))
449 pcount += 1
450
451 if info[2] == 'XX' or info[2] == 'YY' or info[2] == 'ZZ' or \
452 info[2] == 'XY' or info[2] == 'XZ' or info[2] == 'YZ':
453
454 aonames.append("%s_%iD%s" % (info[1], dcount / 6, info[2]))
455 dcount += 1
456
457 lastatom = info[1]
458
459 for j in range(len(info[3:])):
460 mocoeffs[j+k, i] = float(info[3+j])
461
462 line = next(inputfile)
463
464 if not hasattr(self, "aonames"):
465 self.aonames = aonames
466
467 offset += 5
468 self.mocoeffs.append(mocoeffs)
469
470 # Atomic charges from Mulliken population analysis:
471 #
472 # Atom C1 C2 C3 C4 C5
473 # Charge 0.00177 -0.06075 -0.05956 0.00177 -0.06075
474 #
475 # Atom H6 H7 H8 C9 C10
476 # ...
477 if line.strip() == "Atomic charges from Mulliken population analysis:":
478
479 if not hasattr(self, 'atomcharges'):
480 self.atomcharges = {}
481
482 charges = []
483 self.skip_line(inputfile, "blank")
484 line = next(inputfile)
485 while "sum of atomic charges" not in line:
486 assert line.split()[0] == "Atom"
487 line = next(inputfile)
488 assert line.split()[0] == "Charge"
489 charges.extend([float(c) for c in line.split()[1:]])
490 self.skip_line(inputfile, "blank")
491 line = next(inputfile)
492
493 self.atomcharges['mulliken'] = charges
494
495 if (line[2:6] == "olap") or (line.strip() == "overlap matrix:"):
496
497 if line[6] == "-":
498 return
499 # This was continue (in loop) before parser refactoring.
500 # continue # avoid "olap-dev"
501 self.aooverlaps = numpy.zeros((self.nbasis, self.nbasis), "d")
502
503 for i in range(0, self.nbasis, 5):
504 self.updateprogress(inputfile, "Overlap")
505
506 self.skip_lines(inputfile, ['b', 'header'])
507
508 for j in range(i, self.nbasis):
509 temp = list(map(float, next(inputfile).split()[1:]))
510 self.aooverlaps[j, i:(i+len(temp))] = temp
511 self.aooverlaps[i:(i+len(temp)), j] = temp
512
513 if line[2:24] == "start of program geopt":
514 if not self.geoopt:
515 # Need to keep only the RMS density change info
516 # if this is a geooptz
517 self.scftargets = [[self.scftargets[0][0]]]
518 if hasattr(self, "scfvalues"):
519 self.scfvalues[0] = [[x[0]] for x in self.scfvalues[0]]
520 self.geoopt = True
521 else:
522 self.scftargets.append([5E-5])
523
524 # Get Geometry Opt convergence information
525 #
526 # geometry optimization step 7
527 # energy: -382.30219111487 hartrees
528 # [ turning on trust-radius adjustment ]
529 # ** restarting optimization from step 6 **
530 #
531 #
532 # Level shifts adjusted to satisfy step-size constraints
533 # Step size: 0.0360704
534 # Cos(theta): 0.8789215
535 # Final level shift: -8.6176299E-02
536 #
537 # energy change: 2.5819E-04 . ( 5.0000E-05 )
538 # gradient maximum: 5.0947E-03 . ( 4.5000E-04 )
539 # gradient rms: 1.2996E-03 . ( 3.0000E-04 )
540 # displacement maximum: 1.3954E-02 . ( 1.8000E-03 )
541 # displacement rms: 4.6567E-03 . ( 1.2000E-03 )
542 #
543 if line[2:28] == "geometry optimization step":
544
545 if not hasattr(self, "geovalues"):
546 self.geovalues = []
547 self.geotargets = numpy.zeros(5, "d")
548
549 gopt_step = int(line.split()[-1])
550
551 energy = next(inputfile)
552 blank = next(inputfile)
553
554 # A quick hack for messages that show up right after the energy
555 # at this point, which include:
556 # ** restarting optimization from step 2 **
557 # [ turning on trust-radius adjustment ]
558 # as found in regression file ptnh3_2_H2O_2_2plus.out and other logfiles.
559 restarting_from_1 = False
560 while blank.strip():
561 if blank.strip() == "** restarting optimization from step 1 **":
562 restarting_from_1 = True
563 blank = next(inputfile)
564
565 # One or more blank lines, depending on content.
566 line = next(inputfile)
567 while not line.strip():
568 line = next(inputfile)
569
570 # Note that the level shift message is followed by a blank, too.
571 if "Level shifts adjusted" in line:
572 while line.strip():
573 line = next(inputfile)
574 line = next(inputfile)
575
576 # The first optimization step does not produce an energy change, and
577 # ther is also no energy change when the optimization is restarted
578 # from step 1 (since step 1 had no change).
579 values = []
580 target_index = 0
581 if (gopt_step == 1) or restarting_from_1:
582 values.append(0.0)
583 target_index = 1
584 while line.strip():
585 if len(line) > 40 and line[41] == "(":
586 # A new geo convergence value
587 values.append(float(line[26:37]))
588 self.geotargets[target_index] = float(line[43:54])
589 target_index += 1
590 line = next(inputfile)
591 self.geovalues.append(values)
592
593 # IR output looks like this:
594 # frequencies 72.45 113.25 176.88 183.76 267.60 312.06
595 # symmetries Au Bg Au Bu Ag Bg
596 # intensities 0.07 0.00 0.28 0.52 0.00 0.00
597 # reduc. mass 1.90 0.74 1.06 1.42 1.19 0.85
598 # force const 0.01 0.01 0.02 0.03 0.05 0.05
599 # C1 X 0.00000 0.00000 0.00000 -0.05707 -0.06716 0.00000
600 # C1 Y 0.00000 0.00000 0.00000 0.00909 -0.02529 0.00000
601 # C1 Z 0.04792 -0.06032 -0.01192 0.00000 0.00000 0.11613
602 # C2 X 0.00000 0.00000 0.00000 -0.06094 -0.04635 0.00000
603 # ... etc. ...
604 # This is a complete ouput, some files will not have intensities,
605 # and older Jaguar versions sometimes skip the symmetries.
606 if line[2:23] == "start of program freq":
607
608 self.skip_line(inputfile, 'blank')
609
610 # Version 8.3 has two blank lines here, earlier versions just one.
611 line = next(inputfile)
612 if not line.strip():
613 line = next(inputfile)
614
615 self.vibfreqs = []
616 self.vibdisps = []
617 forceconstants = False
618 intensities = False
619 while line.strip():
620 if "force const" in line:
621 forceconstants = True
622 if "intensities" in line:
623 intensities = True
624 line = next(inputfile)
625
626 # In older version, the last block had an extra blank line after it,
627 # which could be caught. This is not true in newer version (including 8.3),
628 # but in general it would be better to bound this loop more strictly.
629 freqs = next(inputfile)
630 while freqs.strip() and not "imaginary frequencies" in freqs:
631
632 # Number of modes (columns printed in this block).
633 nmodes = len(freqs.split())-1
634
635 # Append the frequencies.
636 self.vibfreqs.extend(list(map(float, freqs.split()[1:])))
637 line = next(inputfile).split()
638
639 # May skip symmetries (older Jaguar versions).
640 if line[0] == "symmetries":
641 if not hasattr(self, "vibsyms"):
642 self.vibsyms = []
643 self.vibsyms.extend(list(map(self.normalisesym, line[1:])))
644 line = next(inputfile).split()
645 if intensities:
646 if not hasattr(self, "vibirs"):
647 self.vibirs = []
648 self.vibirs.extend(list(map(float, line[1:])))
649 line = next(inputfile).split()
650 if forceconstants:
651 line = next(inputfile)
652
653 # Start parsing the displacements.
654 # Variable 'q' holds up to 7 lists of triplets.
655 q = [[] for i in range(7)]
656 for n in range(self.natom):
657 # Variable 'p' holds up to 7 triplets.
658 p = [[] for i in range(7)]
659 for i in range(3):
660 line = next(inputfile)
661 disps = [float(disp) for disp in line.split()[2:]]
662 for j in range(nmodes):
663 p[j].append(disps[j])
664 for i in range(nmodes):
665 q[i].append(p[i])
666
667 self.vibdisps.extend(q[:nmodes])
668
669 self.skip_line(inputfile, 'blank')
670 freqs = next(inputfile)
671
672 # Convert new data to arrays.
673 self.vibfreqs = numpy.array(self.vibfreqs, "d")
674 self.vibdisps = numpy.array(self.vibdisps, "d")
675 if hasattr(self, "vibirs"):
676 self.vibirs = numpy.array(self.vibirs, "d")
677
678 # Parse excited state output (for CIS calculations).
679 # Jaguar calculates only singlet states.
680 if line[2:15] == "Excited State":
681 if not hasattr(self, "etenergies"):
682 self.etenergies = []
683 if not hasattr(self, "etoscs"):
684 self.etoscs = []
685 if not hasattr(self, "etsecs"):
686 self.etsecs = []
687 self.etsyms = []
688 etenergy = float(line.split()[3])
689 etenergy = utils.convertor(etenergy, "eV", "wavenumber")
690 self.etenergies.append(etenergy)
691
692 self.skip_lines(inputfile, ['line', 'line', 'line', 'line'])
693
694 line = next(inputfile)
695 self.etsecs.append([])
696 # Jaguar calculates only singlet states.
697 self.etsyms.append('Singlet-A')
698 while line.strip() != "":
699 fromMO = int(line.split()[0])-1
700 toMO = int(line.split()[2])-1
701 coeff = float(line.split()[-1])
702 self.etsecs[-1].append([(fromMO, 0), (toMO, 0), coeff])
703 line = next(inputfile)
704 # Skip 3 lines
705 for i in range(4):
706 line = next(inputfile)
707 strength = float(line.split()[-1])
708 self.etoscs.append(strength)
709
710 if line[:20] == ' Total elapsed time:' \
711 or line[:18] == ' Total cpu seconds':
712 self.metadata['success'] = True