matmacore package
Submodules
matmacore.mol module
- class matmacore.mol.Mol(path=None)[source]
Bases:
objectA class that can parse log files from different Computational Software. It can parse log files from Gaussian 16, xvg files from Gromacs, out files from ORCA, and log files from CP2K.
- connectivity_matrix(distXX=1.65, distXH=1.15)[source]
Creates a connectivity matrix of the molecule. A connectivity matrix holds the information of which atoms are bonded and to what.
- Parameters:
distXX – The max distance between two atoms (not hydrogen) to be considered a bond
distXH – The max distance between any atom and a hydrogen atom to be considered a bond
- cp2k(file=None, job_type='md', colvar=None, timestep=None)[source]
Parses information from CP2K. Right now only works for AIMD Trajectories, plan to implement opt compatability later.
- Parameters:
job_type – (string) Currently only md is supported. Should be manually specified.
colvar – (list) A list containing the atom numbers that define your collective variable.
timestep – (float) Timestep of your MD calculation. The function will attempt to extract this from your input file if present.
traj_file – (string) File containing the CP2K trajectory.
input_file – (string) File containing your CP2K inputs.
output_file – (string) File containing your CP2K output.
- csv(file, skiprows=1, dtype=<class 'float'>, delimiter: str = ', ')[source]
Parses a csv file and appends the data to the mol object
- Parameters:
file – (string) File containing the csv data.
skiprows – (int) Number of rows to skip
dtype – (type) Data type
delimiter – (str) Delimiter
- element_symbol()[source]
A dictionary for atomic number and atomic symbol :param A: either atomic number or atomic symbol for Hydrogen, Carbon, Nitrogen, Oxygen, Fluorine and Silicon :return: the corresponding atomic symbol or atomic number
- gaussian()[source]
Parses log files from Gaussian 16 and appends information inside the log file to the mol object.
- class matmacore.mol.Reaction(mol_list, mol_label)[source]
Bases:
objectA class that organizes several molecules into a reaction
- static combiner(mol_list)[source]
Adds the energies for multiple molecules and returns a new mol object.
- Parameters:
mol_list – (list) List of molecule objects.
- Returns:
mol
- create_mol_list()[source]
Creates Mol objects from user-specified groups of directories and labels.
- Parameters:
*groups – Variable number of groups, where each group is a list of directories followed by a label.
- Returns:
List of Mol objects. mol_label (list): List of labels for the Mol objects.
- Return type:
mol_list (list)
- create_reaction_list()[source]
Creates a standardized reaction list with names from input definitions.
- Parameters:
*reaction_definitions – Variable number of reaction definitions where each is: (reaction_name, [dir1, dir2, ‘label’], [dir3, ‘label’], …)
- Returns:
[(reaction_name, mol_list, labels), …]
- Return type:
list
matmacore.plot module
- class matmacore.plot.Plot(data=None, desc: list = None)[source]
Bases:
objectA class that creates plots from a numpy array. It can make reaction coordinate diagrams, RMSD and RMSF trajectory plots, Free energy plots, Scatter Plots, and SNFG Figures.
- cmap(color_num: int = None, offset: float = 0, map: str = 'ice', reverse: bool = False)[source]
Generates and processes a colormap with optional offsetting logic. :param color_num: (int) Number of discrete colors. :param offset: (float) Fractional offset to shift the colormap. :param map: (str) Name of the colormap from the colormaps library.
- contour(xpm_mols, limit=16)[source]
Plots contour maps for a provided list of moles from xpm files. :param xpm_mols: (List) List of mol objects generated from xpm files. :param limit: (Int) The upper limit on your energy scale
- fes(mol, cols=[1, 2], temp=300, num_levels=8, num_ticks=8)[source]
Plots MD FES. Takes in data for CP2K or Gromacs via Mol. :param mol: (Mol) Class Mol. :param cols: (int) Index of the 2 columns containing your colvar data, in the case that you have more than 2.
- foo_plot(mol, SCR=None, w=0.5)[source]
Not a bar plot. Mostly used for SCR stuff :param mol: (mol) mol objects generated from csv files. :param SCR: (list) Specifies specific SCRs to plot from your data. Otherwise, default is to plot them all. :param w: (float) Width of the lines in the foo plot.
- multi_profile(reaction_data, labels=None, type=<class 'str'>, units='kcal')[source]
Plots multiple reaction profiles, accepting either: - Raw mol_lists + labels, or - Reaction list from create_reaction_list()
- Parameters:
reaction_data – Either list of mol_lists OR output from create_reaction_list()
labels – Optional if using create_reaction_list() output
type – Energy type (‘E’, ‘F’, or ‘H’)
units – Energy units (‘kcal’, ‘Eh’, or ‘kJ’)
- puckers_hist(mol_pucker, mol_fem, puckers=['1C4', '1,4B'], limit=16, temp=300)[source]
Plots ring pucker free energy surface. Requires 2 mol objects to run. :param mol_pucker: (Mol) Class Mol containing the .xvg file for your ring pucker determination. :param mol_fem: (Mol) Class Mol containing the .xvg file for your free energy surface.
- rdf(mol, xmin=0, xmax=10)[source]
Plots radial distribution function. :param mol: (Mol) Class Mol generated from xvg file :param xmin: (Int) Minimum x value for rdf plot :param xmax: (Int) Maximum x value for rdf plot
- reaction_profile(mol_list, labels, type=<class 'str'>, units='kcal')[source]
Plots a reaction coordinate diagram.
- Parameters:
mol_list (list) – a list of mol objects
labels (list) – a list of labels for the mol objects
type (str) – the type of energy that will be plotted (‘E’ or ‘F’ or ‘H’)
units (str) – the units of energy to be used (‘kcal’, ‘Eh’, or ‘kJ’). Default is ‘kcal’.
- Returns:
A Reaction Coordinate Diagram Energy Plot
- trajectory(mol_list, var_name='colvar', col=1, average=None, title=None, hist=True, alpha=None, calc_qa=False, overlap=False)[source]
Plots MD trajectory with histogram. Takes in data for CP2K or Gromacs via Mol. :param molecule: (Mol / List) Either a Mol object, or a list of moles if you want to overlay data. :param var_name: (list) Name of the collective variable you are plotting on your y-axis. :param col: (int) Index of the column containing your colvar data, in the case that you have multiple.
matmacore.utilities module
- matmacore.utilities.get_distance(at1, at2)[source]
Finds the distance between two atoms :param at1: (list) a list of xyz coordinates of atom1 :param at2: (list) a list of xyz coordinates of atom2 :return: (float) the distance between 2 atoms
- matmacore.utilities.proper_minus(value)[source]
Replaces the default minus (-) with an actual minus sign instead of a dash
- matmacore.utilities.read_coordinates(xyz_file, atom_list)[source]
Extracts collective variables from an xyz file containing an MD trajectory (CP2K). :param xyz_file: (string) The xyz file containing your MD trajectory. :param atom_list: (list) a list of atoms that defines your collective variable. :return: (list) Distances / Angles / Dihedrals, corresponding with your specified colvar.