chemtools.calculators.gamessus module

Module for handling Gamess-US related jobs: - Gamess : running and submitting jobs, writing inputs, - GamessInpParser : parsing the input file, - GamessLogParser : parsing the output file, - GamessDatParser : parsing data from the gamess PUNCH (.dat) file

class GamessDatParser(datfile)[source]

Bases: object

Parser for the GAMESS(US) dat (.F10) file

datfile

Return the value of the datfile attribute

get_occupations()[source]

Parse the occupation numbers from the ascii PUNCH file (.dat).

get_orbitals(method)[source]

Parse the natural orbitals from the ascii PUNCH file (.dat).

Args:
method : str
acceptable values are:
  • for scf orbitals: “scf”, “hf”, “rhf”, “rohf”, “uhf”, “gvb”
  • for mcscf orbitals: “mcscfmos”, “mcscfnos”
  • for ci orbitals: “ci”, “aldet”, “fsoci”, “guga”, “genci”, “ormas”“
  • for localized orbitals: local
Returns:
orbs : numpy.array
2D numpy array of shape (naos, nmos) containing ortbials expansion coefficients
get_vec_string(method)[source]

Parse the natural orbitals from the ascii PUNCH file (.dat).

Args:
method : str
acceptable values are:
  • for scf orbitals: “scf”, “hf”, “rhf”, “rohf”, “uhf”, “gvb”
  • for mcscf orbitals: “mcscfmos”, “mcscfnos”
  • for ci orbitals: “ci”, “aldet”, “fsoci”, “guga”, “genci”, “ormas”“
  • for localized orbitals: local
Returns:
orbs : numpy.array
2D numpy array of shape (naos, nmos) containing ortbials expansion coefficients
parse_data()[source]

Parse $DATA block from the dat file.

static parse_orbitals(vecstr, clength=15)[source]

Parse dat orbitals into numpy array of the shape (naos, nmos)

Parse orbitals given a string obtained from the $VEC section of the PUNCH file (.dat) into a numpy array of the shape (naos, nmos) where “naos” and “nmos” are the number of atomic orbitals and number of molecular orbitals respectively. The shape is deduced from the last line of the string.

Args:
vecstr : str
string with the contents fo the gamess $VEC block
clength : int
total length of the coefficient string as stored by the gamess format, by default gamess stores orbital coefficients in e15.8 fortran format so the total length is 15.
Returns:
orbs : numpy.array
2D numpy array of shape (naos, nmos) containing ortbials expansion coefficients
class GamessInput(fname=None, parsed=None)[source]

Bases: object

A class for parsing and writing gamess-us input files.

data2str(header=True)[source]

Return the $DATA card of the input as a formatted string based on the previously parsed data.a

parse()[source]

Parse gamess input file into a dictionary of dictionaries, where the highest level entries are gamess namelist fileds and that contain dictionaries of options. All key are converted to lowercase.

parse_data(datastr, parse_basis=False)[source]

Parse $DATA block specified in the gamess input file. The parser assumes that in $DATA input the atom positions are specified using cartesian coordiantes and returns a list of dictionaries with parsed information about each specified atom.

Args:
datastr (str)
string with the contents of the $data block
Returns:
datadict (dict)
parse_from_string(inpstr)[source]

Parse gamess input file into a dictionary of dictionaries, where the highest level entries are gamess namelist fileds and that contain dictionaries of options. All key are converted to lowercase. For example if the following input was parsed:

parsed

Return the parsed attribute

parsed2str()[source]

Return a string with formatted string containing the GAMESS(US) input based on the previously parsed data.

print_parsed()[source]

Neat print of the dictionary with parsed input

set_gamess_input(dinp, mol, bs, code, core)[source]
write_input(filename)[source]

Write a gamess input file under the name <inpfile> based on the information fstored in the dictionary <inpdict>.

Args:
filename : str
Name of the input file
write_with_vec(filename, vecstr, keepscftyp=False)[source]

Write new gamess input based on exisiting input and natural orbitals from $VEC section in PUNCH file.

Write a new input file for gamess based on previously prased and/or constructed dictionary containing input specification and append orbitals from a previous run as starting orbitals. The starting orbitals should be stored in an ASCII PUNCH file whose name is given under “datfile” variable.

Args:
filename : str
Name of the input file to be created
vecstr : str
String with the vectors to be written
class GamessLogParser(log)[source]

Bases: object

Methods for parsing gamess-us log file.

accomplished()[source]

Check if a job teminated normally.

get_ao_labels(orbs='hf orbs')[source]

Retrieve the information about atomic basis set

get_cc_total_energy()[source]

Independently of CCTYP value return the “HIGHEST LEVEL RESULT” total energy.

get_cc_type()[source]

Get the information on CCTYP used in the gamess job.

get_charge()[source]

Get total charge.

get_ci_coeffs()[source]

Parse CI coefficients from a list of lines containing the output of GAMESS(US) calculation

Returns:
coeffs : dict
Dictionary with parsed coeficients and their indexes in the internal GAMESS(US) ordering.
get_ci_type()[source]

Get the information on CITYP used in the gamess job.

get_csfs(withcoeffs=True)[source]

Parse CSF information from a list of lines from GAMESS(US) output.

get_electrons()[source]

Get number of electrons.

get_energy_components(method)[source]

Read the summary of the energies printed in the gamess log file at the property section corresponding to a particular “method”.

get_hf_total_energy()[source]

Return the total HF energy.

get_homo()[source]

Get the orbital index of homo orbital (indexing starts from zero).

get_linear_deps()[source]

Get number of linearly dependent combinations dropped.

get_loc_strings(name)[source]
get_lz_values()[source]

Get values of Lz operator for every orbital and translate them into labels of orbitals.

get_mplevel()[source]

Get the information on MPLEVL used in the gamess job.

get_number_of_aos()[source]

Get the number of primitive cartesian gaussian basis functions from Gamess log file

get_number_of_atoms()[source]

Get total number of atoms from gamess log file.

get_number_of_core_mos()[source]

Get the number of core molecular orbitals from the Gamess log file

get_number_of_mos()[source]

Get the number of molecular orbitals from Gammess log file.

get_orbital_labels(orbs, minlength=5)[source]

Return the labels of the specified orbitals

Args:
orbs : str
String key for extracting locators
minlength : int
Minimal length of a line to be kept
Returns:
out : list
get_scf_type()[source]

Get the information on SCFTYP used in the gamess job.

get_variable(rawstring)[source]

wrapper around a regex search method

get_version()[source]

Get the version of the GAMESS(US) package.

logexists()[source]

Check if the log file exists.

logfile

Return the value of the logfile attribute

parse(regex)[source]

Parsing function based on querries in the form of regular expressions that return the match object.

class GamessUS(name='GamessUS', version='00', runopts=None, **kwargs)[source]

Bases: chemtools.calculators.calculator.Calculator

Container object for Gamess-us jobs.

accomplished(outfile)[source]

Return True if Gamess(US) job finished without errors.

get_command(inpfile)[source]

Return the command to execute

parse(output, objective, regexp=None)[source]

Parser GAMESS(US) output file to get the objective.

remove_dat(inpfile)[source]

Remove the gamess dat file if it exists in the scratch directory.

run(inpfile, logfile=None, remove_dat=True)[source]

Run a single gamess job interactively - without submitting to the queue.

run_multiple(inputs)[source]
runopts

Return the runopts

version

Return the version.

write_input(fname, template=None, mol=None, basis=None, core=None)[source]

Write the molpro input to “fname” file based on the information from the keyword arguments.

Args:
mol : chemtools.molecule.Molecule
Molecule object instance
basis : dict or BasisSet
An instance of BasisSet class or a dictionary of BasisSet objects with element symbols as keys
core : list of ints
Molpro core specification
template : str
Template of the input file
fname : str
Name of the input file to be used
det_to_spin_coupling(det, norb)[source]

Convert a string representaiton of a determinant to a string with spin coupling.

It is assumed here that a minus sign means beta spin. a will denote \(lpha\) and b will denote \(eta\)

Args:
det : str
String representation of a determinant, e.g. -3 4 2 -1
norb : int
Number of orbitals that should be present in det equal to the number of active electrons
Returns:
sc : str
String representation of a spin coupling
detsplit(det, norb)[source]

Split a string representation of the spatial part of the determinant det into n parts.

Args:
det : str
String representation of the determinant
norb : int
Number of orbitals in the determinant
Returns:
out : list
List of determinant components
get_naos_nmos(vecstr, clength=15)[source]

Get the number of AO’s and MO’s from a string in $VEC block.

Args:
vecstr (str)
string with the contents fo the gamess $VEC block
clength (int)
total length of the coefficient string as stored by the gamess format, by default gamess stores orbital coefficients in ‘e15.8’ fortran format so the total length is 15.
Returns:
naos (int)
number of atomic orbitals
naos (int)
number of moelcular orbitals
nlines (int)
number of lines per molecular orbital
to_gamess_vec(coeffs, cfmt='15.8e')[source]

Given a 2D array return a string with the elements converted to the GAMESS(US) $VEC format

Args:
coeffs : numpy.array
A two-dimensional array of type float
cmft : str
Default format for the elements of coeffs
Returns:
vec : str
A string representation of the coeffs using GAMESS(US) $VEC format
writeorbinp()[source]

A script for writing the GAMESS(US) input with guess orbitals from a previous run.