Script Explanation¶
The operator-make.sh script automates the construction of an MCTDH operator file by collecting information from several electronic structure calculations and formatting it into the syntax required by MCTDH.
Instead of manually writing every Hamiltonian parameter, the script extracts the required quantities, processes them, and assembles a complete operator file. The overall workflow is illustrated below.
frequency.dat
│
│
Reference Diabatic Log
│
│
Mode Coupling Files
│
▼
operator-make.sh
│
┌──────────────┼──────────────┐
│ │ │
▼ ▼ ▼
Energy Frequencies Couplings
Extraction Reading Formatting
│ │ │
└──────────────┼──────────────┘
▼
MCTDH Operator File
The script can be divided into several independent stages.
Skip
You can skip this section too as it explains the simple bash shell commands
1. User Input¶
The script first requests the basic information required to define the Hamiltonian.
These include
- Number of electronic states
- Reference diabatic GAMESS output
- Number of active vibrational modes
- Selected mode numbers
- File naming convention
- Output operator filename
These inputs determine which electronic states and vibrational modes are included in the final operator file.
2. Electronic Energy Extraction¶
The reference diabatic GAMESS output contains the energies of every electronic state together with the interstate electronic couplings.
The script automatically searches the output file and extracts
- diagonal electronic energies
- interstate electronic couplings
The lowest electronic state is taken as the reference, and all remaining energies are shifted relative to it before being converted into electron volts.
The extracted values are written into an intermediate file named
which is later used while constructing the parameter section of the operator file.
3. Reading Vibrational Frequencies¶
The harmonic vibrational frequencies are read from
Only the vibrational modes selected by the user are retained.
The frequencies are converted from cm⁻¹ into electron volts (eV) because MCTDH internally expects energies in atomic units or electron volts depending on the operator definition.
These frequencies become the parameters
used throughout the Hamiltonian.
4. Reading Vibronic Coupling Parameters¶
For every selected normal mode, the script reads the corresponding fitted coupling file.
These files contain the linear and quadratic coupling constants obtained from the nonlinear fitting procedure described in the previous section.
Each file contributes
- intrastate linear couplings
- interstate linear couplings
- quadratic coupling constants
to the final Hamiltonian.
5. Formatting Coupling Parameters¶
The coupling files contain numerical fitting parameters but not the syntax required by MCTDH.
Instead of formatting these manually, the Bash script automatically calls the accompanying Fortran program
for every selected vibrational mode.
The Fortran program converts the fitted parameters into the parameter definitions expected by the MCTDH operator format.
The generated coupling definitions are then appended to the operator file.
6. Writing the Parameter Section¶
After all quantities have been collected, the script writes the Parameter Section of the operator file.
This section contains
- vibrational frequencies
- electronic energies
- interstate couplings
- linear vibronic coupling constants
- quadratic vibronic coupling constants
Every numerical quantity used later in the Hamiltonian is defined here.
7. Writing the Hamiltonian¶
The script then constructs the Hamiltonian definition.
The Hamiltonian consists of
- vibrational kinetic energy
- harmonic potential energy
- electronic state energies
- linear vibronic coupling terms
- quadratic vibronic coupling terms
Every coupling parameter defined previously is referenced inside this section to construct the complete vibronic Hamiltonian.
8. One-Dimensional Hamiltonians¶
Finally, the script automatically generates separate Hamiltonians for each vibrational mode.
These one-dimensional Hamiltonians are primarily used during the diagonalization step to obtain the single-particle functions (SPFs) required by MCTDH.
Each Hamiltonian contains only
- kinetic energy
- harmonic potential
- linear coupling
- quadratic coupling
for one vibrational coordinate.
Generated Files¶
After successful execution, the script produces
| File | Purpose |
|---|---|
energy.dat |
Intermediate file containing diabatic energies and interstate couplings |
operator.op |
Complete MCTDH operator file |
| Temporary files | Automatically removed after completion |
Summary¶
The operator-make.sh script serves as the central automation tool for operator generation. It extracts electronic energies from the reference GAMESS calculation, reads the vibrational frequencies and fitted coupling parameters, invokes the accompanying Fortran program to format the coupling constants, and finally assembles a complete MCTDH operator file that can be used directly for wavepacket propagation or Hamiltonian diagonalization.
The following section explains how the accompanying operator.f90 program converts the fitted vibronic coupling parameters into the syntax required by MCTDH.