PyCatKin classes

Submodules

pycatkin.classes.state module

class pycatkin.classes.state.ScalingState(state_type=None, name=None, path=None, vibs_path=None, sigma=None, mass=None, inertia=None, gasdata=None, add_to_energy=None, path_to_pickle=None, read_from_alternate=None, truncate_freq=True, energy_source=None, freq_source=None, freq=None, i_freq=None, Gelec=None, Gzpe=None, Gvibr=None, Gtran=None, Grota=None, Gfree=None, scaling_coeffs=None, scaling_reactions=None, dereference=False, use_descriptor_as_reactant=False)[source]

Bases: State

calc_electronic_energy(verbose=False)[source]

Calculates potential energy from scaling relation.

Saves value in eV.

calc_free_energy(T, p, verbose=False)[source]

Calculates free energy.

Saves value in eV.

save_pdb(path=None)[source]

Saves the atoms object as a pdb structure file.

save_pickle(path=None)[source]

Save the state as a pickle object.

view_atoms(rotation='', path=None)[source]

Views the atoms object using the ASE visualizer. If path is not None, saves as a png.

class pycatkin.classes.state.State(state_type=None, name=None, path=None, vibs_path=None, sigma=None, mass=None, inertia=None, gasdata=None, add_to_energy=None, path_to_pickle=None, read_from_alternate=None, truncate_freq=True, energy_source=None, freq_source=None, freq=None, i_freq=None, Gelec=None, Gzpe=None, Gvibr=None, Gtran=None, Grota=None, Gfree=None)[source]

Bases: object

calc_electronic_energy(verbose=False)[source]

Calculates electronic energy.

Saves value in eV.

calc_free_energy(T, p, verbose=False)[source]

Calculates free energy.

Saves value in eV.

calc_rotational_contrib(T, verbose=False)[source]

Calculates rotational contribution to free energy accounting for linear/non-linear molecule.

Saves value in eV.

calc_translational_contrib(T, p, verbose=False)[source]

Calculates translational contribution to free energy.

Saves value in eV.

calc_vibrational_contrib(T, verbose=False)[source]

Calculates vibrational contribution to free energy.

Saves value in eV.

calc_zpe(verbose=False)[source]

Calculates zero point energy.

Saves value in eV.

get_atoms()[source]

Reads OUTCAR file from path and extracts atoms object.

get_free_energy(T, p, verbose=False)[source]

Returns the free energy in eV.

get_potential_energy(verbose=False)[source]

Returns the potential energy in eV.

get_vibrations(verbose=False)[source]

Reads vibrations file from path and extracts frequencies.

save_energy(path='')[source]

Save electronic energy to a file (in eV).

save_pdb(path=None)[source]

Saves the atoms object as a pdb structure file.

save_pickle(path=None)[source]

Save the state as a pickle object.

save_vibrations(vibs_path='')[source]

Save vibrations to a file (in Hz).

set_energy_modifier(modifier)[source]

Sets modifier to the energy.

Updates stored value in eV.

view_atoms(rotation='', path=None)[source]

Views the atoms object using the ASE visualizer. If path is not None, saves as a png.

pycatkin.classes.scaling module

pycatkin.classes.energy module

class pycatkin.classes.energy.Energy(name='landscape', minima=None, labels=None, path_to_pickle=None)[source]

Bases: object

construct_energy_landscape(T, p, verbose=False)[source]

Records free and electronic energies of minima and transition states on the energy landscape relative to the first entry in minima.

draw_energy_landscape(T, p, etype='free', eunits='eV', legend_location='upper right', verbose=False, path=None, show_labels=False, figtitle=None)[source]

Records free and electronic energies of minima and transition states on the energy landscape relative to the first entry in minima.

draw_energy_landscape_simple(T, p, fig, ax, linecolor='k', etype='free', eunits='eV', verbose=False, show_labels=False)[source]

Records free and electronic energies of minima and transition states relative to the first entry in minima on the supplied figure axis.

Return the updated figure axis.

evaluate_energy_span_model(T, p, etype='free', verbose=False, opath=None)[source]

Energy span calculations.

Returns turnover frequency (tof), relative contributions of transition states (num_i) and intermediates (num_j) and labels of both respectively (lTi, lIj).

save_pickle(path=None)[source]

Save the energy landscape as a pickle object.

pycatkin.classes.reaction module

class pycatkin.classes.reaction.Reaction(name='reaction', reac_type=None, reversible=True, reactants=None, products=None, TS=None, area=1e-19, scaling=1.0, path_to_pickle=None)[source]

Bases: object

calc_rate_constants(T, p, verbose=False)[source]

Computes reaction rate constants.

calc_reaction_energy(T, p, verbose=False)[source]

Computes reaction energies and barriers in J/mol.

get_reaction_barriers(T, p, verbose=False, etype='free')[source]

Returns the reaction barriers in J/mol.

get_reaction_energy(T, p, verbose=False, etype='free')[source]

Returns the reaction energy in J/mol.

save_pickle(path=None)[source]

Save the reaction as a pickle object.

class pycatkin.classes.reaction.ReactionDerivedReaction(reac_type, reversible=True, reactants=None, products=None, TS=None, area=1e-19, name='reaction', scaling=1.0, base_reaction=None)[source]

Bases: Reaction

calc_reaction_energy(T, p, verbose=False)[source]

Computes reaction energies and barriers in J/mol.

class pycatkin.classes.reaction.UserDefinedReaction(reac_type, reversible=True, reactants=None, products=None, TS=None, area=1e-19, name='reaction', scaling=1.0, dErxn_user=None, dEa_fwd_user=None, dEa_rev_user=None, dGrxn_user=None, dGa_fwd_user=None, dGa_rev_user=None)[source]

Bases: Reaction

calc_reaction_energy(T, p, verbose=False)[source]

Computes reaction energies and barriers in J/mol.

pycatkin.classes.reactor module

class pycatkin.classes.reactor.CSTReactor(name='reactor', volume=None, catalyst_area=None, residence_time=None, flow_rate=None)[source]

Bases: Reactor

get_dynamic_indices(adsorbate_indices, gas_indices)[source]

Returns which indicies in the solution vector experience transient changes.

jacobian(adsorbate_jacobian)[source]

Construct the Jacobian function. Multiplies the rows of the Jacobian by 1 if they are surface equations or sigma if they are gas equations. For rows corresponding to gases, adds flow derivative (-1/tau).

Returns a function handle.

rhs(adsorbate_kinetics)[source]

Construct the ODE right hand side (rhs). Multiplies the species ODEs by 1 if they are surface equations or sigma if they are gas equations. For gas equations, adds flow.

Returns a function handle.

class pycatkin.classes.reactor.InfiniteDilutionReactor(name='reactor', volume=None, catalyst_area=None, residence_time=None, flow_rate=None, path_to_pickle=None)[source]

Bases: Reactor

get_dynamic_indices(adsorbate_indices, gas_indices)[source]

Returns which indicies in the solution vector have transient change.

jacobian(adsorbate_jacobian)[source]

Construct the Jacobian function. Multiplies the rows of the Jacobian by 1 if they are required or 0 if they are not required (e.g., pressure boundary conditions).

Returns a function handle.

rhs(adsorbate_kinetics)[source]

Construct the ODE right hand side (rhs). Multiplies the species ODEs by 1 if they are required or 0 if they are not required (e.g., pressure boundary conditions).

Returns a function handle.

class pycatkin.classes.reactor.Reactor(name='reactor', volume=None, catalyst_area=None, residence_time=None, flow_rate=None, path_to_pickle=None)[source]

Bases: object

get_dynamic_indices(adsorbate_indices, gas_indices)[source]

Returns which indicies in the solution vector vary with time (e.g., not pressure boundary conditions for ID reactors).

jacobian(adsorbate_jacobian)[source]

Construct the Jacobian function. Multiplies the rows of the Jacobian by 1 if they are required or 0 if they are not required (e.g., pressure boundary conditions).

Returns a function handle.

rhs(adsorbate_kinetics)[source]

Construct the ODE right hand side (rhs). Multiplies the species ODEs by 1 if they are required or 0 if they are not required (e.g., pressure boundary conditions).

Returns a function handle.

save_pickle(path=None)[source]

Save the reactor as a pickle object.

set_indices(is_adsorbate, is_gas)[source]

Set which indicies in the solution vector correspond to adsorbate and gas species.

set_scaling(T)[source]

Scaling from per site per second to per Pa per second. site_density will be added when reaction rates are computed. P = nRT/V, n = (site_density * catalyst_area) / NA, kB = R / NA

pycatkin.classes.system module

class pycatkin.classes.system.System(path_to_pickle=None)[source]

Bases: object

activity(tof_terms, ss_solve=False)[source]

Calculate the activity from the TOF

Returns the activity.

add_energy_landscape(energy_landscape)[source]

Adds an energy landscape to the dictionary of reactions.

add_reaction(reaction)[source]

Adds a reaction to the dictionary of reactions.

add_reactor(reactor)[source]

Adds a reactor.

add_state(state)[source]

Adds a state to the dictionary of states and adds its name to the list of names. Checks state names are unique.

check_rate_constants()[source]

Check if the rate constants have been calculated and are updated to the current conditions.

degree_of_rate_control(tof_terms, ss_solve=False, eps=0.001)[source]

Calculate the degree of rate control xi_i

Returns array of xi_i terms for each step i.

find_steady(store_steady=False, plot_comparison=False, path=None)[source]

Solve for the steady state solution

Returns the steady state solution.

names_to_indices()[source]

Assigns indicies corresponding to the species for easier access to elements of the solution vector.

plot_transient(path=None)[source]

Plot transient rates, coverages and pressures. If path is specified, figures are saved to path

reaction_derivatives(y)[source]

Constructs derivative of reactions wrt each species by multiplying rate constants by reactant coverages/pressures.

Returns an (Nr x Ns) array of derivatives.

reaction_terms(y)[source]

Constructs forward and reverse reaction rate terms by multiplying rate constants by reactant coverages/pressures.

run_and_return_tof(tof_terms, ss_solve=False)[source]

Integrate or solve for the steady state and compute the TOF by summing steps in tof_terms

Returns array of xi_i terms for each step i.

save_pickle(path=None)[source]

Save the system as a pickle object.

set_parameters(times=None, start_state=None, inflow_state=None, T=293.15, p=101325.0, use_jacobian=True, ode_solver='solve_ivp', nsteps=10000.0, rtol=1e-08, atol=1e-10, xtol=1e-08, ftol=1e-08, verbose=False)[source]

Store simulation conditions, solver tolerances and verbosity.

solve_odes()[source]

Wrapper for ODE integrator.

species_jacobian(y)[source]

Constructs derivatives of species ODEs for adsorbate coverages and pressures.

Returns Jacobian with shape (Ns x Ns).

species_odes(y)[source]

Constructs ODEs for adsorbate coverages and pressures from the reaction rates.

Returns array of species ODEs.

write_results(path='')[source]

Write reaction rates, coverages and pressures to file. File written to current directory unless otherwise specified.

pycatkin.classes.uncertainty module

class pycatkin.classes.uncertainty.Uncertainty(sys=None, mu=0.0, sigma=0.01, nruns=1)[source]

Bases: object

get_correlated_state_noises()[source]

Samples a white noise value to add to adsorbate energies. Multiplies this by a uniform variate to perturb each transition state energy.

Returns a dictionary of state names and noises.

get_mean_property_value(property_handle)[source]

Uses the function property_handle to compute the property values for all noisy systems.

Returns the values, their mean and standard deviation.

get_noise(noise_type='white')[source]

Samples from either a Gaussian or uniform distribution. Default is white noise with mean zero and variance sigma^2.

Returns a noise value.

get_noisy_sys_samples()[source]

Runs the ODE solver for the original system and generates nruns copies, with noisy state energies. Runs the ODE solver for the noisy systems. Saves the perturbations used in each run.

set_correlated_state_noises(state_noises)[source]

Obtains a dictionary of state names and noises. Copies the system object and sets the perturbations for state energies in the new noisy system.

Returns the new noisy system.