morfeus.io module#

Input and output.

class morfeus.io.CrestParser(path)[source]#

Bases: object

Parses folder with CREST output files for conformer information.

Reads the files: cre_members, crest.energies, crest_conformers.xyz

Parameters:

path (str | PathLike) – Path to CREST folder

conformer_coordinates#

Conformer coordinates (Å)

Type:

Any

degeneracies#

Degeneracies

Type:

Any

elements#

Elements

Type:

Any

energies#

Energies (a.u.)

Type:

Any

class morfeus.io.CubeParser(file)[source]#

Bases: object

Parses Gaussian cube file of electron density.

Parameters:

file (str | PathLike) – Cube file

min_x#

Minimum x value (Å)

Type:

float

min_y#

Minimum y value (Å)

Type:

float

min_z#

Minimum z value (Å)

Type:

float

step_x#

Step size in x direction (Å)

Type:

float

step_y#

Step size in y direction (Å)

Type:

float

step_z#

Step size in z direction (Å)

Type:

float

X#

3D array of x values (Å)

Type:

Any

Y#

3D array of y values (Å)

Type:

Any

Z#

3D array of z values (Å)

Type:

Any

S#

3D array of electron density scalars (electorns / Bohr^3)

Type:

Any

n_points_x#

Number of points in the x direction

Type:

int

n_points_y#

Number of points in the y direction

Type:

int

n_points_z#

Number of points in the < direction

Type:

int

class morfeus.io.D3Parser(file)[source]#

Bases: object

Parses the output of Grimme’s D3 program.

Extracts the C₆ᴬᴬ and C₈ᴬᴬ coefficients

Parameters:

file (str | PathLike) – File containing output from the D3 program.

c6_coefficients#

C₆ᴬᴬ coefficients (a.u.)

Type:

Any

c8_coefficients#

C₈ᴬᴬ coefficients (a.u.)

Type:

Any

class morfeus.io.D4Parser(file)[source]#

Bases: object

Parses the output of Grimme’s D4 program.

Extracts the C₆ᴬᴬ and C₈ᴬᴬ coefficients

Parameters:

file (str | PathLike) – File containing output from the D4 program.

c6_coefficients#

C₆ᴬᴬ coefficients (a.u.)

Type:

Any

c8_coefficients#

C₈ᴬᴬ coefficients (a.u.)

Type:

Any

class morfeus.io.VertexParser(file)[source]#

Bases: object

Parses the contents of a Multiwfn vtx.pdb file.

Extracts the vertices and faces of the surface.

Parameters:

file (str | PathLike) – Name of file containing the vertices.

faces#

Faces of surface

Type:

Array2DInt | None

vertices#

Vertices of surface

Type:

Array1DFloat

morfeus.io.get_xyz_string(symbols, coordinates, comment='')[source]#

Return xyz string.

Parameters:
  • symbols (Sequence[str]) – Atomic symbols

  • coordinates (Sequence[Sequence[float]]) – Atomic coordinates (Å)

  • comment (str) – Comment

Returns:

XYZ string

Return type:

string

morfeus.io.read_geometry(file)[source]#

Read geometry file and guess parser based on suffix.

Parameters:

file (str | PathLike) – Filename or Path object

Returns:

Elements as atomic symbols or numbers coordinates: Coordinates (Å)

Return type:

elements

Raises:

ValueError – When suffix is not supported

morfeus.io.read_gjf(file)[source]#

Reads Gaussian gjf/com file and returns elements and coordinates.

Parameters:

file (str | PathLike) – gjf/com file object.

Returns:

Elements as atomic symbols or numbers coordinates: Coordinates (Å)

Return type:

elements

morfeus.io.read_xyz(file)[source]#

Reads xyz file.

Returns elements as written (atomic numbers or symbols) and coordinates.

Parameters:

file (str | PathLike) – Filename or Path object

Returns:

Elements as atomic symbols or numbers coordinates: Coordinates (Å)

Return type:

elements

morfeus.io.write_xyz(file, elements, coordinates, comments=None)[source]#

Writes xyz file from elements and coordinates.

Parameters:
  • file (str | PathLike) – xyz file or path object

  • elements (Iterable[int] | Iterable[str]) – Elements as atomic symbols or numbers

  • coordinates (ArrayLike2D | ArrayLike3D) – Coordinates (Å)

  • comments (Sequence[str] | None) – Comments

Return type:

None