PDielec.GulpOutputReader

Module to read the contents of a Gulp output file.

Classes

GulpOutputReader

Read the contents of a Gulp output file.

Module Contents

class PDielec.GulpOutputReader.GulpOutputReader(names)[source]

Bases: PDielec.GenericOutputReader.GenericOutputReader

Read the contents of a Gulp output file.

Inherits from GenericOutputReader

This function provides a way to read and interpret the contents of a Gulp output file, advising on a suitable set of command parameters that can be used for various calculations such as phonon calculations, IR intensity calculations, printing eigen vectors of the dynamical matrix, and printing cartesian coordinates. It emphasizes the importance of certain parameters to ensure accurate and comprehensive results.

Parameters

nameslist

A list containing the name(s) of the Gulp output file(s).

Attributes

_gulpfilestr

The name of the first Gulp output file in the names list.

namestr

The absolute path of the _gulpfile.

typestr

A string indicating the type of the reader object, set to ‘Gulp output’.

shellsint

Number of shells, initialized to 0.

ncoresint

Number of cores, initialized to 0.

_cartesian_coordinateslist

List to store cartesian coordinates, initially empty.

_fractional_coordinateslist

List to store fractional coordinates, initially empty.

atomic_chargeslist

List to store atomic charges, initially empty.

_mass_dictionarydict

Dictionary to store mass information, initially empty.

temperatureNoneType or float

Temperature, initialized as None.

elastic_constant_tensorNoneType or ndarray

Elastic constant tensor, initialized as None.

nshellsNoneType or int

Number of shells, initialized as None (may be updated later).

nions_irreducibleNoneType or int

Number of irreducible ions, initialized as None.

_atom_typesNoneType or list

List of atom types, initialized as None.

Notes

It is quite difficult to work out what is a suitable set of commands for Gulp. The following seems to work OK, with emphasis on these important parameters: - phon: a phonon calculation. - intens: calculate the IR intensities. - eigen: print the eigen vectors of the dynamical matrix. - cart: print the cartesian coordinates (this is the only way of seeing what all the atom types are). - nosym: make sure the calculation is done in P1. Also includes options for various modifications and optimizations like qeq, molq, optimise, conp, qok, nomodcoord, and prop.

_read_born_charges(line)[source]

Read the born charges from the gulp file.

This function reads the born charges as arranged in the gulp file. Each column in the output fetched refers to a given field direction, and each row refers to the atomic displacement. The function rearranges the output to match the required tensor format where 1, 2, and 3 are the field directions, and x, y, and z are the atomic displacements.

Parameters

linestr

Ignored

Returns

numpy.ndarray

The born charges arranged in the tensor format as specified. The format of the tensor is a square matrix where each row is [ax, ay, az] for atomic displacements under a particular field direction.

Examples

Consider the output format [[a1x a1y a1z]

[a2x a2y a2z] [a3x a3y a3z]]

The function rearranges it to the required format: [[a1x a1y a1z] [a2x a2y a2z] [a3x a3y a3z]]

Notes

The original output from the gulp file is read line by line, with each line representing the atomic displacement in each of the field directions. The reformatted output aligns these displacements into a more conventional tensor format for further processing or analysis.

_read_cellcontents(line)[source]

Read the cell contents in xyz space.

Parameters

linestr (not used)

The initial line

Returns

None

_read_cellcontentsf(line)[source]

Read the cell contents in fractional space.

Parameters

linestr (not used)

The initial line

Returns

None

_read_elastic_constants(line)[source]

Read the elastic constants.

Parameters

linestr (not used)

The initial line

Returns

None

_read_energies(line)[source]

Read energies.

Parameters

linestr

The initial line

Returns

None

_read_external_pressure(line)[source]

Read external pressure.

Parameters

linestr

The initial line

Returns

None

_read_frequencies(line)[source]

Read the frequencies.

Parameters

linestr (not used)

The initial line

_read_lattice(line)[source]

Read the lattice vectors.

Parameters

linestr (not used)

The initial line

Returns

None

_read_number_of_irreducible_atoms(line)[source]

Read the number of irreducible atoms.

Parameters

linestr

The initial line

Returns

None

_read_optical_dielectric(line)[source]

Read optical dielectric constant.

Parameters

linestr (not used)

The initial line

_read_output_files()[source]

Initialise the phrases needed to search the .gout file and the routines to use when a match is found. Read the .gout file.

Parameters

None

Returns

None

_read_species(line)[source]

Read species information.

Parameters

linestr (not used)

The initial line

Returns

None

_read_static_dielectric(line)[source]

Read static dielectric constant.

Parameters

linestr (not used)

The initial line

Returns

None

_read_temperature(line)[source]

Read temperature.

Parameters

linestr

The initial line

Returns

None

_read_total_number_of_atoms(line)[source]

Read the number of atoms.

Parameters

linestr

The initial line

Returns

None

_atom_types = None
_cartesian_coordinates = []
_fractional_coordinates = []
_gulpfile
_mass_dictionary
atomic_charges = []
elastic_constant_tensor = None
name = b'.'
ncores = 0
nions_irreducible = None
nshells = None
shells = 0
temperature = None
type = 'Gulp output'