Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add frame_conventions to AnisotropicSolution #587

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions burnman/classes/anisotropicmineral.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,14 @@ def deformed_coordinate_frame(self):
if self.orthotropic:
return np.eye(3)
else:
c = self.frame_convention
M_T = self.unrotated_cell_vectors
Q = np.empty((3, 3))
Q[0] = M_T[0] / np.linalg.norm(M_T[0])
Q[2] = np.cross(M_T[0], M_T[1]) / np.linalg.norm(np.cross(M_T[0], M_T[1]))
Q[1] = np.cross(Q[2], Q[0])
Q[c[0]] = M_T[c[0]] / np.linalg.norm(M_T[c[0]])
Q[c[2]] = np.cross(M_T[c[0]], M_T[c[1]]) / np.linalg.norm(
np.cross(M_T[c[0]], M_T[c[1]])
)
Q[c[1]] = np.cross(Q[c[2]], Q[c[0]])
return Q

@material_property
Expand All @@ -402,9 +405,10 @@ def cell_vectors(self):
if self.orthotropic:
return self.unrotated_cell_vectors
else:
return np.einsum(
vectors = np.einsum(
"ij, jk->ik", self.unrotated_cell_vectors, self.rotation_matrix
)
return vectors

@material_property
def cell_parameters(self):
Expand Down
2 changes: 1 addition & 1 deletion burnman/classes/anisotropicsolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __init__(
self._logm_M0_mbr = np.einsum(
"kij->ijk", np.array([logm(m[0].cell_vectors_0.T) for m in self.endmembers])
)

self.frame_convention = self.endmembers[0][0].frame_convention
self.anisotropic_params = anisotropic_parameters
self.psi_excess_function = psi_excess_function

Expand Down
6 changes: 3 additions & 3 deletions burnman/utils/unitcell.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ def cell_vectors_to_parameters(vectors, frame_convention):
"""

c = frame_convention
assert vectors[c[0], c[1]] == 0
assert vectors[c[0], c[2]] == 0
assert vectors[c[1], c[2]] == 0
assert np.abs(vectors[c[0], c[1]]) < np.finfo(float).eps
assert np.abs(vectors[c[0], c[2]]) < np.finfo(float).eps
assert np.abs(vectors[c[1], c[2]]) < np.finfo(float).eps

lengths = np.empty(3)
angles = np.empty(3)
Expand Down
Loading