tmoutproc package

Submodules

tmoutproc.calc_utils module

Methods usefull for calculations using turbomole output

tmoutproc.calc_utils.atom_type_to_atomic_number(atom_type)

Returns atomic_number of atom given in atom_type

Parameters:

param1 (String) – atom type

Returns:

ordinal number (int)

tmoutproc.calc_utils.atom_weight(atom, u2kg=False)

Return mass of atom in kg or au (au is default)

Parameters:
  • param1 (String) – Atom type

  • param2 (boolean) – convert to kg

Returns:

float

tmoutproc.calc_utils.create_dynamical_matrix(filename_hessian, filename_coord, t2SI=False, dimensions=3)

Creates dynamical matrix by mass weighting hessian. Input units are hartree/bohr**2.1 Default output in turbomole format (hartree/(bohr**2*u))

Parameters:
  • param1 (String) – Filename to hessian

  • param2 (String) – Filename to coord file (xyz or turbomole format)

  • param3 (boolean) – convert ouptput from turbomole (hartree/(bohr**2*u)) in SI units

  • param3 (int) – number of dimensions

Returns:

np.ndarray

tmoutproc.calc_utils.determine_n_orbitals(coord_path, basis_set='dev-SV(P)')

Determines number of orbitals for calculation using coord file (turbomole format, xyz support is planned) and basis set.

Parameters:
  • coord_path (String) – path to coord file (turbomole coord file)

  • basis_set (String) – basis set

Returns:

Number of orbitals

Return type:

n_orbitals (int)

tmoutproc.calc_utils.find_c_range_atom(atom, number, coord, basis_set='dev-SV(P)')

finds atoms range of expansion coef in mos file. number gives which atoms should be found e.g. two sulfur : first number =1; second = 2

Parameters:
  • param1 (String) – atom type

  • param2 (int) – number of atom type atom

  • param3 (String) – coord file (from io.read_coord_file())

  • param4 (String) – basis_set=”dev-SV(P)”

Returns:

tuple (index_start, index_end)

tmoutproc.calc_utils.get_norb_from_config(config)

Get number of orbitals from turbomole config string (for example [6s3p2d])

Parameters:

config (String) – configuration string

Returns:

Number of orbitals

Return type:

Norb (int)

tmoutproc.constants module

tmoutproc.geometry_utils module

Manipulating coord files in xyz and turbomole format

tmoutproc.geometry_utils.align_molecule(coord_xyz, axis, molecule_axis)

Aligns molecule stored in coord_xyz along axis. Molecule_axis[0/1] give the indices of molecules which define the molecule axis. Please note: coord_xyz = top.read_xyz_file(filename)

Parameters:
  • coord_xyz (np.ndarray) – coord_xyz file read with top from xyz file (coord_xyz = op.read_xyz_file(filename)))

  • axis (np.array) – axis is aligned along axis -> axis[x,y,z]

  • molecule_axis (np.array) – indices of atoms in coord_xyz which define the molecule axis (index1, index2)

Returns:

Rotated coord_xyz file

Return type:

coord_xyz

tmoutproc.geometry_utils.fix_atoms(coord, indices, unfix_first=False)

fixes atoms in indices in turbomole coord file coord

Parameters:
  • coord – coord file read with top.io.read_coord_file

  • indices – array-like of indices in coord file which should be fixed. “all” is also possible -> every atom is fixed. Other option is “invert” -> fixes are inverted

  • unfix_first – if True, all atoms are unfixed before the atoms in indices are fixed

Returns: coord with fixed atoms

tmoutproc.geometry_utils.remove_fixed_atoms_from_coord(coord)

Removes fixed atoms from turbomole coord file.

Parameters:

coord – coord file data loaded with io.read_coord_file

Returns:

filtered coord file data

Return type:

coord

tmoutproc.geometry_utils.shift_coord_file(coord, x_shift, y_shift, z_shift)

Shifts coordinates in coord file loaded with io.read_coord_file.

Parameters:
  • coord_xyz – Coord file loaded with io.read_coord_file

  • x_shift – x shift in Bohr

  • y_shift – y shift in Bohr

  • z_shift – z shift in Bohr

Returns:

Shifted coord file

Return type:

coord

tmoutproc.geometry_utils.shift_xyz_coord(coord_xyz, x_shift, y_shift, z_shift)

Shifts coordinates in coord file loaded with read_xyz_file.

Parameters:
  • coord_xyz – Coord file loaded with read_xyz_file

  • x_shift – x shift in Angstrom

  • y_shift – y shift in Angstrom

  • z_shift – z shift in Angstrom

Returns:

Shifted xyz coord file

Return type:

coord_xyz

tmoutproc.geometry_utils.sort_coord(coord, axis)

Sort coord_xyz according to axis (x=0, y=1, z=2)

Parameters:
  • coord_xyz – Coord file loaded with read_xyz_file

  • axis – Axis (x=0, y=1, z=2)

Returns:

Sorted coord_xyz

Return type:

coord_xyz

tmoutproc.geometry_utils.sort_xyz_coord(coord_xyz, axis)

Sort coord_xyz according to axis (x=0, y=1, z=2)

Parameters:
  • coord_xyz – Coord file loaded with read_xyz_file

  • axis – Axis (x=0, y=1, z=2)

Returns:

Sorted coord_xyz

Return type:

coord_xyz

tmoutproc.geometry_utils.t2x(coord)

Transforms turbomole coord to coord_xyz

Parameters:

coord (np.ndarray) – coord

Returns:

coord_xyz

Return type:

coord_xyz (np.ndarray)

tmoutproc.geometry_utils.x2t(coord_xyz)

Transforms coord_xyz from xyz format to turbomole

Parameters:

coord_xyz – coord array in xyz

Returns:

coord in turbomole format

Return type:

coord (np.ndarray)

tmoutproc.io module

Loading and saving coord files in xyz and turbomole format

tmoutproc.io.create_sysinfo(coord_path, basis_path, output_path)

Create sysinfo according to given template. Sysinfo is used for transport calculations used by Theo 1 Group of University of Augsburg. It contains information about the orbitals, the charge, number of ecps and the coordinates of the positions {number atom} {orbital_index_start} {orbital_index_end} {charge} {number ecps} {x in Bohr} {y in Bohr} {z in Bohr}

Parameters:
  • coord_path (String) – Path to turbomole coord file

  • basis_path (String) – Path to turbomole basis file

  • output_path (String) – Path where sysinfo is written

Returns:

tmoutproc.io.read_coord_file(filename, skip_lines=1)

Reads coord file in turbomole format. Coordinates are converted to float, atoms types are strings. coord[:,i]…All entries for atom i. coord[0,:]…x coordinates of all atoms (float) coord[1,:]…y coordinates of all atoms (float) coord[2,:]…z coordinates of all atoms (float) coord[3,:]…atom types of all atoms (str) coord[4,:]…fixed information Lines in the end of file starting with “$” are skippend (e.g. $user-defined bonds and $end)

Parameters:
  • param1 (String) – Filename

  • param2 (int) – Lines to be skipped in the beginning (e.g. $coord line)

Returns:

coord with shape (5, N_atoms)

Return type:

coord (np.ndarray)

tmoutproc.io.read_from_flag_to_flag(control_path, flag, output_path, header='', footer='')

Reads file in control_path from flag to next flag or end of file. This can be used to get parts of the turbomole control file. Flags begin with “$”. The extracted part is written to file output_path without the leading flag. If flag is found and corresponding part contains data, status 0 is returned, file is written. If flag is not found, status -1 is returned and no file is written. If flag is found, but corresponding part contains no data, status -2 is returned and no file is written.

Parameters:
  • control_path (String) – Path to considered file

  • flag (String) – Flag which

  • output_path (String) – Path to output file

  • header (String) – Header added to output file

  • footer (String) – Footer added to output file

Returns:

status (int)

tmoutproc.io.read_g98_file(filepath)

Reads a Gaussian 98 output file and extracts the frequencies, red masses, frc consts, IR intensities, Raman activities, and depolarization ratios. :Parameters: filepath (str) – Path to the *.g98 file

Returns:

Properties of each mode, with keys:
  • ”coord_xyz”: Coordinates as np.array

  • ”coode_xyz”: displacements as np.array

  • ”frequency”, “red_mass”, “frc_const”, “ir_intensity”, “raman_activity”, “depolarization_ratio”

Return type:

list of dict

tmoutproc.io.read_hessian(filename, n_atoms, dimensions=3)

Reads hessian from turbomole format and converts it to matrix of float

Parameters:
  • param1 (String) – Filename

  • param2 (int) – Number of atoms

Returns:

np.ndarray

tmoutproc.io.read_mos_file(filename)

Reads mos file. Eigenvectors[:,i] are the components for MO i.

Parameters:

param1 (string) – filename

Returns:

eigenvalue_list (np.array),eigenvectors (np.ndarray)

tmoutproc.io.read_nmd_file(filename)

Read normal mode displacement file in VMDs normal wizard file format.

Parameters:

filename (str) – Path to input file

Returns:

Properties of each mode, with keys:
  • ”coord_xyz”: Coordinates as np.array

  • ”mode_xyz”: displacements as np.array

Return type:

modes (list of dict)

tmoutproc.io.read_packed_matrix(filename, output='sparse')

Reads packed symmetric matrix from file and creates matrix returns matrix in scipy.sparse.csc_matrix or dense matrix (np.ndarray) depending on output param

Parameters:
  • param1 (String) – filename

  • param2 (String) – Output format: “sparse” (->scipy.sparse.csc_matrix) or “dense” (->np.ndarray)

Example

761995 nmat

1 1.000000000000000000000000 2 0.9362738788014223212385900 3 1.000000000000000222044605 4 0.4813841609941338917089126 5 0.6696882728399407014308053 6 1.000000000000000000000000 . . .

Returns:

scipy.sparse.csc_matrix

tmoutproc.io.read_plot_data(filename, return_header=False, delimiter='\t', skip_lines_beginning=0, skip_lines_end=0)

Reads data in file (eg plot data). If return_header is set to True, the header is returned as String. Header can only returned if header is found. data[i,:] is the ith column in the data file. skip_lines are lines to be skipped. These lines are not read. Headers cannot be extracted from these lines.

Parameters:
  • param1 (String) – Filename

  • param2 (Boolean) – Return Header

  • param3 (String) – Delimiter

  • param4 (int) – Lines to be skipped at the beginning

  • param5 (int) – Lines to be skipped at the end

Returns:

datContent (np.ndarray), Header

tmoutproc.io.read_qpenergies(filename, col=1, skip_lines=1)

read qpenergies.dat and returns data of given col as list, skip_lines in beginning of file, convert to eV col = 0 qpenergies, col = 1 Kohn-Sham, 2 = GW

Parameters:
  • param1 (string) – filename

  • param2 (int) – col=2 (column to read)

  • param3 (int) – skip_lines=1 (lines without data at beginning of qpenergiesfile)

Returns:

list

tmoutproc.io.read_symmetric_from_triangular(input_path, skip_lines=0)

Read symmetric matrix stored in triangular form. Example Input : a, b, d, c, e, f Example Output: a b c b d e c e f

Parameters:
  • input_path (String) – Path to file

  • skip_lines (int) – Lines of file which sould be skipped (e.g. header stuff)

Returns:

tmoutproc.io.read_xyz_file(filename, return_header=False)

load xyz file and returns data as coord_xyz. coord[:,i] … Entries for atom i coord[i,:] … Atoms types (str) [i=0], x (float) [i=1], y (float) [i=2], x (float) [z=3] for all atoms

Parameters:
  • param1 (String) – filename

  • param2 (Boolean) – return_header: If set to true (coord_xyz, header) is returned

Returns:

coord_xyz, header (optional)

tmoutproc.io.read_xyz_path_file(filename, return_header=False, start_geo=0, end_geo=-1)

load xyz path file and returns data as coord_xyz with additional dimension. coord[i,:,:] … Entries for structure i coord[:,:,i] … Entries for atom i coord[:,i,:] … Atoms types (str) [i=0], x (float) [i=1], y (float) [i=2], x (float) [z=3] for all atoms

Parameters:
  • param1 (String) – filename

  • param2 (Boolean) – return_header: If set to true (coord_xyz_path, header) is returned. coord_xyz_path else

  • param3 (int) – start_geo: First geometry to be read

  • param4 (int) – end_geo: Last geometry to be read

Returns:

coord_xyz_path, header (optional)

tmoutproc.io.write_coord_file(filename, coord, mode='w')

writes coord file.

Parameters:
  • param1 (String) – filename

  • param2 (np.ndarray) – coord

  • param3 (String – w,a): mode

Returns:

tmoutproc.io.write_g98_file(filename, modes, decimal_places=2)

Write normal mode displacement file in Gaussian 98 format.

Parameters:
  • filename (str) – Path to output file

  • modes (list of dict) – Properties of each mode, with keys: - “coord_xyz”: Coordinates as np.array - “mode_xyz”: displacements as np.array - “frequency”: Frequency of the mode (if not given it is set to 0) - “red_mass”: Reduced mass of the mode (if not given it is set to 0) - “frc_const”: Force constant of the mode (if not given it is set to 0) - “ir_intensity”: IR intensity of the mode (if not given it is set to 0) - “raman_activity”: Raman activity of the mode (if not given it is set to 0) - “depolarization_ratio”: Depolarization ratio of the mode (if not given it is set to 0)

  • decimal_places (int) – Number of decimal places for the coordinates

Returns:

tmoutproc.io.write_lammps_geo_data(filename, coord_xyz, xlo=0, xhi=0, ylo=0, yhi=0, zlo=0, zhi=0, charges=None, units='real', atom_style='full', header='')

Writes xyz coordinates to lammps geometry data file. Right now only units real and atom_style full are supported. :Parameters: * filename (String) – Filename of output file

  • coord_xyz (np.ndarray) – Coordinates of atoms in xyz format read by read_xyz_file

  • xlo (float) – Lower x boundary

  • xhi (float) – Upper x boundary

  • ylo (float) – Lower y boundary

  • yhi (float) – Upper y boundary

  • zlo (float) – Lower z boundary

  • zhi (float) – Upper z boundary

  • charges (np.ndarray) – Charges of atoms

  • units (String) – Lammps units (only “real” supported)

  • atom_style (String) – Lammps atom_style (only “full” supported)

  • header (String) – Header added to output file

Returns:

tmoutproc.io.write_mos_file(eigenvalues, eigenvectors, filename, scfconv='', total_energy='')

Writes mos file in turbomole format.

Parameters:
  • param1 (np.array) – eigenvalues

  • param2 (np.ndarray) – eigenvectors

  • param3 (string) – filename

  • param4 (int) – scfconv parameter (optional)

  • param5 (float) – total_energy in a.u. (optional)

tmoutproc.io.write_nmd_file(filename, modes, scale_with_mass=False)

Write normal mode displacement file in VMDs normal wizard file format.

Parameters:
  • filename (str) – Path to output file

  • modes (list of dict) – Properties of each mode, with keys: - “coord_xyz”: Coordinates as np.array - “mode_xyz”: displacements as np.array

  • scale_with_mass (Boolean) – If set to True, the displacements are scaled with the square root of the atomic masses

Returns:

tmoutproc.io.write_packed_matrix(matrix, filename, header='default', footer='')

write symmetric scipy.sparse.csc_matrix in in packed storage form

Parameters:
  • param1 (scipy.sparse.csc_matrix or np.ndarray) – input matrix

  • param2 (String) – filename

  • param3 (String) – Header. Unless otherwise specified “num_elements_to_write nmat” is written to file

  • param4 (String) – Footer. Default setting is no footer (“”)

Returns:

tmoutproc.io.write_plot_data(filename, data, header='', delimiter='\t')

Writes data in file (eg plot data). data[j][i] : Column j, Line i

Parameters:
  • param1 (String) – Filename

  • param2 (List, Tuple, np.ndarray) – Data to be stored (each entry is one column in data, data[j][i] : Column j, Line i)

  • param3 (String) – Fileheader

  • param4 (String) – Delimiter

Returns:

tmoutproc.io.write_symmetric_to_triangular(matrix, output_path, threshold=0.0)

Write symmetric matrix to file. The triangular form ist written to file. Example Input: a b c b d e c e f Example Output: a, b, d, c, e, f

Parameters:
  • matrix (numpy.ndarray) – Symmetric matrix

  • output_path (String) – Path of output file

  • threshold (float) – Threshold for accepted asymmetry

Returns:

tmoutproc.io.write_xyz_file(filename, coord_xyz, comment_line='', mode='w', suppress_sci_not=False)

writes xyz file.

Parameters:
  • param1 (String) – filename

  • param2 (np.ndarray) – coord_xyz

  • param3 (String) – comment_line

  • param4 (String – w,a): mode

  • param5 (Boolean) – suppress_sci_not: Suppress scientific notation

Returns:

tmoutproc.setup module

tmoutproc.test module

Module contents

Welcome to tmoutproc´s documentation! This package includes: io, geometry_utils and calc_utils.