pyqmmm.qm.energy_plotter

Generalizable script for plotting the PES of an xyz trajectory.

Module Contents

Functions

write_energies_to_csv(energies_by_file, ...[, filename])

Write the energies to a CSV file.

parse_energy(line, software)

Parse the energy from a line based on the software used.

get_trajectory_energies(filename, software)

Parse the energies from an xyz trajectory file.

identify_software(line)

Identify the software used for the calculation from a line.

format_plot(→ None)

General plotting parameters for the Kulik Lab.

collect_data()

Collect energies from the files and decide whether to plot relative to lowest energy.

plot_data(energies_by_file, min_first_energy, ...)

Plot the collected energies.

plot_energies()

Main function that combines previous functions to generate the plot.

Attributes

HARTREE_TO_KCAL

pyqmmm.qm.energy_plotter.HARTREE_TO_KCAL = 627.509
pyqmmm.qm.energy_plotter.write_energies_to_csv(energies_by_file, energies_hartrees_by_file, filename='energy_plot_data.csv')[source]

Write the energies to a CSV file.

Parameters:
  • energies_by_file (dict) – A dictionary with filenames as keys and corresponding energies as values in kcal/mol.

  • energies_hartrees_by_file (dict) – A dictionary with filenames as keys and corresponding energies as values in Hartrees.

  • filename (str) – The name of the output CSV file.

pyqmmm.qm.energy_plotter.parse_energy(line, software)[source]

Parse the energy from a line based on the software used.

Parameters:
  • line (str) – Line from the file containing energy information.

  • software (str) – The software used for the calculation.

Returns:

The energy extracted from the line, in Hartrees.

Return type:

float

pyqmmm.qm.energy_plotter.get_trajectory_energies(filename, software)[source]

Parse the energies from an xyz trajectory file.

Parameters:
  • filename (str) – Path to the trajectory file.

  • software (str) – Software used for the calculation.

Returns:

First value is a list of energies for each frame, in kcal/mol, relative to the first frame. Second value is the first frame energy in kcal/mol. Third value is a list of absolute energies in Hartrees.

Return type:

tuple

pyqmmm.qm.energy_plotter.identify_software(line)[source]

Identify the software used for the calculation from a line.

Parameters:

line (str) – Line from the file.

Returns:

Identifier of the software used for the calculation.

Return type:

str

pyqmmm.qm.energy_plotter.format_plot() None[source]

General plotting parameters for the Kulik Lab.

pyqmmm.qm.energy_plotter.collect_data()[source]

Collect energies from the files and decide whether to plot relative to lowest energy.

Returns:

  • dict – A dictionary with filenames as keys and corresponding energies as values in kcal/mol.

  • float – The minimum first frame energy.

  • bool – Whether to plot energies relative to the lowest energy.

  • dict – A dictionary with filenames as keys and corresponding absolute energies as values in Hartrees.

pyqmmm.qm.energy_plotter.plot_data(energies_by_file, min_first_energy, plot_relative_to_lowest)[source]

Plot the collected energies.

Parameters:
  • energies_by_file (dict) – A dictionary with filenames as keys and corresponding energies as values.

  • min_first_energy (float) – The minimum first frame energy.

  • plot_relative_to_lowest (bool) – Whether to plot energies relative to the lowest energy.

pyqmmm.qm.energy_plotter.plot_energies()[source]

Main function that combines previous functions to generate the plot.