ichor.core.analysis.dlpoly package
Submodules
ichor.core.analysis.dlpoly.dlpoly_analysis module
- get_dlpoly_energies(optimum_energy: float, dlpoly_directory: Path, output: Path = PosixPath('dlpoly-energies.xlsx'))
- read_fflux(fflux_file: Path) Dict[str, ndarray]
- read_wfn_energy(wfn_file: Path) float
ichor.core.analysis.dlpoly.dlpoly_files module
ichor.core.analysis.dlpoly.mae_forces module
- mae_forces(predicted_forces_array: ndarray, true_forces_array: ndarray, atom_names: List, output_name='output.png')
Plots a matshow in matplotlib of the MAE of the predicted forces array vs the true forces array
- Parameters:
predicted_forces_array – Predicted forces array of shape ntimesteps x natoms x 3.
true_forces_array – True forces array of shape ntimesteps x natoms x 3
ichor.core.analysis.dlpoly.plot_energy module
- format_energy_plots(ax, xlabel='Timestep', major_grid_linewidth=4.0, minor_grid_linewidth=4.0, xlabel_fontsize=20, label_pad=1.0, tick_params_labelsize=48, tick_params_pad=15, major_tick_params_length=6.0, major_tick_params_width=4, minor_tick_params_length=3.0, minor_tick_params_width=4.0)
- plot_differences(data: DlPolyFFLUX | FFLUXDirectory, until_converged: bool = True, absolute: bool = False, title: str = '')
Plots the differences between one timestep and the next timestep (in kJ mol-1) from the FFLUX file for every pair of timesteps
If until_coverged is True, it will only plot the difference until the timestep where the difference to the next timestep is less that 1e-4 kJ mol-1.
- Parameters:
data – A FFLUX file or directory containing a FFLUX file to read data from.
until_converged – Plot timesteps and ifference until energy is converted to 1e-4 kJ mol-1, defaults to True
absolute – Plot the absolute of the differences between each timestep
title – Title for plot
- plot_total_energy(data: DlPolyFFLUX | FFLUXDirectory | List[DlPolyFFLUX] | List[FFLUXDirectory], until_converged: bool = True, reference: List[float] | None = None, HEIGHT=6, WIDTH=12, FIGURE_LABEL_SIZE=30, X_Y_LABELS_FONTSIZE=30, TICKLABELS_FONTSIZE=22, LABELPAD=10, AXES_PADDING=10.0, LINEWIDTH=2.0, MAJOR_TICK_LENGTH=6.0, MINOR_TICK_LENGTH=3.0, PAD_INCHES=0.05, add_letter=False, filename: str = 'total_energy.svg')
Plots the predicted total energy of the system (in kJ mol-1) from the fflux simulation for every timestep.
If until_coverged is True, it will only plot the timesteps until the timestep where the difference to the next timestep is less that 1e-4 kJ mol-1.
- Parameters:
data – A FFLUX file or directory containing a FFLUX file to read data from.
until_converged – Plot timesteps until energy is converted to 1e-4 kJ mol-1, defaults to True.
reference – A reference value to subtract (could be the Gaussian optimized minimum). This value has to be in kJ mol-1. If a list is passed in as data, then this reference must also be a list of the same length as data.
FIGURE_LABEL_SIZE – The size of the figure labels (A, B, C, etc.), defaults to 30
X_Y_LABELS_FONTSIZE – The size of the x and y axis labels, defaults to 30
TICKLABELS_FONTSIZE – The size of the tick labels on the axes, defaults to 22
LABELPAD – The padding of the x and y labels from the plot, defaults to 10
AXES_PADDING – The padding of the number on the axes from the plots, defaults to 10.0
LINEWIDTH – The width of the lines, defaults to 2.0
MAJOR_TICK_LENGTH – The length of the major ticks, defaults to 6.0
MINOR_TICK_LENGTH – The length of the minor ticks, defaults to 3.0
PAD_INCHES – Padding on the sides of the plot (as tight layout is used), defaults to 0.05
filename – The filename to save as. Note that the extension determines how the fine is saved (png, svg), defaults to “total_energy.svg”
- plot_total_energy_from_array(data: ndarray, title: str = '', reference: float | None = None)
Plots the given predicted data (in kJ mol-1) against timesteps
If until_coverged is True, it will only plot the timesteps until the timestep where the difference to the next timestep is less that 1e-4 kJ mol-1.
- Parameters:
data – A np array containing predicted total energy data
title – Title for plot
referece – reference Gaussain energy
- round_base_10(x)
ichor.core.analysis.dlpoly.true_vs_predicted module
- get_random_geometries_from_fflux_simulation(history: DlPolyHistory | Path | str, k: int = 1000, fflux_file: DlPolyFFLUX | Path | str | None = None)
Gets random geometries from fflux simulation, so that the true energy from Gaussian can be computed from the geometries. This function writes out several files. 1. New trajectory containing random geometries to be submitted to Gaussian. 2. A txt file containing the indices of the random geometries taken from the HISTORY 3. If a FFLUX file is given, it writes out a .npy file containing the predicted total energy associated with the random geometries. If not give, the user can use the .txt file and obtain the energies from the FFLUX file themselves.
- Parameters:
history – A HISTORY file or path to HISTORY file containing FFLUX geometries
k – How many geometries to get from the HISTORY, defaults to 1000
fflux_file – A FFLUX file where to get the total predicted energies associated with the HISTORY file, defaults to None. If given, this will write out a .npy file containing predicted total energies array. If not given, it will not write out the np array.
- plot_true_vs_predicted_from_arrays(predicted_energies_array_hartree: ndarray, true_energies_array_hartree: ndarray | List[PointsDirectory], absolute_diff: bool = True, FIGURE_LABEL_SIZE=48, WIDTH=16, HEIGHT=6, X_Y_LABELS_FONTSIZE=48, TICKLABELS_FONTSIZE=30, LABELPAD=15.0, AXES_PADDING=10.0, LINEWIDTH=2.0, MAJOR_TICK_LENGTH=6.0, MINOR_TICK_LENGTH=3.0, LEGEND_BORDERPAD=15.0, LEGEND_FRAME_WIDTH=2.0, COLORBAR_PADDING=5.0, PAD_INCHES=0.05, add_fig_letter=False, r2_bbox_anchor=(0.9, 0.23), colorbar_label_fontsize=15, filename='output.svg')
Plots true vs predicted energies, as well as calculates R^2 value
- Parameters:
predicted_energies_array_hartree – np array containing FFLUX predicted energies In hartrees
true_energies_array_hartree – a np.array cotaning true energies (in hartrees) or a PointsDirectory (containing ordered wfns from which to get the array) again in Hartrees
title – The title of the plot, defaults to “”
absolute_diff – Whether to use the absolute of the differences of true and predicted or not, defaults to True
FIGURE_LABEL_SIZE – The label size of the figures (A, B, C, etc.), defaults to 48
X_Y_LABELS_FONTSIZE – The size of the x and y axis labels, defaults to 48
TICKLABELS_FONTSIZE – The fontsize of the ticklabels, defaults to 30
LABELPAD – The padding of the x y labels from plot, defaults to 15.0
AXES_PADDING – The padding of axes numbers from plot, defaults to 10.0
LINEWIDTH – The width of lines, defaults to 2.0
MAJOR_TICK_LENGTH – The width of major tickmarks, defaults to 6.0
MINOR_TICK_LENGTH – The width of minor tickmarks, defaults to 3.0
LEGEND_BORDERPAD – The border padding of the legend, defaults to 15.0
LEGEND_FRAME_WIDTH – The width of the legend frame, defaults to 2.0
COLORBAR_PADDING – The padding of the colorbar axes, defaults to 5.0
PAD_INCHES – padding on the sides (as tight layout is used), defaults to 0.05
filename – The filename. Note the extension affects the format of the file , defaults to “output.svg”
- plot_true_vs_predicted_from_arrays_one_system(predicted_energies_array_hartree: ndarray, true_energies_array_hartree: ndarray | List[PointsDirectory], absolute_diff: bool = True, filename='output.svg')
Plots true vs predicted energies, as well as calculates R^2 value
- Parameters:
predicted_energies_array_hartree – np array containing FFLUX predicted energies In hartrees
true_energies_array_hartree – a np.array cotaning true energies (in hartrees) or a PointsDirectory (containing ordered wfns from which to get the array) again in Hartrees
absolute_diff – Whether to use the absolute of the differences
- r2_score(true, predicted)