abipy.embedding namespace

Submodules

abipy.embedding.embedding_ifc module

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

Bases: Phonopy

Extends Phonopy object implementing the Interatomic Force Constants embedding method as 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=None, vacancies_list=None, interstitial_list=None, tol_mapping=0.01, cut_off_mode='auto', rc_1=None, rc_2=None, factor_ifc=1.0, verbose=0, asr=True)[source]
Parameters:
  • phonopy_pristine (Phonopy) – Phonopy object of the pristine structure.

  • phonopy_defect (Phonopy) – Phonopy object of the defect structure.

  • structure_defect_wo_relax (Structure) – 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 (Structure) – 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) – List of substitutions info [index, specie], ex: [[0, “Eu”],[1,”N”]]

  • vacancies_list (list) – List of indices where the vacancies are located, ex: [13, 14].

  • interstitial_list (list) – List of interstitial info [specie, cart_coord], ex [[‘Eu’,[0,0,0]],[‘Ce’,’[0,0,3]’]].

  • tol_mapping (float) – Tolerance in angstrom for the mapping between structures

  • cut_off_mode (str) – 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 (float | None) – Radii of the sphere centered around the defect outside which the IFCs are set to zero, allows to get sparse matrix.

  • rc_2 (float | None) – Radii of the sphere centered around the defect where the IFCs of the defect computation are included

  • factor_ifc (float) – Multiply the IFCs inside the sphere of radii rc_2 by factor_ifc, useful to introduce fictious high-frequency local mode.

  • verbose (int) – Print explicitly all the IFCs replacements.

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

Return type:

Phonopy

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

Return type:

tuple[ndarray, ndarray]

Returns:

phonons frequencies, phonon eigenvectors

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

Call the converter to go from phonopy to Abinit DDB.

Parameters:
  • embedded_ddb_path – filepath where to save the DDB.

  • workdir – work directory for the conversion.

abipy.embedding.utils_ifc module

Useful functions to be used in embedding_ifc

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(structure)[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

Return type:

Structure

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

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

Return type:

Structure

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() Useful to match structures after clean_structure()

Return type:

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

Return type:

list[int]

abipy.embedding.utils_ifc.accoustic_sum(Hessian_matrix, atom_label)[source]
Return type:

ndarray

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 with the eigenvectors provided.

  • 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

Return type:

None