Analysis¶
Tools for analysis of output exist here.
Module contents¶
- amp.analysis.calc_rmse(calc_paths, images, cores=None, dblabel=None, energy_coefficient=1.0, force_coefficient=0.04, charge_coefficient=10.0)[source]¶
Calculates energy and force RMSEs for a set of Amp calculators. All calculators must have the same descriptors and models.
- Parameters:
calc_paths (list) – List of paths for loading existing “.amp” files.
images (list or str) – List of ASE atoms objects with positions, symbols, energies, and forces in ASE format. This can also be the path to an ASE trajectory (.traj) or database (.db) file. Energies can be obtained from any reference, e.g. DFT calculations.
cores (int) – Can specify cores to use for parallel processing; if None, will determine from environment
dblabel (str) – Optional separate prefix/location of database files, including fingerprints, fingerprint primes, and neighborlists, to avoid calculating them. If not supplied, just uses the value from label.
energy_coefficient (float) – Coefficient of energy loss in the total loss function.
force_coefficient (float) – Coefficient of force loss in the total loss function.
charge_coefficient (float) – Coefficient of charge loss in the total loss function.
- amp.analysis.plot_convergence(data, plotfile='convergence.pdf')[source]¶
Makes a plot of the convergence of the cost function and its energy and force components.
- amp.analysis.plot_parity_and_error(calc, images, label_parity='parity', label_error='error', dblabel=None, xtic_angle=45.0, plot_forces=True, plot_charges=False, plotfile_parity=None, plotfile_error=None, color='b.', overwrite=False, returndata=False)[source]¶
Makes a parity plot and an error plot of Amp energies and forces versus real energies and forces.
- Parameters:
calc (Amp object or str) – Either an existing instantiated Amp calculator or a path for loading an existing “.amp” file. In the latter case, should be fed like ‘load=”filename.amp”’.
images (list or str) – List of ASE atoms objects with positions, symbols, energies, and forces in ASE format. This can also be the path to an ASE trajectory (.traj) or database (.db) file. Energies can be obtained from any reference, e.g. DFT calculations.
label_parity (str) – Default prefix/location used for the parity plot.
label_error (str) – Default prefix/location used for the error plot.
dblabel (str) – Optional separate prefix/location of database files, including fingerprints, fingerprint primes, and neighborlists, to avoid calculating them. If not supplied, just uses the value from label.
xtic_angle (float) – Set the xtics angles. Default is 45.
plot_forces (bool) – Determines whether or not forces should be plotted as well.
plot_charges (bool) – Determines whether or not charges should be plotted as well.
plotfile_parity (Object) – File for the parity plot.
plotfile_error (Object) – File for the error plot.
color (str) – Plot color.
overwrite (bool) – If a plot or an script containing values found overwrite it.
returndata (bool) – Whether to return a reference to the figures and their data or not.
- amp.analysis.plot_sensitivity(calc, images, d=0.0001, label='sensitivity', dblabel=None, plotfile=None, overwrite=False, energy_coefficient=1.0, force_coefficient=0.04, charge_coefficient=10.0)[source]¶
Returns the plot of loss function in terms of perturbed parameters.
Takes the load file and images. Any other keyword taken by the Amp calculator can be fed to this class also.
- Parameters:
calc (Amp object or str) – Either an existing instantiated Amp calculator or a path for loading an existing “.amp” file. In the latter case, should be fed like ‘load=”filename.amp”’.
images (list or str) – List of ASE atoms objects with positions, symbols, energies, and forces in ASE format. This can also be the path to an ASE trajectory (.traj) or database (.db) file. Energies can be obtained from any reference, e.g. DFT calculations.
d (float) – The amount of perturbation in each parameter.
label (str) – Default prefix/location used for all files.
dblabel (str) – Optional separate prefix/location of database files, including fingerprints, fingerprint primes, and neighborlists, to avoid calculating them. If not supplied, just uses the value from label.
plotfile (Object) – File for the plot.
overwrite (bool) – If a plot or an script containing values found overwrite it.
energy_coefficient (float) – Coefficient of energy loss in the total loss function.
force_coefficient (float) – Coefficient of force loss in the total loss function.
charge_coefficient (float) – Coefficient of charge loss in the total loss function.
- amp.analysis.read_trainlog(logfile, verbose=True, multiple=0, _shared=None)[source]¶
Reads the log file from the training process, returning the relevant parameters.
- Parameters:
logfile (str) – Name or path to the log file.
verbose (bool) – Write out logfile during analysis.
multiple (int or True) – If multiple training sessions are recorded in the same log file, return session number <multiple> (counting from 0). If set to True, returns all sessions as list.
_shared (dict or None) – Internal use. Metadata (no_images, convergence params) inherited from the first attempt when parsing retry attempts that lack headers.