8000 Error parsing molecular orbitals in openmolcas · Issue #1109 · cclib/cclib · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Error parsing molecular orbitals in openmolcas #1109
Open
@ltalirz

Description

@ltalirz

Openmolcas dynamically switches between a "default format" and a "compact format" of printing molecular orbitals and their expansion in atomic basis functions depending on the number of molecular orbitals (see codebase)

cclib currently only supports the "default format" and will error with

~/cclib/cclib/parser/molcasparser.py in extract(self, inputfile, line)
    825                             info = tokens[3:]
    826                             j = 0
--> 827                             for i in orbital_index:
    828                                 print(line)
    829                                 mocoeffs[int(i)-1].append(float(info[j]))

UnboundLocalError: local variable 'orbital_index' referenced before assignment

when encountering the "compact format".

The manual claims that the compact format is selected automatically when the number of molecular orbitals exceeds 256 but I encountered this already for a case of 124 orbitals.

The relevant section in cclib starts in

###
# All orbitals with orbital energies smaller than E(LUMO)+0.5 are printed
#
# ++ Molecular orbitals:
# -------------------
#
# Title: RKS-DFT orbitals
#
# Molecular orbitals for symmetry species 1: a
#
# Orbital 1 2 3 4 5 6 7 8 9 10
# Energy -10.0179 -10.0179 -10.0075 -10.0075 -10.0066 -10.0066 -10.0056 -10.0055 -9.9919 -9.9919
# Occ. No. 2.0000 2.0000 2.0000 2.0000 2.0000 2.0000 2.0000 2.0000 2.0000 2.0000
#
# 1 C1 1s -0.6990 0.6989 0.0342 0.0346 0.0264 -0.0145 -0.0124 -0.0275 -0.0004 -0.0004
# 2 C1 2s -0.0319 0.0317 -0.0034 -0.0033 -0.0078 0.0034 0.0041 0.0073 -0.0002 -0.0002
# ...
# ...
# 58 H18 1s 0.2678
# 59 H19 1s -0.2473
# 60 H20 1s 0.1835
# --
if '++ Molecular orbitals:' in line:
self.skip_lines(inputfile, ['d', 'b'])
line = next(inputfile)

I currently don't have time to add support for the compact format myself -- but until support for the "compact format" is added to cclib, as a workaround openmolcas users can add the keyword PRORBITALS=1 3 to the SCF section to select the "default format" independent of molecule size.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0