classutils

Contains auxiliary classes, usefull in combination with the gaussianclasses.

Geometry

class pyssian.classutils.Geometry[source]

This class provides a basic interface and different construction methods to simplify the extraction of the geometry of a molecule from different sources

Currently: Link202, GaussianInFile, xyz file

classmethod from_Input(InputFile)[source]

Generate a Geometry instance from a Gaussian Input File instance.

classmethod from_L202(L202)[source]

Generate a Geometry instance from a Gaussian file. If it can't find a mapping from atomic Number to symbol it will store the string representation of the number

classmethod from_xyz(xyzfile)[source]

Generate a Geometry instance from a xyz file.

update_atoms(other)[source]

Updates the atoms names from a mapping

write(File)[source]

Write Geometry to a File

Cube

class pyssian.classutils.Cube[source]

Representation of a Gaussian .cube File generated with the cubegen tool. This class facilitates some operations of the cubeman tool allowing operations of more than 2 .cube files.

Files with more than 1 cube are accepted but correct behaviour is not guaranteed.

natoms

total number of atoms

Type

int

type

Type of cube. Currently only {'MO','other'} are considered

Type

str

isUnrestricted

True if the line that contains the number of atoms has 5 elements instead of 4.

Type

bool

origin

origin of the cube.

Type

tuple

shape

Number of points in each of the three directions.

Type

tuple

basis

Vectors of the three main directions.

Type

list

atoms

List of the AtNumber, Charge, (x,y,z) per each atom.

Type

list

nMO

Number of molecular orbitals (Current implementation is designed for only one MO per Cube)

Type

int

MO_Ids

Ids of the MO orbitals. (Current implementation is designed for only one MO per Cube)

Type

list

matrix

Matrix of values of the Cube.

Type

numpy.array

classmethod from_file(file)[source]

Creates a Cube instance from a cube file.

Parameters

file (str) -- A valid filename to an existing .cube file.

Returns

Instantiated cube from the file.

Return type

Cube

write(OFile)[source]

Writes a cube to a File.

Parameters

OFile (str) -- A valid path to a file.

write_values(File)[source]

Handles the writing in of the values of self.matrix with the fortran77 format

Parameters

File (_io.TextIOWrapper) -- the output of a open(Filename,'w')

DirectoryTree

class pyssian.classutils.DirectoryTree(path)[source]

Class that provides recursive file iteration.

static RecursiveFileSystemGenerator(path, key=None)[source]

Generator that traverses the filesystem in depth first order and yields the paths that satisfy the key function condition. If no key function is provided, returns all folders and items. The first yield is always None, and the second yield is always the path value if it satisfies the key condition.

Parameters
  • path (Path) -- Path pointing to a directory.

  • key (function) -- A function that returns a boolean. Used in a similar function as the 'sorted' python builtin.

newpath(path)[source]

Takes a path rooted to the previous root and prepares it to be rooted in the new root.