Skip to content

Commit

Permalink
Update material tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oashour committed Apr 26, 2024
1 parent d20fc90 commit 4ec3187
Show file tree
Hide file tree
Showing 4 changed files with 818 additions and 13 deletions.
13 changes: 7 additions & 6 deletions darkmagic/material.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def __init__(

properties.validate_for_phonons(n_atoms)

m_atoms = phonopy_file.primitive.get_masses() * const.amu_to_eV
m_atoms = phonopy_file.primitive.masses * const.amu_to_eV

# NAC parameters (born effective charges and dielectric tensor)
self.born = np.array(
Expand All @@ -256,9 +256,9 @@ def __init__(
# Create a Structure object
# At some point should make careful assessment of primitive vs unit_cell
# PhonoDark uses primitive, but what about when it's different from unit_cell?
positions = phonopy_file.primitive.get_scaled_positions()
lattice = np.array(phonopy_file.primitive.get_cell()) * const.Ang_to_inveV
species = phonopy_file.primitive.get_chemical_symbols()
positions = phonopy_file.primitive.scaled_positions
lattice = np.array(phonopy_file.primitive.cell) * const.Ang_to_inveV
species = phonopy_file.primitive.symbols

structure = Structure(lattice, species, positions)

Expand All @@ -277,7 +277,7 @@ def get_eig(
Returns:
A tuple containing the phonon frequencies and eigenvectors.
* The phonon frequencies are represented as a numpy array of shape (n_modes,)
* The phonon frequencies are represented as a numpy array of shape (n_k,n_modes)
* The eigenvectors are represented as a numpy array of shape (n_k, n_modes, n_atoms, 3)
Expand All @@ -295,14 +295,15 @@ def get_eig(
mesh_dict = self.phonopy_file.get_qpoints_dict()

eigenvectors_pre = mesh_dict.get("eigenvectors", None)
# print(eigenvectors_pre)
# convert frequencies to correct units
omega = const.THz_to_eV * mesh_dict["frequencies"]

eigenvectors = np.zeros(
(len(k_points), self.n_modes, self.n_atoms, 3), dtype=complex
)
# Need to reshape the eigenvectors from (n_k, n_modes, n_modes)
# to (n_k, n_atoms, n_modes, 3)
# to (n_k, n_atoms, n_modes, 3) # TODO: is this correct?
if with_eigenvectors:
# TODO: Should rewrite this with a reshape...
for q in range(len(k_points)):
Expand Down
8 changes: 4 additions & 4 deletions darkmagic/v_integrals.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def g0(self):

@property
def g1(self):
"""
r"""
Computes the g1 integral for each (q, omega) pair
See Eq. C11 in EFT paper (2009.13534)
Expand Down Expand Up @@ -115,7 +115,7 @@ def g2(self):

@property
def F(self):
"""
r"""
Computes the very last term of Eq. (C14) in the EFT paper (2009.13534)
This is the term that multiplies (1 - qhat \otimes qhat) in the g2 integral
"""
Expand All @@ -131,7 +131,7 @@ def F(self):

@property
def X(self):
"""
r"""
Computes the X vector for each (q, omega) pair
$$
Expand All @@ -150,7 +150,7 @@ def X(self):

@property
def eye_minus_qhat_qhat(self):
"""
r"""
Computes the (3x3) matrix (1 - qhat \otimes qhat) for each q-point
The result is a 3D array of shape (n_q, 3, 3)
"""
Expand Down
Loading

0 comments on commit 4ec3187

Please sign in to comment.