Skip to content

Commit

Permalink
add frame_conventions to AnisotropicSolution
Browse files Browse the repository at this point in the history
  • Loading branch information
bobmyhill committed Mar 27, 2024
1 parent dbaa4c0 commit 6ce3284
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
10 changes: 6 additions & 4 deletions burnman/classes/anisotropicmineral.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,12 @@ 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 +403,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

0 comments on commit 6ce3284

Please sign in to comment.