Gaussian files (chemistry_files.gaussian
)
Files from the Gaussian software.
- class qcip_tools.chemistry_files.gaussian.BasisSet
File containing a basis set in the gaussian format.
This file format does not exists, but lets say that copy/paste from ESML basis set exchange should work.
self.basis_set
: the basis_set (qcip_tools.basis_set.BasisSet
)
- read(f, fail_for_same_atom=False)
- Parameters:
f (file) – f
fail_for_same_atom (bool) – raise an exception is the same atom is defined more than once
- to_string(for_molecule=None)
Give basis set
- Parameters:
for_molecule (qcip_tools.molecule.Molecule) – if defined, only output for the atoms contained in the molecule
- Return type:
str
- exception qcip_tools.chemistry_files.gaussian.BasisSetFormatError
- class qcip_tools.chemistry_files.gaussian.ChargeTransferInformation(charge, barycenter_m, barycenter_p)
Analyzed charge transfer.
In it,
charge
is the amount of charge (in e) transfered frombarycenter_m
tobarycenter_p
, linked byvector
, which lead to a certain charge transferdistance
.- Parameters:
charge (float) – charge
barycenter_m (numpy.array) – barycenter of the negative charges
barycenter_p (numpy.array) – barycenter of the positive charges
- class qcip_tools.chemistry_files.gaussian.Cube
Gaussian cube.
Documentation on that format can be found here.
Note
Increments and origin are stored as found, in bohr.
self.molecule
: the molecule (qcip_tools.molecule.Molecule
)self.cube_type
: set toMO
if the cube contains MOs (str
)self.records_per_directions
: number of point in the grid (list
ofint
)self.origin
: origin of the grid (3x1numpy.ndarray
)self.increments
: increments between each point (3x1numpy.ndarray
)self.data_per_records
: data per point (int
)self.records
: the records (numpy.ndarray
)self.title
: the title (str
)self.subtitle
: the second line (str
)self.MOs
: the MOs contained in the file, if any (list
ofint
)
- alike(other)
Compare two cubes to check if they have the same size
- Parameters:
other (Cube) – the other cube
- Return type:
bool
- classmethod attempt_identification(f)
A cube file contains, in line 3-6, quadruplets of numbers, the first one being an integer, then 3 floats. Then, after the different atoms, line should contains numbers in scientific notation.
- compute_charge_transfer(index=0)
Analyse CT by computing:
Transferred charge ;
Barycenter positions (the negative one being the starting point of the transfer) ;
Distance between the two barycenters.
Made according to J. Chem. Theory. Comput. 7, 2498 (2011).
- Parameters:
index (int) – slice of the record to use
- Return type:
- dV()
Return the size of the smallest unit of volume in the cube, in angstrom**3.
- Return type:
float
- file_type = 'GAUSSIAN_CUBE'
The identifier
- classmethod from_molecule(molecule, *args, **kwargs)
Create an object out of a molecule
- Parameters:
molecule (qcip_tools.molecule.Molecule) – the molecule
- Return type:
- number_of_data()
Number of points in the file
- Return type:
int
- number_of_records()
Number of records in the file
Note
According to the documentation:
Cube files have one row per record (i.e., N1*N2 records each of length N3*NVal) (where N1 and N2 are the record per direction in the X and Y direction, while N3 is for the Z direction, the fastest running index).So it returns the number of rows, and should not be mistaken with
number_of_data()
.- Return type:
int
- positions()
Return an array with the position (in angstrom) of each point.
- Return type:
numpy.array
- classmethod possible_file_extensions()
Return the common extention of this kind of files
- Return type:
list
- read(f)
Warning
The charge/multiplicity may be wrong !
- Parameters:
f (file) – File
- slice(index=0)
Get a specific part of the data
- Parameters:
index (int) – index of the record
- Return type:
- sum_density_of_sets(bounding_sets, index=0)
Sum the density in a given space, defined by the bounding boxes
- Parameters:
bounding_sets (dict) – sets of bounding boxes
index (int) – slice of the record to use
- Returns:
dictionary with the sum of the density
- Return type:
dict
- to_string()
- Return type:
str
- exception qcip_tools.chemistry_files.gaussian.CubeFormatError
- class qcip_tools.chemistry_files.gaussian.FCHK
A FCHK file. Based on the same principle as DataFile (split into chunks, interpret and store after).
Most of the information are found in the “FChk file” part of the “Interfacing” documentation of Gaussian.
self.molecule
: the molecule (qcip_tools.molecule.Molecule
)self.title
: the title (str
)self.calculation_type
: the type of calculation (str
)self.calculation_method
: the method used (str
)self.basis_set
: the basis set (str
)self.chunks_information
: information about every chunk (dict
ofFCHKChunkInformation
)self.chunks_parsed
: parsed chunks are stored here (dict
ofint|float|str|numpy.ndarray
)self.lines
: the different lines of the file, used for interpretation (list
ofstr
)
- classmethod attempt_identification(f)
A gaussian fchk starts with two two line of info, then “Number of atoms”
- file_type = 'GAUSSIAN_FCHK'
The identifier
- classmethod from_molecule(molecule, *args, **kwargs)
Create an object out of a molecule
- Parameters:
molecule (qcip_tools.molecule.Molecule) – the molecule
- Return type:
- get(key)
Get the content from a given keyword
- Parameters:
key (str) – the keyword
- Return type:
list|int|float|str
- classmethod possible_file_extensions()
Return the common extention of this kind of files
- Return type:
list
- read(f)
- Parameters:
f (file) – File
- class qcip_tools.chemistry_files.gaussian.FCHKChunkInformation(keyword, data_type, data_length, line_start, line_end, is_matrix=True)
Where to find a given keyword in the FCHK file
- Parameters:
keyword (str) – keyword related to this piece of information
data_type (str) – type of this piece of information
data_length (int) – length of this data
line_start (int|object) – start in the source file
line_end (int|object) – end in the source file
is_matrix (bool) – is it a matrix ?
- exception qcip_tools.chemistry_files.gaussian.FCHKFormatError
- class qcip_tools.chemistry_files.gaussian.Input
Gaussian input file.
self.molecule
: the molecule (qcip_tools.molecule.Molecule
)self.options
: the different options (starting with%
in the file,dict
ofstr
[if%xxx=yyy
, key isxxx
and value isyyy
])self.input_card
: the input card (starting with#
in the file,list
ofstr
[the different lines])self.title
: the title (str
)self.other_blocks
: the additionnal blocks after the molecule (list
oflist
ofstr
[the different lines])
- classmethod attempt_identification(f)
A gaussian input should contains ‘%’ or ‘#’ as the first character of the line of the “first block”
- file_type = 'GAUSSIAN_INP'
The identifier
- classmethod from_molecule(molecule, title='', input_card='', options=None, other_blocks=None, *args, **kwargs)
Create a file from molecule
- Parameters:
molecule (qcip_tools.molecule.Molecule) – the molecule
title (str) – title of the run
input_card (str|list) – the input card (starting with
#P
)options (dict) – calculation options
other_blocks (list) – the other input blocks
- Return type:
- classmethod possible_file_extensions()
Return the common extention of this kind of files
- Return type:
list
- read(f)
- Parameters:
f (file) – File
- to_string(chk='', original_chk=False)
- Parameters:
chk (str) – new chk name if needed
original_chk (bool) – use original chk name
- Return type:
str
- write(f, chk=None, original_chk=False)
- Parameters:
f (file) – File
- exception qcip_tools.chemistry_files.gaussian.InputFormatError
- class qcip_tools.chemistry_files.gaussian.LinkCalled(link, line_start, line_end)
Remind when a link is called
- Parameters:
link (int) – number of the link called
- class qcip_tools.chemistry_files.gaussian.Output
Log file of Gaussian. Contains a lot of informations, but not well printed or located. If possible, rely on the FCHK rather than on the LOG file.
Note
self.geometry
contains the input geometry, but it may be reoriented according to the symmetry ifnosym
was not provided. If it was not reoriented,self.input_orientation
is set toTrue
.Warning
Results are not guaranteed if the job ran without
#P
.self.molecule
: the molecule (qcip_tools.molecule.Molecule
)self.input_orientation
: wether the molecule has been reoriented w.r.t. input (bool
)self.chunks
: the different links called (list
of LinkCalled)self.lines
: the lines of the file (list
ofstr
)
- classmethod attempt_identification(f)
A gaussian log … Contains a lot of “gaussian” in the beginning (limit to the 150 first lines)”
- file_type = 'GAUSSIAN_LOG'
The identifier
- read(f)
- Parameters:
f (file) – File
- exception qcip_tools.chemistry_files.gaussian.OutputFormatError
- qcip_tools.chemistry_files.gaussian.beta_EOP_from_fchk(compressed_tensor, offset=0)
EOP beta tensor in FCHK is a bit messed up
- Parameters:
offset (int) – frequency offset
- Return type:
numpy.ndarray
- qcip_tools.chemistry_files.gaussian.beta_SHG_from_fchk(compressed_tensor, offset=0)
SHG beta tensor in FCHK is a bit messed up
- Parameters:
offset (int) – frequency offset
- Return type:
numpy.ndarray
- qcip_tools.chemistry_files.gaussian.gamma_from_gaussian(compressed_tensor, offset=0, exchange_23=False)
gamma tensor in FCHK is (also) a bit messed up
- Parameters:
offset (int) – frequency offset
exchange_23 (bool) – exchange the third and the fourth component if True (second and third otherwise)
- Return type:
numpy.ndarray
- qcip_tools.chemistry_files.gaussian.gaussian__fchk__property__computed_energies(obj, *args, **kwargs)
Get the energies. Returns a dictionary of the energies at different level of approximation.
- Parameters:
obj (qcip_tools.chemistry_files.gaussian.FCHK plots)) – object
- Return type:
dict
- qcip_tools.chemistry_files.gaussian.gaussian__fchk__property__electrical_derivatives(obj, *args, **kwargs)
Get electrical derivatives in FCHK. Returns a dictionary of dictionary:
+ "F" + static : ElectricDipole + "FF": + static : PolarizabilityTensor + "FD": + 0.042 : PolarizabilityTensor + ... + "FDD": + static : FirstHyperpolarizabilityTensor + ... + ...
Note that the dipole moment is present in more or less every cases.
Does not fetch (yet?) the second hyperpolarizability, stored as
Derivative Beta(-w,w,0)
andDerivative Beta(w,w,-2w)
(that will be fun for reorganisation).- Parameters:
obj (qcip_tools.chemistry_files.gaussian.FCHK) – object
- Return type:
dict
- qcip_tools.chemistry_files.gaussian.gaussian__fchk__property__excitations(obj, *args, **kwargs)
Get excitation properties in FCHK. Returns a dictionary:
+ "!" : Tensor + "!F" : Tensor
- Parameters:
obj (qcip_tools.chemistry_files.gaussian.FCHK) – object
- Return type:
dict
- qcip_tools.chemistry_files.gaussian.gaussian__fchk__property__geometrical_derivatives(obj, *args, **kwargs)
Get geometrical derivatives in FCHK. Returns a dictionary of dictionary:
+ "G": BaseGeometricalDerivativeTensor + "GG": BaseGeometricalDerivativeTensor
Does not fetch (yet?) the cubic force constants.
- Parameters:
obj (qcip_tools.chemistry_files.gaussian.FCHK) – object
- Return type:
dict
- qcip_tools.chemistry_files.gaussian.gaussian__output__get_computed_energies(obj, *args, **kwargs)
Get the energies… Actually, “only” + HF and DFT energy (in link 502/503/506/508) + MP2 energy (in link 804/903/905/906) + MP3, CCSD and CCSD(T) energy (in link 913)
- Parameters:
obj (qcip_tools.chemistry_files.gaussian.Output) – object
- Return type:
dict
- qcip_tools.chemistry_files.gaussian.gaussian__output__property__electrical_derivatives(obj, *args, **kwargs)
- Parameters:
obj (gaussian.Output) – object
- Return type:
dict
- qcip_tools.chemistry_files.gaussian.gaussian__output__property__excitations(obj, *args, **kwargs)
Get excitation properties in FCHK. Returns a dictionary:
+ "!" : Tensor + "!F" : Tensor
- Parameters:
obj (qcip_tools.chemistry_files.gaussian.Output) – object
- Return type:
dict
- qcip_tools.chemistry_files.gaussian.make_cartesian_hessian_from_fchk(half_cartesian_hessian, spacial_dof)
Half the hessian is stored in fchk, get full hessian back
- Parameters:
half_cartesian_hessian (list) – the half of the hessian, as retrieved from FCHK
spacial_dof (int) – spacial degree of freedom (DOF)
- Returns: