repESP.gaussian_format module¶
Parsing the Gaussian output format (.log or .out files)
-
class
ChargesSectionData(charges: List[repESP.charges.Charge])[source]¶ Bases:
objectDataclass representing the charges section of Gaussian output
Currently this dataclass only supports the charges but in the future it may contain more information that can be obtained from this section of the Gaussian output.
Parameters: charges (typing.List[Charge]) – List of charges -
charges¶ See initialization parameter
-
-
class
ChargesSectionParser[source]¶ Bases:
abc.ABCInterface required from parsers for the charges section
This interface will be implemented differently for the various charge types supported by Gaussian. Implementations for commonly used charges are provided.
-
is_section_start(line: str) → bool[source]¶ Check whether the given line is the start of charges section
Parameters: line (str) – A line from Gaussian output file. Returns: Whether the given line is the start of the charges section for the specific charge type. Return type: bool
-
is_section_end(line: str) → bool[source]¶ Check whether the given line is the end of charges section
Parameters: line (str) – A line from Gaussian output file. Returns: Whether the given line is the end of the charges section for the specific charge type. Return type: bool
-
parse_section(section: List[str]) → repESP.gaussian_format.ChargesSectionData[source]¶ Parse the charges section to obtain all information possible
Parameters: section (typing.List[str]) – The list of lines identified to be the charges section of the Gaussian output file. Returns: All the data that can be parsed from the charges section. Return type: ChargesSectionData
-
-
class
EspChargesSectionData(charges: List[repESP.charges.Charge], rms: repESP.fields.Esp, rrms: float)[source]¶ Bases:
repESP.gaussian_format.ChargesSectionDataDataclass representing the ESP charges section of Gaussian output
Compared to ChargesSectionData, the charges section of ESP charges additionally contains information regarding the quality of the reproduced field (RMS and RRMS).
Parameters: - charges (typing.List[Charge]) – List of charges
- rms (Esp) – The value of RMS error of the ESP field reproduced from partial charges with respect to the true ESP field.
- rrms (float) – The value of relative RMS error i.e. same as rms but relative to the RMS value of the true ESP field.
-
charges¶ See initialization parameter
-
rms¶ See initialization parameter
-
rrms¶ See initialization parameter
-
class
EspChargesSectionParser[source]¶ Bases:
repESP.gaussian_format.ChargesSectionParserBase class providing parser methods common to all ESP charge types
This base class implements the is_section_end and parse_section methods, which are common to all ESP charge types.
-
is_section_end(line: str) → bool[source]¶ Check whether the given line is the end of charges section
Parameters: line (str) – A line from Gaussian output file. Returns: Whether the given line is the end of the charges section for the specific charge type. Return type: bool
-
parse_section(section: List[str]) → repESP.gaussian_format.EspChargesSectionData[source]¶ Parse the charges section to obtain all information possible
Parameters: section (typing.List[str]) – The list of lines identified to be the charges section of the Gaussian output file. Returns: All the data that can be parsed from the charges section. Return type: ChargesSectionData
-
-
get_charges_from_log(f: TextIO, charges_section_parser: repESP.gaussian_format.ChargesSectionParser, verify_against: Optional[repESP.types.Molecule[repESP.types.Atom][repESP.types.Atom]] = None, occurrence: int = -1) → List[repESP.charges.Charge][source]¶ Extract charges from the charges section in Gaussian output
Parameters: - f (TextIO) – File object opened in read mode containing the Gaussian .log/.out output file from which the charges are to be extracted.
- charges_section_parser (ChargesSectionParser) – Object of a class implementing the ChargesSectionParser interface for the desired charge type, e.g. MullikenChargeSectionParser().
- verify_against (Molecule[Atom], optional) – Molecule against which the output is to be verified. Defaults to None. Note that currently the verification only involves comparing the number of extracted charges against the number of atoms. In the future this may be extended to verifying the atom identities.
- occurrence (int, optional) –
Determines which charges section to use for extracting the charges. Defaults to -1 i.e. the last section.
On occasion, the output can contain multiple charge sections regarding the same charge type. AFAIR, this happens when multiple Gaussian jobs were processed. Thus, the sensible default is to select the final one, to select the final optimization. Other values can be specified, starting with 0 for the first occurrence.
Returns: List of charges in order of occurrence in output file.
Return type: Raises: InputFormatError– Raised when the file does not follow the expected format.IndexError– Raised when the requested occurence of the charges section cannot be found could not be found in the output file.
-
get_esp_fit_stats_from_log(f: TextIO, charges_section_parser: repESP.gaussian_format.EspChargesSectionParser, verify_against: Optional[repESP.types.Molecule[repESP.types.Atom][repESP.types.Atom]] = None, occurrence: int = -1) → Tuple[repESP.fields.Esp, float][source]¶ Extract ESP fit statistics from charges section in Gaussian output
See documentation of get_charges_from_log for parameters and raised exceptions.
Raises: InputFormatError– Raised when the file does not follow the expected format.Returns: RMS and RRMS. Return type: Tuple[Esp, float]
-
class
MullikenChargeSectionParser[source]¶ Bases:
repESP.gaussian_format.ChargesSectionParserMulliken charges parser for Gaussian output
-
is_section_start(line: str) → bool[source]¶ Check whether the given line is the start of charges section
Parameters: line (str) – A line from Gaussian output file. Returns: Whether the given line is the start of the charges section for the specific charge type. Return type: bool
-
is_section_end(line: str) → bool[source]¶ Check whether the given line is the end of charges section
Parameters: line (str) – A line from Gaussian output file. Returns: Whether the given line is the end of the charges section for the specific charge type. Return type: bool
-
parse_section(section: List[str]) → repESP.gaussian_format.ChargesSectionData[source]¶ Parse the charges section to obtain all information possible
Parameters: section (typing.List[str]) – The list of lines identified to be the charges section of the Gaussian output file. Returns: All the data that can be parsed from the charges section. Return type: ChargesSectionData
-
-
class
MkChargeSectionParser[source]¶ Bases:
repESP.gaussian_format.EspChargesSectionParserMK charges parser for Gaussian output
-
class
ChelpChargeSectionParser[source]¶ Bases:
repESP.gaussian_format.EspChargesSectionParserCHelp charges parser for Gaussian output
-
class
ChelpgChargeSectionParser[source]¶ Bases:
repESP.gaussian_format.EspChargesSectionParserCHelpG charges parser for Gaussian output
-
class
HlyChargeSectionParser[source]¶ Bases:
repESP.gaussian_format.EspChargesSectionParserHLY charges parser for Gaussian output
-
class
NpaChargeSectionParser[source]¶ Bases:
repESP.gaussian_format.ChargesSectionParserNPA charges parser for Gaussian output
-
is_section_start(line: str) → bool[source]¶ Check whether the given line is the start of charges section
Parameters: line (str) – A line from Gaussian output file. Returns: Whether the given line is the start of the charges section for the specific charge type. Return type: bool
-
is_section_end(line: str) → bool[source]¶ Check whether the given line is the end of charges section
Parameters: line (str) – A line from Gaussian output file. Returns: Whether the given line is the end of the charges section for the specific charge type. Return type: bool
-
parse_section(section: List[str]) → repESP.gaussian_format.ChargesSectionData[source]¶ Parse the charges section to obtain all information possible
Parameters: section (typing.List[str]) – The list of lines identified to be the charges section of the Gaussian output file. Returns: All the data that can be parsed from the charges section. Return type: ChargesSectionData
-