displace_phonopy

Module to process band.yaml file from phonopy calculations to extract eigenvectors

Classes

DisplacePhonopy(filename)

A class to handle displacement based on VASP+PHONOPY band.yaml file.

class displace_phonopy.DisplacePhonopy(filename)[source]

A class to handle displacement based on VASP+PHONOPY band.yaml file. To obtain eigenvectors on band.yaml, switch on eigenvector tag to true in band.conf file.

Parameters:

filename (str) – The name of the YAML file containing the displacement data, usually band.conf.

filename

The name of the YAML file containing the displacement data.

Type:

str

data

The parsed data from the YAML file.

Type:

dict

eigen

List containing eigenvalues.

Type:

list

Example

>>> displace = DisplacePhonopy("band.conf") #create an object
>>> displace.parse() #parsing band.conf
>>> displace.extract_mass() #Extracting mass and store in self.mass
>>> displace.print_qpt() #print qpoints and its index
0 [0.0, 0.0, 0.0]
1 [0.1, 0.1, 0.1]
...
>>> displace.print_mode(0) #print band energies for a qpoint
1 0.0
2 0.1
...
>>> displace.negative_freq() #returns dictionary of qpoints, band index, and phonon frequency
>>> #Easy to locate qpoint (iq) and band index (inu) for negative frequencies
>>> displace.geteigenvec(0, 0) #get eigen vector corresponding to particular iq and inu.
>>> displace.applydisplace() #Apply distortion to the structure, provided an undistorted
>>> #structure exists as POSCAR file
parse()[source]

Parses the YAML file specified by ‘filename’.

Return type:

None

print_qpt()[source]

Prints the q-point positions from the parsed data.

Return type:

None

mass_extract()[source]

Returns list of masses of the ions

print_mode(iqpt)[source]

Prints the energy modes for a given q-point index.

Parameters:

iqpt (int) – Index of the q-point for which energy modes are to be printed.

Return type:

None

negative_freq()[source]

Identifies q-points with negative frequencies and returns them as a dictionary.

Constructs a dictionary where each key represents a q-point and its associated value is a list containing the q-point index, band index, and frequency with negative values. The q-point index and band index are combined in the key.

Returns:

Dictionary with q-point as key and a list containing q-point index, band index, and negative frequency as values.

Return type:

dict

geteigenvec(iqpt, imode)[source]

Retrieves the eigenvectors for a specified q-point index and mode index.

Parameters:
  • iqpt (int) – Index of the q-point.

  • imode (int) – Index of the mode.

Return type:

None

applydisplace()[source]

Applies displacement to the structure based on the eigenvectors.

Retrieves the structure from the “POSCAR” file using pymatgen and applies displacement to each site based on the corresponding eigenvector values. The modified structure is then written to a new VASP POSCAR file named “displace_poscar.vasp”.

Return type:

None