ichor.core.files.gaussian package

Submodules

ichor.core.files.gaussian.gaussian_output module

class GaussianOutput(path: Path | str)

Bases: ReadFile, HasAtoms, HasData

Wraps around a .gaussianoutput file that is the output of Gaussian. This file contains coordinates (in Angstroms), forces, as well as molecular multipole moments.

Parameters:

path – Path object or string to the .gaussianoutput file that are Gaussian output files

atoms: Atoms
charge: int
global_forces: dict
molecular_dipole: MolecularDipole
molecular_hexadecapole: MolecularHexadecapole
molecular_octupole: MolecularOctupole
molecular_quadrupole: MolecularDipole
multiplicity: int
path: Path | str
property raw_data: dict

Returns the raw data associated with the current object.

Returns:

_description_

Return type:

dict

rotated_forces(rotation_matrix: ndarray) dict

Rotates forces gives a rotation_matrix, which could be the C matrix to rotate on an ALF axis system with central atom, x-axis atom, and xy-plane atom.

Parameters:

rotation_matrix – A 3x3 rotation matrix

traceless_molecular_quadrupole: TracelessMolecularQuadrupole

ichor.core.files.gaussian.gjf module

class GJF(path: Path | str, link0: List[str] | None = None, print_level: PrintLevel | None = None, method: str | None = None, basis_set: str | None = None, keywords: List[str] | None = None, title: str | None = None, charge: int | None = None, spin_multiplicity: int | None = None, atoms: Atoms | None = None, output_chk: bool = False)

Bases: ReadFile, WriteFile, HasAtoms

Wraps around a .gjf file that is used as input to Gaussian. See https://gaussian.com/input/ for details. Below is the usual gjf file structure:

%nproc
%mem
# <job_type> <method>/<basis-set> <keywords>

Title

0 1
<atom-name> <todo: add -1 for freeze> <x> <y> <z>
...

extra_details_str (containing basis sets for individual atoms, what to freeze, etc.)

<wfn-name>
blank line
blank line
blank line
...
Parameters:
  • path – A string or Path to the .gjf file. If a path is not give, then there is no file to be read, so the user has to write the file contents. If no contents/options are written by user, they are written as the default values in the write method.

  • title – A string to be written between the link0 options and the keywords. It can contain any information.

  • job_type – The job type, an energy, optimization, or frequency

  • keywords – A list of keywords to be added to the Gaussian keywords line

  • method – The method to be used by Gaussian (e.g. B3LYP)

  • basis_set – The basis set to be used by Gaussian (e.g. 6-31+g(d,p))

  • charge – The charge to be used by Gaussian for the system

  • multiplicity – The multiplicity to be used by Gaussian for the system.

  • atoms – An Atoms instance containing a geometry to be written in the .gjf file. This is either read in (if an existing gjf path is given) or an error is thrown when attempting to write the gjf file (because no gjf file or Atoms instance was given)

  • extra_calculation_details – A list of strings to be added to the bottom of the gjf file (after atoms section containing atom names and coordinates). This is done in order to handle different basis sets for individual atoms, modredundant settings, and other settings that Gaussian handles.

Note

It is up to the user to handle write the extra_calculation_details settings. ICHOR does NOT do checks to see if these additional settings are going to be read in correctly in Gaussian.

add_keyword(keyword: str)

Add a keyword to the Gaussian input keywords

Parameters:

keywords – A string to add as a keyword

Note

The keyword is not checked internally.

add_keywords(keywords: List[str])

Add a list of keywords to the Gaussian input keywords

Parameters:

keywords – A list of keywords

Note

The keywords are not checked internally.

basis_set: str
charge: int
keywords: List[str]
link0: List[str]
method: str
output_wfn()

Helper method to add ‘output=wfn’ to the GJF keyword list

classmethod parse_route_card(route_card: str) RouteCard
path: Path | str
set_mem(mem: str)

Sets memory for Gaussian job

Parameters:

mem – string to set as memory

Note

This is not checked internally.

set_nproc(nproc: int)

Sets the number of processor cores for Gaussian

Parameters:

nproc – An integer which is the number of cores.

Note

No checks are done for CPU core count.

spin_multiplicity: int
class PrintLevel(value)

Bases: Enum

An enumeration.

Normal = 'n'
Terse = 't'
Verbose = 'p'
class RouteCard(print_level, method, basis_set, keywords)

Bases: tuple

basis_set: str

Alias for field number 2

keywords: List[str]

Alias for field number 3

method: str

Alias for field number 1

print_level: PrintLevel

Alias for field number 0

ichor.core.files.gaussian.wfn module

class MolecularOrbital(index: int, occupation_number: float, energy: float, primitives: list)

Bases: object

class WFN(path: Path | str, method: str | None = None)

Bases: HasAtoms, HasData, ReadFile, WriteFile

Wraps around a .wfn file that is the output of Gaussian. The .wfn file is an output file, but must also implement a write method because AIMAll needs to know the method used in the WFN calculation, otherwise AIMAll can give the wrong results.

Parameters:
  • path – Path object or string to the .wfn file

  • atoms – an Atoms instance which is read in from the top of the .wfn file. Note that the units of the .wfn file are in Bohr.

  • method – The method (eg. B3LYP) which was used in the Gaussian calculation that created the .wfn file. The method is not initially written to the .wfn file by Gaussian, but it is necessary to add it to the .wfn file because AIMAll does not automatically determine the method itself, so it can lead to wrong IQA/multipole moments results. To make sure AIMAll results are correct, the method is a required argument.

Variables:
  • mol_orbitals – The number of molecular orbitals to be read in from the .wfn file.

  • primitives – The number of primitives to be read in from the .wfn file.

  • nuclei – The number of nuclei in the system to be read in from the .wfn file.

  • energy – The molecular energy read in from the bottom of the .wfn file

  • virial – The virial read in from the bottom of the .wfn file

Note

Since the wfn file is written out by Gaussian, we do not really have to modify it when writing out except we need to add the method used, so that AIMALL can use the correct method. Otherwise AIMAll assumes Hartree-Fock was used, which might be wrong.

path: Path | str
property raw_data: Dict[str, float]

Returns the raw data associated with the current object.

Returns:

_description_

Return type:

dict

ichor.core.files.gaussian.wfx module

class MolecularOrbital(index: int, eigen_value: float, occupation_number: float, energy: float, primitives: list)

Bases: object

class WFX(path: Path | str, method: str | None = None)

Bases: HasAtoms, HasData, ReadFile

Wraps around a .wfn file that is the output of Gaussian. The .wfn file is an output file, so it does not have a write method.

Parameters:
  • path – Path object or string to the .wfn file

  • atoms – an Atoms instance which is read in from the top of the .wfn file. Note that the units of the .wfn file are in Bohr.

  • method – The method (eg. B3LYP) which was used in the Gaussian calculation that created the .wfn file. The method is not initially written to the .wfn file by Gaussian, but it is necessary to add it to the .wfn file because AIMAll does not automatically determine the method itself, so it can lead to wrong IQA/multipole moments results. To make sure AIMAll results are correct, the method is a required argument.

Variables:
  • mol_orbitals – The number of molecular orbitals to be read in from the .wfn file.

  • primitives – The number of primitives to be read in from the .wfn file.

  • nuclei – The number of nuclei in the system to be read in from the .wfn file.

  • energy – The molecular energy read in from the bottom of the .wfn file

  • virial – The virial read in from the bottom of the .wfn file

Note

Since the wfn file is written out by Gaussian, we do not really have to modify it when writing out except we need to add the method used, so that AIMALL can use the correct method. Otherwise AIMAll assumes Hartree-Fock was used, which might be wrong.

path: Path | str
property properties: Dict[str, float]

Module contents

class GJF(path: Path | str, link0: List[str] | None = None, print_level: PrintLevel | None = None, method: str | None = None, basis_set: str | None = None, keywords: List[str] | None = None, title: str | None = None, charge: int | None = None, spin_multiplicity: int | None = None, atoms: Atoms | None = None, output_chk: bool = False)

Bases: ReadFile, WriteFile, HasAtoms

Wraps around a .gjf file that is used as input to Gaussian. See https://gaussian.com/input/ for details. Below is the usual gjf file structure:

%nproc
%mem
# <job_type> <method>/<basis-set> <keywords>

Title

0 1
<atom-name> <todo: add -1 for freeze> <x> <y> <z>
...

extra_details_str (containing basis sets for individual atoms, what to freeze, etc.)

<wfn-name>
blank line
blank line
blank line
...
Parameters:
  • path – A string or Path to the .gjf file. If a path is not give, then there is no file to be read, so the user has to write the file contents. If no contents/options are written by user, they are written as the default values in the write method.

  • title – A string to be written between the link0 options and the keywords. It can contain any information.

  • job_type – The job type, an energy, optimization, or frequency

  • keywords – A list of keywords to be added to the Gaussian keywords line

  • method – The method to be used by Gaussian (e.g. B3LYP)

  • basis_set – The basis set to be used by Gaussian (e.g. 6-31+g(d,p))

  • charge – The charge to be used by Gaussian for the system

  • multiplicity – The multiplicity to be used by Gaussian for the system.

  • atoms – An Atoms instance containing a geometry to be written in the .gjf file. This is either read in (if an existing gjf path is given) or an error is thrown when attempting to write the gjf file (because no gjf file or Atoms instance was given)

  • extra_calculation_details – A list of strings to be added to the bottom of the gjf file (after atoms section containing atom names and coordinates). This is done in order to handle different basis sets for individual atoms, modredundant settings, and other settings that Gaussian handles.

Note

It is up to the user to handle write the extra_calculation_details settings. ICHOR does NOT do checks to see if these additional settings are going to be read in correctly in Gaussian.

add_keyword(keyword: str)

Add a keyword to the Gaussian input keywords

Parameters:

keywords – A string to add as a keyword

Note

The keyword is not checked internally.

add_keywords(keywords: List[str])

Add a list of keywords to the Gaussian input keywords

Parameters:

keywords – A list of keywords

Note

The keywords are not checked internally.

basis_set: str
charge: int
keywords: List[str]
link0: List[str]
method: str
output_wfn()

Helper method to add ‘output=wfn’ to the GJF keyword list

classmethod parse_route_card(route_card: str) RouteCard
path: Path | str
set_mem(mem: str)

Sets memory for Gaussian job

Parameters:

mem – string to set as memory

Note

This is not checked internally.

set_nproc(nproc: int)

Sets the number of processor cores for Gaussian

Parameters:

nproc – An integer which is the number of cores.

Note

No checks are done for CPU core count.

spin_multiplicity: int
class GaussianOutput(path: Path | str)

Bases: ReadFile, HasAtoms, HasData

Wraps around a .gaussianoutput file that is the output of Gaussian. This file contains coordinates (in Angstroms), forces, as well as molecular multipole moments.

Parameters:

path – Path object or string to the .gaussianoutput file that are Gaussian output files

atoms: Atoms
charge: int
global_forces: dict
molecular_dipole: MolecularDipole
molecular_hexadecapole: MolecularHexadecapole
molecular_octupole: MolecularOctupole
molecular_quadrupole: MolecularDipole
multiplicity: int
path: Path | str
property raw_data: dict

Returns the raw data associated with the current object.

Returns:

_description_

Return type:

dict

rotated_forces(rotation_matrix: ndarray) dict

Rotates forces gives a rotation_matrix, which could be the C matrix to rotate on an ALF axis system with central atom, x-axis atom, and xy-plane atom.

Parameters:

rotation_matrix – A 3x3 rotation matrix

traceless_molecular_quadrupole: TracelessMolecularQuadrupole
class WFN(path: Path | str, method: str | None = None)

Bases: HasAtoms, HasData, ReadFile, WriteFile

Wraps around a .wfn file that is the output of Gaussian. The .wfn file is an output file, but must also implement a write method because AIMAll needs to know the method used in the WFN calculation, otherwise AIMAll can give the wrong results.

Parameters:
  • path – Path object or string to the .wfn file

  • atoms – an Atoms instance which is read in from the top of the .wfn file. Note that the units of the .wfn file are in Bohr.

  • method – The method (eg. B3LYP) which was used in the Gaussian calculation that created the .wfn file. The method is not initially written to the .wfn file by Gaussian, but it is necessary to add it to the .wfn file because AIMAll does not automatically determine the method itself, so it can lead to wrong IQA/multipole moments results. To make sure AIMAll results are correct, the method is a required argument.

Variables:
  • mol_orbitals – The number of molecular orbitals to be read in from the .wfn file.

  • primitives – The number of primitives to be read in from the .wfn file.

  • nuclei – The number of nuclei in the system to be read in from the .wfn file.

  • energy – The molecular energy read in from the bottom of the .wfn file

  • virial – The virial read in from the bottom of the .wfn file

Note

Since the wfn file is written out by Gaussian, we do not really have to modify it when writing out except we need to add the method used, so that AIMALL can use the correct method. Otherwise AIMAll assumes Hartree-Fock was used, which might be wrong.

path: Path | str
property raw_data: Dict[str, float]

Returns the raw data associated with the current object.

Returns:

_description_

Return type:

dict

class WFX(path: Path | str, method: str | None = None)

Bases: HasAtoms, HasData, ReadFile

Wraps around a .wfn file that is the output of Gaussian. The .wfn file is an output file, so it does not have a write method.

Parameters:
  • path – Path object or string to the .wfn file

  • atoms – an Atoms instance which is read in from the top of the .wfn file. Note that the units of the .wfn file are in Bohr.

  • method – The method (eg. B3LYP) which was used in the Gaussian calculation that created the .wfn file. The method is not initially written to the .wfn file by Gaussian, but it is necessary to add it to the .wfn file because AIMAll does not automatically determine the method itself, so it can lead to wrong IQA/multipole moments results. To make sure AIMAll results are correct, the method is a required argument.

Variables:
  • mol_orbitals – The number of molecular orbitals to be read in from the .wfn file.

  • primitives – The number of primitives to be read in from the .wfn file.

  • nuclei – The number of nuclei in the system to be read in from the .wfn file.

  • energy – The molecular energy read in from the bottom of the .wfn file

  • virial – The virial read in from the bottom of the .wfn file

Note

Since the wfn file is written out by Gaussian, we do not really have to modify it when writing out except we need to add the method used, so that AIMALL can use the correct method. Otherwise AIMAll assumes Hartree-Fock was used, which might be wrong.

path: Path | str
property properties: Dict[str, float]