gaussianclasses

One of the two core libraries of pyssian. Contains the Classes that represent Gaussian Files (input and output).

To do:
  • Create a Class to represent the basis and core electronic pontentials

GaussianInFile

  • Accepts a context manager usage similar to 'with open(file) as F:...'

  • Does not parse ONIOM calculation inputs

  • Does not parse MM calculation inputs

  • Not tested for z-matrix inputs

class pyssian.GaussianInFile(file)[source]

Gaussian 09/16 .in file parent class, if any special type of input requires different processing it should be a subclass of this one.

Parameters

file (io.TextIOBase or str) -- File instance (Result of open(filename,'r')) or valid filename.

preprocessing

Dictionary in which each key corresponds to a certain Link0 keyword

Type

dict

commandline

Dictionary that contains the information of how the calculation will be carried out.

Type

dict

title

title of the calculation.

Type

str

method

If it cannot be recognized in the command line it will be empty.

Type

str

basis

If it cannot be recognized in the command line it will be empty.

Type

str

spin
Type

int

charge
Type

int

geometry

It should be able to write the text block of an input file upon calling str(geometry)

Type

str-ish

tail

List of str in which each should be separated from the others by a single blank line in the input file.

Type

list

structure

A string holding the structure of the input file. Used to write new Input files.

Type

str

nprocs

property to easily access and change the preprocessing['nprocshared'] value

Type

int

mem

property to easily access and change the preprocessing['mem'] value

Type

int

add_chk(name=None)[source]

Adds the chk to the file, with the specified name. If none is provided defaults to the file name ended in .chk

change_basis(basis)[source]

Changes appropiately the basis of the calculation. Running self.basis = basis makes a call to this function.

Parameters

basis (str) -- A string representation of a valid method if specified in the command line.

Raises

NotImplementedError -- If the basis is not within the registered basis keywords

change_method(method)[source]

Changes appropiately the method of the calculation. Running self.method = method makes a call to this function.

Parameters

method (str) -- A string representation of a valid method

Raises

NotImplementedError -- If the method is not within the registered methods keywords

close()[source]

Alias to file.close for consistency with the io.TextIOBase class

parse_commandline(lines)[source]

Parses the lines that contain the calculation commands keywords and transforms them into a dictionary representation.

Parameters

lines (list) -- list of strings previously stripped. Empty lines will be ignored.

parse_geometry(lines)[source]

Parses each line that contains 'Atom x y z' in an appropiate form and saves it to self.geometry

Parameters

lines (list) -- list of strings previously stripped. Should not contain empty lines

parse_preprocessing(lines)[source]

Parses the lines that contain the Link 0 keywords and transforms them into a dictionary representation.

Parameters

lines (list) -- list of strings previously stripped. Empty lines will be ignored.

parse_tail(lines)[source]

Chops the set of lines into different blocks of text using as reference the emptylines/blank lines

Parameters

lines (list) -- list of strings previously stripped.

Returns

Description of returned object.

Return type

type

Raises

ExceptionName -- Why the exception is raised.

pop_chk(default=None)[source]

Removes the chk from the file, returns 'default' if the chk was not included already

read()[source]

Reads the file and populates the appropiate attributes.

write(filepath=None)[source]

Writes the File object to a File. If a filepath is provided it will write to that filepath otherwise it will attempt to write to the path provided in the initialization.

Parameters

filepath (str) -- A valid filepath.

GaussianOutFile

  • Accepts a context manager usage similar to 'with open(file) as F:...'

  • Will only parse a Gaussian Output File that has the "#p".

class pyssian.GaussianOutFile(file, parselist=None)[source]

Gaussian 09/16 '.log' file parent class, if any special type of calculation requires different processing it should be a subclass of this one. Accepts a context manager usage similar to 'with open(file) as F:...'

Parameters
  • file (io.TextIOBase or str) -- File instance (Result of open(filename,'r')) or valid filename.

  • parselist (list) -- List of integrers that represent which types of Links to parse (the default is None).

InternalJobs

List of InternalJobs done by gaussian i.e an gaussian calculation with the opt freq keywords will run first an InternalJob for the Optimization and after an InternalJob for the Frequency calculation.

clean()[source]

Removes per each InternalJob stored all the EmptyLinkJobs.

Wrapper Method to get a list of Links with certain Ids across the different Internal Jobs.

Parameters

*LinkIds (int) -- Integrers that correspond to the type of links to be return.

Returns

Return type

list

print_file_structure()[source]

Display the structure of links and internal jobs of the file.

read()[source]

Alias of update for consistency with GaussianInFile class

update(clean=True, FinalPrint=False)[source]

Tries to fetch new data. If it exists it parses it appropiately otherwise it fails silently.

Parameters
  • clean (Bool) -- If True removes all the EmptyLinkJobs found (the default is True).

  • FinalPrint (Bool) -- If True after a normal execution has finished it will print in the console a message to notify the user (the default is False).

InternalJob

class pyssian.InternalJob(number=None)[source]

Gaussian 09/16 InternalJob parent class, if any special type of Job requires different parsing it should be a subclass of this one.

Parameters

number (int) -- ordinal number of the InternalJob (the default is None).

type

string identifier for the job.

List of the different Links that belong to the InternalJob.

number
clean()[source]

Removes all the Empty Link instances within Links.

Wrapper Method to get a list of Links with certain Ids.

Parameters

*LinkIds (int) -- Integrers that correspond to the type of links to be return.

Returns

List of Link Objects ordered by appearance in the file and filtered by Link Number.

Return type

list

guess_info()[source]

Guesses the number and type attributes of itself using the stored Links.