Skip to content

Population Analysis

The propagation output generated by MCTDH contains the electronic populations at every output time step. Although these populations are written directly to the output file, they are embedded among many other quantities such as natural weights and vibrational expectation values, making them inconvenient for plotting or further analysis.

To simplify post-processing, we use a small Fortran program that extracts only the propagation time and electronic populations from the MCTDH output and writes them into a separate data file (pop.dat). This file can then be used directly for plotting and analysing the population dynamics.


Workflow

The complete population extraction workflow is

MCTDH Output
   pop.f
  pop.exe
   output file
   pop.dat
Population Plot

Population Extraction Program

The program used to extract the populations is a simple Fortran utility named

pop.f

Download Complete Code

Its purpose is to search the MCTDH output file for

  • the propagation time (Time = ...)
  • the electronic population (population :)

and write these quantities into a new file named

pop.dat

Program Logic

The extraction program performs the following steps.

  1. Open the MCTDH output file.
  2. Search for every line beginning with Time.
  3. Store the propagation time.
  4. Continue searching until the corresponding population line is found.
  5. Write both quantities to a new file.
  6. Repeat until the end of the output file.

As a result, each row of pop.dat contains the propagation time followed by the populations of all electronic states.


Compiling the Program

Compile the source code using the GNU Fortran compiler.

Compile the population extraction program

gfortran pop.f -o pop.exe

This creates an executable named

pop.exe

Download Executable File


Installing the Executable

To make the program available from any working directory, move the executable to your local binary directory.

Install pop.exe

mv pop.exe ~/bin/

If ~/bin is included in your PATH, the program can now be executed from any directory without specifying its full path.


Running the Program

Move into the directory containing the MCTDH output file.

For example,

/home/user/dae/i-of-dynamics/wp3-pbf1-spf1/

Run the extraction program

Generate pop.dat

pop.exe

The program automatically

  • reads the file named output,
  • extracts every propagation time,
  • extracts the corresponding electronic populations,
  • writes the results into
pop.dat

No additional user input is required.


Generated Population File

A typical pop.dat file is shown below.

Snippet — pop.dat

0.00  0.00000  0.00000  1.00000  0.00000
0.50  0.16042  0.00321  0.82544  0.01093
1.00  0.04725  0.00673  0.90479  0.04123
1.50  0.07612  0.01852  0.84259  0.06276
2.00  0.11850  0.02711  0.73200  0.12237
2.50  0.01927  0.04074  0.80075  0.13924
3.00  0.12520  0.05350  0.63819  0.18310
3.50  0.03527  0.05855  0.69436  0.21180
4.00  0.08279  0.06952  0.62339  0.22428
4.50  0.07628  0.06375  0.58657  0.27337
...

Each row corresponds to one propagation time written by MCTDH.


Understanding pop.dat

The file contains one column for the propagation time followed by one column for each electronic state.

Column Description
Column 1 Propagation time (fs)
Column 2 Population of electronic State 1
Column 3 Population of electronic State 2
Column 4 Population of electronic State 3
Column 5 Population of electronic State 4

For a calculation involving N electronic states, the file will contain N + 1 columns.


Example Interpretation

The first two rows of the file are

0.00  0.00000  0.00000  1.00000  0.00000

0.50  0.16042  0.00321  0.82544  0.01093

At 0.00 fs, the wavepacket is entirely localized on State 3, as indicated by

Population(State 3) = 1.00000

After 0.50 fs, the population has redistributed among the electronic states,

State Population
State 1 0.16042
State 2 0.00321
State 3 0.82544
State 4 0.01093

This redistribution reflects the onset of nonadiabatic population transfer driven by the vibronic couplings included in the Hamiltonian.


Advantages of pop.dat

Compared with the original MCTDH output, the extracted population file is

  • significantly smaller,
  • easier to read,
  • directly compatible with plotting software,
  • convenient for further numerical analysis.

Most visualization programs such as GNUplot, Python/Matplotlib, Origin, Grace, and MATLAB can read pop.dat without any additional processing.


Next Step

Now Visualise the pop.dat with

xmgrace -nxy pop.dat

This will plot all the electronic states population with time, Now you can analyze how a wavefunction propogates when initialized to a certain state.