embedding Package

embedding Package

embedding_ifc Module

class abipy.embedding.embedding_ifc.Embedded_phonons(stru_pristine, stru_defect, stru_emb, ifc_emb, nac_params)[source]

Bases: Phonopy

Defines a Phonopy object implementing the Interatomic Force Constants embedding method defined in:

classmethod from_phonopy_instances(phonopy_pristine, phonopy_defect, structure_defect_wo_relax, main_defect_coords_in_pristine, main_defect_coords_in_defect, substitutions_list: list = None, vacancies_list: list = None, interstitial_list: list = None, tol_mapping=0.01, cut_off_mode='auto', rc_1=None, rc_2=None, factor_ifc=1, verbose=0, asr=True) Phonopy[source]
Parameters:
  • phonopy_pristine – Phonopy object of the pristine structure

  • phonopy_defect – Phonopy object of the defect structure

  • structure_defect_wo_relax – Supercell structure associated to the defect structure, but without relaxation. Needed for an easier mapping. Should corresponds to order of phonopy_defect structure!

  • main_defect_coords_in_pristine – Main coordinates of the defect in pristine structure, if defect complex, can be set to the center of mass of the complex

  • main_defect_coords_in_defect – Main coordinates of the defect in defect structure, if defect complex, can be set to the center of mass of the complex

  • substitutions_list – List of substitutions infos [index,specie], ex : [[0, “Eu”],[1,”N”]]

  • vacancies_list – List of indices where the vacancies are, ex: [13,14]

  • interstitial_list – List of interstitial infos [specie, cart_coord], ex [[‘Eu’,[0,0,0]],[‘Ce’,’[0,0,3]’]]

  • tol_mapping – Tolerance in angstrom for the mapping between structures

  • cut_off_mode – Cut off mode for the radii of the sphere centered around the defect (rc_2). if ‘auto’ : the code tries to find the largest sphere inscribed in the defect supercell. If ‘manual’ : rc_1 and rc_2 should be provided.

  • rc_1 – Radii of the sphere centered around the defect outside which the IFCs are set to zero, allows to get sparse matrix.

  • rc_2 – Radii of the sphere centered around the defect where the IFCs of the defect computation are included

  • factor_ifc – Multiply the IFCs inside the sphere of radii rc_2 by factor_ifc, usefull to introduce fictious high-frequency local mode

  • verbose – Print explicitely all the IFCs replacements

  • asr – If True, re-enforce acoustic sum rule after IFCs embedding, following eq. (S4) of https://pubs.acs.org/doi/10.1021/acs.chemmater.3c00537

Returns:

A new phonopy object with the embedded structure and embedded IFCs.

get_gamma_freq_with_vec_abipy_fmt()[source]

Compute with phonopy the Gamma phonons freq and vectors and returns them in abipy format such that ph_vec[iband][iatom] gives vector of iband,iatom

Returns:

phonons frequencies, phonon eigenvectors

to_ddb(embedded_ddb_path='out_DDB', workdir=None)[source]

Call the converter to go from phonopy to a DDB

Parameters:
  • embedded_ddb_path – filepath where to save the DDB

  • workdir – work directory for the conversion

utils_ifc Module

abipy.embedding.utils_ifc.stru_0_1_to_minus_05_05(structure)[source]

translate the structure so that the frac_coords go from [0,1] to [-0.5,0,5]

abipy.embedding.utils_ifc.frac_coords_05_to_minus05(stru)[source]

Move atoms that are close to frac_coord = 0.5 to -0.5 Needed for atoms that are at -0.5 in the perfect supercell but move to for instance 0.498 after relaxation

abipy.embedding.utils_ifc.center_wrt_defect(structure, defect_coord)[source]

Center the structure around defect_coord. Defect is now at [0,0,0]

abipy.embedding.utils_ifc.clean_structure(structure, defect_coord)[source]

Apply successively : center_wrt_defect(), stru_0_1_to_minus_05_05(), frac_coords_05_to_minus05() Usefull to match structures after clean_structure()

abipy.embedding.utils_ifc.map_two_structures_coords(stru_1, stru_2, tol=0.1)[source]

Returns a mapping between two structures based on the coordinates, within a given tolerance in Angstrom. stru_1 should be a subset of the superset structure stru_2

abipy.embedding.utils_ifc.accoustic_sum(Hessian_matrix, atom_label)[source]
abipy.embedding.utils_ifc.inverse_participation_ratio(eigenvectors)[source]

Compute equation (10) of https://pubs.acs.org/doi/10.1021/acs.chemmater.3c00537 for a given q-point, eigenvectors shape=(nbands,natoms,3)

abipy.embedding.utils_ifc.localization_ratio(eigenvectors)[source]

See equation (10) of https://pubs.acs.org/doi/10.1021/acs.chemmater.3c00537 for a given q-point, eigenvectors shape=(nbands,natoms,3)

abipy.embedding.utils_ifc.vesta_phonon(eigenvectors, in_path, ibands=None, scale_vector=20, width_vector=0.3, color_vector=[255, 0, 0], centered=True, factor_keep_vectors=0.1, out_path='VESTA_FILES')[source]

Draw the phonons eigenvectors on a vesta file. Inspired from https://github.com/AdityaRoy-1996/Phonopy_VESTA/tree/master

Parameters:
  • eigenvectors – phonons eigenvectors for given q-point with shape (nbands,natom,3)

  • in_path – path where the initial vesta structure in stored, the structure should be consistent

  • provided. (with the eigenvectors)

  • ibands – list of indices of the bands to include, if not provided, all the bands

  • scale_vector – scaling factor of the vector modulus

  • width_vector – vector width

  • color_vector – color in rgb format

  • centered – center the vesta structure around [0,0,0]

  • factor_keep_vectors – draw only the eigenvectors with magnitude > factor_keep_vectors * max(magnitude)

  • out_path – path where .vesta files with vector are stored