8.3 Parse logs without manufacturing success
These are unexecuted teaching inputs and starting models. Original diagrams are schematics, not calculated results. Validate version-specific syntax, licensed or authorized data, numerical convergence and the scientific model before using this workflow.
8.3.1 Model, units and provenance
Geometry in Å; electronic energy in hartree; vibrational wavenumbers in cm⁻¹. Check each printed field and keep thermal and standard-state terms distinct.
Shared inputs, conventions and evidence
8.3.2 Unexecuted inputs and explicit deltas
Use the accompanying instructions to identify the parent calculation and placement of every delta; a snippet is not automatically a standalone input. Preserve all blank-line and file-provenance requirements.
8.3.2.1 Input block 1
from pathlib import Path
import hashlib, json, re, sys
def number(s):
return float(s.replace('D', 'E').replace('d', 'e'))
reports = []
for name in sys.argv[1:]:
path = Path(name)
raw = path.read_bytes()
text = raw.decode('utf-8', errors='replace')
scf = []
freq = []
for line_no, line in enumerate(text.splitlines(), 1):
m = re.search(r'SCF Done:\s+E\(([^)]+)\)\s*=\s*([-+0-9.DEde]+)', line)
if m:
scf.append({'line': line_no, 'method_label': m.group(1),
'energy_hartree': number(m.group(2))})
if 'Frequencies --' in line:
values = line.split('Frequencies --', 1)[1].split()
freq.append({'line': line_no,
'wavenumbers_cm_minus_1': [number(x) for x in values]})
flat = [v for row in freq for v in row['wavenumbers_cm_minus_1']]
reports.append({
'file': str(path), 'sha256': hashlib.sha256(raw).hexdigest(),
'normal_termination_count': text.count('Normal termination of Gaussian'),
'error_termination_count': text.count('Error termination'),
'optimization_completed_count': text.count('Optimization completed'),
'scf_records': scf, 'frequency_blocks': freq,
'printed_negative_frequency_count': sum(v < 0 for v in flat),
'review_required': True,
'scope_note': 'SCF values are not post-HF totals; multiple jobs require segmentation.'
})
print(json.dumps(reports, indent=2, ensure_ascii=False))
8.3.3 Worked investigation
8.3.3.1 Intuition and prerequisites
A reproducible calculation should leave enough evidence for someone else to reconstruct the model and audit each reported quantity. Automation helps gather that evidence, but a parser can also create false confidence by collecting an early SCF energy from a failed job. This case supplies a small read-only Python extractor that reports observations, not a verdict of scientific validity. It keeps all SCF records and all printed frequencies rather than silently selecting one. Prerequisites: saved logs from earlier cases, Python 3, and a willingness to compare machine output against the original text.
8.3.3.2 Original read-only extraction script
See input block 1 above.
Run it as python3 audit_gaussian.py g08_water_opt.log g10_water_freq.log > audit.json, substituting real existing names. This program only reads logs and writes its redirected JSON output.
8.3.3.3 Workflow
- Build an archive containing original input, full log, final coordinates, binary/formatted checkpoint where allowed, scheduler output, and a method ledger.
- Run the extractor, then manually verify one energy and one frequency by its reported line number.
- Test on a known incomplete log. Confirm that extracted numbers still appear while the report continues to require review.
- For Link1 or concatenated logs, split or label task segments before selecting final quantities. Compare expected job count with actual termination records.
- Write a small result manifest with quantity, value, unit, job identifier, source line, geometry source, and validation status.
- Re-run the parser after any output replacement and compare hashes. Do not let a stale JSON summary outlive a changed source log.
8.3.3.4 Interpret check and limits
The number of negative printed frequencies is not the number of saddle directions in an arbitrary combined log: it may include multiple geometries, isotope analyses, or repeated calculations. This parser intentionally does not extract post-HF total energies, TD roots, thermal corrections, solvent contributions, or atom mappings; each requires task-aware logic. A checksum detects file changes but does not validate chemistry. Protect proprietary binaries and license material when packaging reproducibility files. Record software revision and external basis provenance rather than redistributing restricted software. Raw outputs can contain paths or usernames; review them before public release.
Exercise Extend the schema with an explicit job_segment identifier and an expected-task list. Write two tests: one complete optimization plus failed frequency job, and one complete two-job file. Do not label the first “success”.
8.3.4 Related calculations
- 8.2 One node resources scratch and a safe Slurm launch
- 8.4 A formaldehyde study with an uncertainty ledger