src package¶
Submodules¶
src.bond_angles module¶
The BondAngles class calculates or searches for and stores bond angle data from an ORCA .out file.
- class src.bond_angles.BondAngles(out_filename, outfile_contents, inputs)[source]¶
Bases:
DataSectionWithInputsFinds and stores bond angle data from an ORCA .out file.
Methods¶
- _search
Search the .out file for bond angle data.
- __calc_atom_angle
Manually calcs the “bond angle” of the 3 atoms in the input angle tuple.
- get_datum
Gives the bond angle from _data for a certain bond.
- get_datum(angle_tuple)[source]¶
Gives the bond angle from _data for a certain bond.
Parameters¶
- angle_tupletuple
Tuple containing three atom labels, representing the desired bond.
Returns¶
- str
String consisting of the angle of the corresponding bond in degrees.
Raises¶
- KeyError
This occurs when the input ‘bond’ tuple can’t be found as a key in the dict containing the bond angle data.
src.bond_lengths module¶
The BondLengths class calculates or searches for and stores bond length data from an ORCA .out file.
- class src.bond_lengths.BondLengths(out_filename, outfile_contents, inputs)[source]¶
Bases:
DataSectionWithInputsFinds and stores bond length data from an ORCA .out file.
Methods¶
- _search
Search the .out file for bond length data.
- __calc_atom_angle
Manually calcs the “bond length” of the 2 atoms in the input bond tuple.
- get_datum
Gives the bond length from _data for a certain bond.
- get_datum(bond_tuple)[source]¶
Gives the bond length from _data for a certain bond.
Parameters¶
- bond_tupletuple
Tuple containing two atom labels, representing the desired bond.
Returns¶
- str
String consisting of the length of the corresponding bond in Angstroms.
Raises¶
- KeyError
This occurs when the input ‘bond’ tuple can’t be found as a key in the dict containing the bond length data.
src.data_section module¶
Structures subclasses that represent types of data from ORCA .out file.
The DataSection abstract class provides an interface for creating subclasses that represent different types of data from an ORCA .out file. These subclasses use regular expressions to search the contents of the .out file and find a particular type of data (e.g. input geometry coordinates for a series of atoms) and then stores these data using an appropriate structure. These subclasses also have a method to return these data to the user.
- class src.data_section.DataSection(out_filename, outfile_contents)[source]¶
Bases:
ABCSearches and stores a particular type of data from an ORCA .out file.
Attributes¶
- _out_filenamestr
Name of the ORCA .out file that will be searched.
- _outfile_contentsstr
String containing the full text of the ORCA .out file.
- _datadict
Dictionary containing the desired data, with relevant categories as keys (e.g. atom labels, bond tuples, polarizability parameters, etc.) and their corresponding values as values. Conventionally both are strs.
Methods¶
- _find_data
Searches the .out file for the desired data, which is used to store these data in the _data attribute.
- get_data
Getter method that returns the _data attribute.
- get_datum
Getter method that returns a ‘datum’ (one entry in the _data dict).
- get_section_name
Getter method that returns the name of the DataSection subclass.
- get_out_filename
Getter method that returns name of the .out file that the data is from.
- get_data()[source]¶
Getter method that returns the _data attribute.
Returns¶
- dict
The _data attribute.
- get_datum(datum_label)[source]¶
Return the value associated with a particular key (datum_label) from the _data dict attribute.
Parameters¶
- datum_labelstr
Key for the _data dictionary.
Returns¶
Value from the _data dictionary corresponding to param.
src.data_section_with_inputs module¶
An abstract class for DataSection subclasses that need to take inputs.
Inputs (e.g. tuples of strings of atom labels, or tuples of tuples of atom labels) specify which pieces of data should be searched for. The result of the search is a dictionary with each element from the inputs as keys and the resulting data from the search as values.
- class src.data_section_with_inputs.DataSectionWithInputs(out_filename, outfile_contents, inputs)[source]¶
Bases:
DataSection,ABCA subclass of DataSection for data that takes a set of inputs to search for.
Attributes¶
- _inputstuple
A tuple of information (e.g. strings of atom labels, or of tuples that contain strings of atom labels) which signify which pieces of information should be searched for.
Methods¶
- _find_data
Searches the .out file for the desired data, which is used to store these data in the _data attribute.
- _search
Abstract method which defines how each subclass of this class should go about searching the .out file for its particular type of data.
- get_inputs
Returns a copy of the _inputs attribute.
src.dipole_moments module¶
The DipoleMoments class searches for and stores dipole moment data from an ORCA .out file.
- class src.dipole_moments.DipoleMoments(out_filename, outfile_contents)[source]¶
Bases:
DataSectionFinds and stores dipole moment data from a ORCA .out file.
Attributes¶
- _regexstr
Regular expression string used to search the .out file for the dipole moments data.
Methods¶
- _find_data
Search the .out file for polarizability data, return as dict.
src.final_geom module¶
The FinalGeometry class searches for and stores the final structure geometry data (i.e., after geometry optimization is complete) from an ORCA .out file.
src.homo_lumo_energies module¶
The HOMOLUMOEnergies class searches for and stores the HOMO and LUMO energy data from an ORCA .out file.
- class src.homo_lumo_energies.HOMOLUMOEnergies(out_filename, outfile_contents)[source]¶
Bases:
DataSectionFinds and stores HOMO and LUMO energy data from a ORCA .out file.
Attributes¶
- __regexstr
Regular expression string used to search the .out file for the HOMO and LUMO energy data.
Methods¶
- _find_data
Search the .out file for HOMO and LUMO energy data, return as dict.
src.initial_geom module¶
The FinalGeometry class searches for and stores the initial (i.e., input by the user) geometry data from an ORCA .out file.
src.input_reader module¶
Structures subclasses that represent “Input Readers”.
For our purposes, “Input Readers” read in information from the user related to what data they want to extract from the ORCA .out file.
src.loewdin_charge_sums module¶
The LoewdinChargeSums class searches for and stores sums of Loewdin charges from an ORCA .out file.
The LoewdinCharges class searches for the Loewdin charge data for a series of atoms from a ORCA .out file, as specified by input (tuple of) tuples which contains a series of LEXICOGRAPHICALLY SORTED atom labels to search for.
- class src.loewdin_charge_sums.LoewdinChargeSums(out_filename, outfile_contents, inputs)[source]¶
Bases:
DataSectionWithInputsFinds and stores Loewdin charge sum data from a ORCA .out file.
Methods¶
- _search
Search the .out file for Loewdin charge sum data.
- get_datum
Gives the sum of Loewdin charges from _data for a set of atoms.
- get_datum(atoms_tuple)[source]¶
Gives the sum of Loewdin charges from _data for a set of atoms.
Parameters¶
- atoms_tupletuple
A tuple containing strings of the desired atom labels.
Returns¶
- str
String consisting of the sum of Loewdin charges of the atoms in atoms_tuple.
Raises¶
- KeyError
This occurs when the input atoms tuple can’t be found as a key in the dict containing the Loewdin charge sum data.
src.loewdin_charges module¶
The LoewdinCharges class searches for and stores Loewdin charge data from an ORCA .out file.
src.mulliken_charge_sums module¶
The MullikenChargeSums class searches for and stores sums of Mulliken charges from an ORCA .out file.
The MullikenCharges class searches for the Mulliken charge data for a series of atoms from a ORCA .out file, as specified by input (tuple of) tuples which contains a series of LEXICOGRAPHICALLY SORTED atom labels to search for.
- class src.mulliken_charge_sums.MullikenChargeSums(out_filename, outfile_contents, inputs)[source]¶
Bases:
DataSectionWithInputsFinds and stores Mulliken charge sum data from a ORCA .out file.
Methods¶
- _search
Search the .out file for Mulliken charge sum data.
- get_datum
Gives the sum of Mulliken charges from _data for a set of atoms.
- get_datum(atoms_tuple)[source]¶
Gives the sum of Mulliken charges from _data for a set of atoms.
Parameters¶
- atoms_tupletuple
A tuple containing strings of the desired atom labels.
Returns¶
- str
String consisting of the sum of Mulliken charges of the atoms in atoms_tuple.
Raises¶
- KeyError
This occurs when the input atoms tuple can’t be found as a key in the dict containing the Mulliken charge sum data.
src.mulliken_charges module¶
The MullikenCharges class searches for and stores Mulliken charge data from an ORCA .out file.
src.orca_out_to_csv module¶
src.orca_out_to_excel module¶
src.orca_out_to_json module¶
A script to quickly pull desired data from an ORCA .out file and compile it into a JSON file.
Before running, the user should specify what information they want to look for in a .txt file (see example). When executed, the script checks each file in the working directory. If the file ends in .out, it exports the desired data into a JSON file.
- src.orca_out_to_json.create_json_from_sds(sd_list, json_name)[source]¶
Writes the data in a list of StructureData instances to a JSON file.
Parameters¶
- sd_listlist
List containing the set of StructureData instances that each come from the ORCA .out files.
- json_namestr
Name of the JSON file where the data will be stored.
- src.orca_out_to_json.make_json_list(sd_list)[source]¶
Converts the data in a list of StructureData instances to a dict for JSON.
Parameters¶
- sd_listlist
List containing the set of StructureData instances that each come from the ORCA .out files.
Returns¶
- list
List with the data from sd_list configured to be compatible with JSON (i.e., tuples are converted to strings).
src.polarizability module¶
The Polarizability class searches for and stores polarizability data from an ORCA .out file.
- class src.polarizability.Polarizability(out_filename, outfile_contents)[source]¶
Bases:
DataSectionFinds and stores polarizability data from a ORCA .out file.
Attributes¶
- __regexstr
Regular expression string used to search the .out file for the polarizability data.
Methods¶
- _find_data
Search the .out file for polarizability data, return as dict.
src.structure_data module¶
Provides the StructureData class for use with other scripts.
The StructureData class holds information from an ORCA .out file, as specified by an input .txt file. It holds these data in a dictionary with the names of data sections as keys and corresponding DataSection subclasses as values. It contains methods to get data from these sections.
- class src.structure_data.StructureData(out_filename, input_filename, data_sections)[source]¶
Bases:
objectAssociates a desired subset of data from an ORCA .out file.
Attributes¶
- __out_filenamestr
String of the filename of the ORCA .out file this object represents.
- __input_filenamestr
String of filename of .txt file that contains lists of desired atom labels for each type of data that will be pulled from the .out file.
- __data_sectionsdict
Dictionary mapping strings of the names of DataSection subclasses to instances those subclasses associated with this .out file.
Methods¶
- __read_file
Converts a text file to a single string using .read().
- __check_coord_system
Determines whether the coordinate system was set up correctly.
- get_out_filename
Gives the filename of the .out file from which the data was taken.
- get_input_filename
Gives the filename of the input .txt file.
- get_std_error_msg
Gives the standard error message used by this class.
- get_data_sections
Gives __data_sections attribute, a dictionary that maps names of DataSection subclasses to their corresponding instances.
- get_data_section
Gives a DataSection subclass (value) from the __data_sections dict given its name (key).
- get_data_section_data
Gives dict containing the data from a particular DataSection subclass instance.
- get_data_section_datum
Gives ‘datum’ (value from DataSection subclass data dictionary) corresponding to a given label (key for said dict).
- get_data_section(section_name)[source]¶
Gives a DataSection subclass (value) from the __data_sections dict given its name (key).
Parameters¶
- section_namestr
Name of a DataSection subclass.
Returns¶
- DataSection subclass
Instance of a DataSection subclass corresponding to the passed name.
- get_data_section_data(section_name)[source]¶
Gives dict containing the data from a particular DataSection subclass instance.
Parameters¶
- section_namestr
Name of the DataSection, should be a key in __data_sections attribute.
Returns¶
- dict
Data found by a DataSection subclass instance.
- get_data_section_datum(section_name, datum_label)[source]¶
Gives ‘datum’ (value from DataSection subclass data dictionary) corresponding to a given label (key for said dict).
Parameters¶
- section_namestr
Name of the DataSection, should be a key in __data_sections attribute.
- datum_labelstr or tuple
Key to the DataSection subclass data dictionary for the desired datum.
Returns¶
- str or dict
‘Datum’ corresponding to the datum label key in the DataSection data dictionary.
- get_data_sections()[source]¶
Gives __data_sections attribute, a dictionary that maps names of DataSection subclasses to their corresponding instances.
Returns¶
- dict
__data_sections attribute.
- get_input_filename()[source]¶
Gives the filename of the input .txt file.
Returns¶
- str
__input_filename attribute.
src.structure_data_builder module¶
Provides a Builder which creates StructureData instances.
This class uses the Builder design pattern to create instances of the StructureData class based on a given filename for an input .txt file.
- class src.structure_data_builder.StructureDataBuilder(input_filename)[source]¶
Bases:
objectA Builder which creates StructureData instances.
Attributes¶
- __input_filenamestr
String of filename of .txt file that contains lists of desired atom labels for each type of data that will be pulled from the .out file.
- __input_readerInputReaderJSON
Instance of InputReader used to retrieve the inputs for the StructureData objects this instance builds.
- build(out_filename)[source]¶
Creates and returns an instance of StructureData based on the passed .out filename and the input filename attribute.
Parameters¶
- out_filenamestr
String of filename of desired .out file.
Returns¶
- StructureData
Instance of StructureData based on the passed .out filename and the input filename attribute.