Parsing a QChem Output File: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
| Line 16: | Line 16: | ||
geometry |
geometry |
||
</pre> |
</pre> |
||
However you can use the find_sections method to detect extra sections which may be parsed. In this example the output file is for a simple |
However you can use the find_sections method to detect extra sections which may be parsed. In this example the output file is for a simple single-point calculation. |
||
<pre> |
<pre> |
||
>> print(parser.find_sections()) |
>> print(parser.find_sections()) |
||
Latest revision as of 17:12, 1 April 2026
Summary
To extract all data from a QChem output file, you can use the QChemParser object from
qcmagic.interfaces.parsers.qchem_parser.qchem_parser
Parsing is not automatic, you first have to create a parser object
parser = QChemParser('/path/to/file.out')
The actual parsing occurs when you call the parser object with a list of sections you want it to parse, if you pass an empty list then it only parses the default sections, which are prelude, input, molecule, rem, postlude and geometry.
>> data = parser([]) >> for key in data.keys(): print(key) prelude input molecule rem postlude geometry
However you can use the find_sections method to detect extra sections which may be parsed. In this example the output file is for a simple single-point calculation.
>> print(parser.find_sections()) ['input', 'sno', 'number_of_electrons', 'scf', 'mos'] >> data = parser(['number_of_electrons', 'scf']) >> for key in data.keys(): print(key) prelude input molecule rem number_of_electrons scf postlude geometry
Each of the keys corresponds to a dictionary containing the relevant information, for example we can look at the 'scf' information
>> print(data['scf'])
{'cycles': {1: {'energy': -0.6434040867, 'diis error': 9.04e-17}, 2: {'energy': -1.0661086494, 'diis error': 9.04e-17}}, 'minima': {0: {}}}