Skip to content

Commit 39664ce

Browse files
committed
Merge branch '422-orientation-relationship-lattice-parameters' into 'development'
use target to initialize rotated orientations. Closes #422 See merge request damask/DAMASK!955
2 parents 747ada2 + 45ffac3 commit 39664ce

8 files changed

+41
-15
lines changed

python/damask/_orientation.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -957,11 +957,12 @@ def related(self: MyType,
957957
"""
958958
lattice,o = self.relation_operations(model,target)
959959
target = Crystal(lattice=lattice) if target is None else target
960-
return Orientation(rotation=o*Rotation(self.quaternion)[np.newaxis,...], # type: ignore
961-
lattice=lattice,
962-
b = self.b if target.ratio['b'] is None else self.a*target.ratio['b'],
963-
c = self.c if target.ratio['c'] is None else self.a*target.ratio['c'],
964-
alpha = None if 'alpha' in target.immutable else self.alpha,
965-
beta = None if 'beta' in target.immutable else self.beta,
966-
gamma = None if 'gamma' in target.immutable else self.gamma,
967-
)
960+
return Orientation(rotation=o*Rotation(self.quaternion)[np.newaxis,...], # type: ignore
961+
lattice=target.lattice,
962+
a=target.a,
963+
b=target.b,
964+
c=target.c,
965+
alpha=target.alpha,
966+
beta =target.beta,
967+
gamma=target.gamma,
968+
)
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
1_Eulers 2_Eulers 3_Eulers 1_pos 2_pos
2+
180.0 44.999999999999986 234.73561031724537 1 1
3+
180.0 44.999999999999986 125.26438968275463 1 2
4+
180.0 135.00000000000003 125.26438968275463 1 3
5+
180.0 135.0 54.73561031724537 1 4
6+
89.99999999999999 45.00000000000003 305.26438968275465 1 5
7+
90.0 45.00000000000003 234.73561031724537 1 6
8+
90.00000000000001 135.00000000000003 54.73561031724535 1 7
9+
90.00000000000001 135.0 125.26438968275463 1 8
10+
135.00000000000003 90.0 144.73561031724535 1 9
11+
135.0 90.0 215.26438968275463 1 10
12+
45.000000000000014 90.00000000000001 35.264389682754654 1 11
13+
45.0 90.0 324.73561031724535 1 12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
1_Eulers 2_Eulers 3_Eulers 1_pos 2_pos
2+
305.26438968275465 44.999999999999986 0.0 1 1
3+
234.73561031724537 45.00000000000003 0.0 1 2
4+
65.26438968275461 45.00000000000001 0.0 1 3
5+
354.73561031724535 45.00000000000001 0.0 1 4
6+
185.26438968275463 45.00000000000001 0.0 1 5
7+
114.73561031724537 45.00000000000001 0.0 1 6

python/tests/test_Orientation.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,12 @@ def test_invalid_argument(self,function):
306306
with pytest.raises(ValueError):
307307
eval(f'o.{function}(np.ones(4))')
308308

309-
@pytest.mark.parametrize('model',['Bain','KS','GT','GT_prime','NW','Pitsch'])
310-
@pytest.mark.parametrize('lattice',['cF','cI'])
309+
@pytest.mark.parametrize('model',['Bain','KS','GT','GT_prime','NW','Pitsch','Burgers'])
310+
@pytest.mark.parametrize('lattice',['cF','cI']) # will be adjusted for Burgers
311311
def test_relationship_reference(self,update,res_path,model,lattice):
312-
reference = res_path/f'{lattice}_{model}.txt'
313-
o = Orientation(lattice=lattice)
312+
lattice_ = 'hP' if lattice=='cF' and model=='Burgers' else lattice
313+
reference = res_path/f'{lattice_}_{model}.txt'
314+
o = Orientation(lattice=lattice_)
314315
eu = o.related(model).as_Euler_angles(degrees=True)
315316
if update:
316317
coords = np.array([(1,i+1) for i,x in enumerate(eu)])
@@ -510,11 +511,14 @@ def test_mul_invalid(self):
510511
with pytest.raises(TypeError):
511512
Orientation.from_random(lattice='cF')*np.ones(3)
512513

513-
@pytest.mark.parametrize('OR',['KS','NW','GT','GT_prime','Bain','Pitsch'])
514+
@pytest.mark.parametrize('OR',['KS','NW','GT','GT_prime','Bain','Pitsch','Burgers'])
514515
@pytest.mark.parametrize('pole',[[0,0,1],[0,1,1],[1,1,1]])
515516
def test_OR_plot(self,update,res_path,tmp_path,OR,pole):
516-
# https://doi.org/10.3390/cryst13040663 for comparison
517-
O = Orientation(lattice='cF')
517+
# comparison
518+
# https://doi.org/10.3390/cryst13040663 (except Burgers)
519+
# https://doi.org/10.1016/j.actamat.2003.12.029 (Burgers)
520+
O = Orientation(lattice=('hP' if OR=='Burgers' else 'cF'),
521+
a=2.856e-10,c=(2.8e-10*np.sqrt(8./3.) if OR=='Burgers' else None))
518522
poles = O.related(OR).to_frame(uvw=pole,with_symmetry=True).reshape(-1,3)
519523
points = util.project_equal_area(poles,'z')
520524

python/tests/test_Rotation.py

+1
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,7 @@ def test_rotate_power(self,pwr):
10551055

10561056
def test_rotate_inverse(self):
10571057
R = Rotation.from_random()
1058+
assert (~R).allclose(R**-1)
10581059
assert np.allclose(np.eye(3),(~R*R).as_matrix())
10591060

10601061
@pytest.mark.parametrize('data',[np.random.rand(3),

0 commit comments

Comments
 (0)