5.2. ligandparam.io.gaussianIO
- class ligandparam.io.gaussianIO.GaussianInput(command='# HF/6-31G* OPT', elements=None, initial_coordinates=None, charge=0, multiplicity=1, header=None)[source]
Bases:
objectInitialize a Gaussian block with the specified parameters.
- Parameters:
command (str, optional) – The command for the Gaussian calculation
elements (list, optional) – A list of atomic symbols
initial_coordinates (np.array, optional) – A numpy array of atomic coordinates
charge (int, optional) – The charge of the molecule
multiplicity (int, optional) – The multiplicity of the molecule
header (list, optional) – A list of strings to be included in the header of the Gaussian input file
Methods
Generates the gaussina input block as a list of strings
print
- class ligandparam.io.gaussianIO.GaussianReader(filename)[source]
Bases:
objectThis is a class for reading Gaussian log files and pulling out information from them.
- Parameters:
filename (str) – The name of the Gaussian log file to read
Methods
Check if the Gaussian calculation is complete
read_log()Read the Gaussian log file, and extract information from it.
- check_complete()[source]
Check if the Gaussian calculation is complete
This function checks if the Gaussian calculation is complete. This is done by reading the Gaussian log file and checking for the presence of the “Normal termination” string.
- Parameters:
None
- Returns:
True if the calculation is complete, False otherwise
- Return type:
bool
- read_log()[source]
Read the Gaussian log file, and extract information from it.
This is adapted from ReadGauOutput in Tim Giese’s parmutils package. This reads the shebang at the end of the file, which contains information about the calculation final results. This works by parsing based on the delimiter in this section.
- Parameters:
None
- Returns:
atn (list) – A list of atomic symbols
coords (list) – A list of atomic coordinates
charge (int) – The charge of the molecule
multiplicity (int) – The multiplicity of the molecule
To Do
—–
- Add error handling for missing data
- Check that this reads only the FINAL geometry
- class ligandparam.io.gaussianIO.GaussianWriter(filename)[source]
Bases:
objectClass for writing Gaussian input files
The filename selected will be the name of the Gaussian input file that is written to disk. The class also initializes the number of links to zero, and creates an empty list to store the GaussianInput objects.
- Parameters:
filename (str) – The name of the file to write
- Return type:
None
Methods
add_block(block)Add a GaussianInput block to the GaussianWriter
get_run_command([extension])Get the command to run the Gaussian input file
print()Print the Gaussian input file to the screen
write([dry_run])Write the Gaussian input file to a file
- add_block(block)[source]
Add a GaussianInput block to the GaussianWriter
This function adds a GaussianInput block to the GaussianWriter. This block will be written to the Gaussian input file when the write() function is called.
- Parameters:
block (GaussianInput) – The GaussianInput block to add to the GaussianWriter
- Return type:
None
- get_run_command(extension='.com')[source]
Get the command to run the Gaussian input file
This function returns a string that can be used to run the Gaussian input file. This is useful for debugging, or for running the Gaussian input file from a script.
- Parameters:
extension (str, optional) – The extension of the Gaussian input file
- Returns:
The command to run the Gaussian input file
- Return type:
str
- print()[source]
Print the Gaussian input file to the screen
This function prints the Gaussian input file to the screen. This is useful for debugging, or for checking the contents of the file before writing it to disk.
- Parameters:
None
- Return type:
None
- write(dry_run=False)[source]
Write the Gaussian input file to a file
This function writes the Gaussian input file to disk. If dry_run is set to True, the file will not be written to disk, but will be printed to the screen instead. This is useful for debugging. The file is written in the Gaussian input file format, with the LINK1 blocks separated by the –Link1– delimiter.
- Parameters:
dry_run (bool, optional) – If True, the file will not be written to disk
- Return type:
None