# Property-tensor forms (crystod-group --tensor); testsuite section 13
# Neumann's principle: the symmetry-allowed form of a property tensor in the
# point group of --pg PG, of --sg SG (default setting) or of -c POSCAR (spglib's
# standard conventional cell; the tensor axes are printed in the Cartesian frame
# of the input file).
# KIND: dielectric [V2], pyroelectric V, piezoelectric V[V2] (Nye's d_iL, factor 2
# for L = 4-6), elastic [[V2]2] (stiffness c_LM), compliance [[V2]2] (Nye's s_LM,
# factors 2 and 4), gyration e[V2] (axial), raman (Raman tensor of every
# Raman-active irrep), or any Jahn symbol (e = axial, a = time-reversal odd;
# quote brackets in the shell).
# Axes: x, y, z || a, b, c for orthogonal lattices; x || a, z || c for trigonal
# and hexagonal groups; y || b (unique axis), z || c for monoclinic groups.
# Independent components: the reduced row-echelon pivots, normal components
# before shear components, longitudinal ones (all indices equal) first among
# them, then in the order 11, 22, 33, 23, 13, 12.
# A time-odd tensor vanishes in every non-magnetic point group (time reversal
# is a symmetry of the grey group G1').

$ crystod-group --tensor piezoelectric --pg 4mm

* Point group *
  4mm (C4v), order 8, tetragonal, Laue class 4/mmm, non-centrosymmetric, polar
  source: point group 4mm
  axes: x || a, y || b, z || c
  4 || [001] (z)
  m perpendicular to [100] (x), [010] (y), [110], [1-10]

* Tensor *
  kind: piezoelectric strain coefficients d_ijk, P_i = d_ijk sigma_jk
  Jahn symbol: V[V2] (polar, time-reversal even)
  rank: 3
  intrinsic symmetry: symmetric in (jk)
  matrix notation (Nye): d_iL, L = 1..6 for jk = 11, 22, 33, 23, 13, 12; d_iL = d_ijk for L = 1-3 and 2 d_ijk for L = 4-6

* Independent components *
  3: d15, d31, d33

* Matrix form *
d  1    2    3    4    5    6
1  0    0    0    0    d15  0
2  0    0    0    d15  0    0
3  d31  d31  d33  0    0    0

* Relations *
  d24 = d15
  d32 = d31
  every other component is zero

$ crystod-group --tensor elastic --pg 6/mmm

* Point group *
  6/mmm (D6h), order 24, hexagonal, Laue class 6/mmm, centrosymmetric
  source: point group 6/mmm
  axes: x || a, z || c, y = z x x
  6 || [001] (z)
  2 || [100] (x), [120] (y), [010], [110], [1-10], [210]
  m perpendicular to [100] (x), [120] (y), [001] (z), [010], [110], [1-10], [210]
  -1 (inversion)

* Tensor *
  kind: elastic stiffness c_ijkl, sigma_ij = c_ijkl e_kl
  Jahn symbol: [[V2]2] (polar, time-reversal even)
  rank: 4
  intrinsic symmetry: symmetric in (ij); symmetric in (kl); symmetric under the exchange of the index groups (ij), (kl)
  matrix notation: L = 1..6 for the index pairs 11, 22, 33, 23, 13, 12 (tensor components, no factors)

* Independent components *
  5: c11, c12, c13, c33, c44

* Matrix form *
c  1    2    3    4    5    6
1  c11  c12  c13  0    0    0
2  c12  c11  c13  0    0    0
3  c13  c13  c33  0    0    0
4  0    0    0    c44  0    0
5  0    0    0    0    c44  0
6  0    0    0    0    0    (c11-c12)/2

* Relations *
  c22 = c11
  c23 = c13
  c55 = c44
  c66 = (c11-c12)/2
  every other component is zero

$ crystod-group --tensor compliance --pg 6/mmm

* Point group *
  6/mmm (D6h), order 24, hexagonal, Laue class 6/mmm, centrosymmetric
  source: point group 6/mmm
  axes: x || a, z || c, y = z x x
  6 || [001] (z)
  2 || [100] (x), [120] (y), [010], [110], [1-10], [210]
  m perpendicular to [100] (x), [120] (y), [001] (z), [010], [110], [1-10], [210]
  -1 (inversion)

* Tensor *
  kind: elastic compliance s_ijkl, e_ij = s_ijkl sigma_kl
  Jahn symbol: [[V2]2] (polar, time-reversal even)
  rank: 4
  intrinsic symmetry: symmetric in (ij); symmetric in (kl); symmetric under the exchange of the index groups (ij), (kl)
  matrix notation (Nye): s_LM, L, M = 1..6 for ij, kl = 11, 22, 33, 23, 13, 12; s_LM = s_ijkl, 2 s_ijkl or 4 s_ijkl when none, one or both of L, M are 4-6

* Independent components *
  5: s11, s12, s13, s33, s44

* Matrix form *
s  1    2    3    4    5    6
1  s11  s12  s13  0    0    0
2  s12  s11  s13  0    0    0
3  s13  s13  s33  0    0    0
4  0    0    0    s44  0    0
5  0    0    0    0    s44  0
6  0    0    0    0    0    2(s11-s12)

* Relations *
  s22 = s11
  s23 = s13
  s55 = s44
  s66 = 2(s11-s12)
  every other component is zero

$ crystod-group --tensor piezoelectric --pg 32

* Point group *
  32 (D3), order 6, trigonal, Laue class -3m, non-centrosymmetric, chiral
  source: point group 32
  axes: x || a, z || c (hexagonal axes), y = z x x
  3 || [001] (z)
  2 || [100] (x), [010], [110]

* Tensor *
  kind: piezoelectric strain coefficients d_ijk, P_i = d_ijk sigma_jk
  Jahn symbol: V[V2] (polar, time-reversal even)
  rank: 3
  intrinsic symmetry: symmetric in (jk)
  matrix notation (Nye): d_iL, L = 1..6 for jk = 11, 22, 33, 23, 13, 12; d_iL = d_ijk for L = 1-3 and 2 d_ijk for L = 4-6

* Independent components *
  2: d11, d14

* Matrix form *
d  1    2     3  4    5     6
1  d11  -d11  0  d14  0     0
2  0    0     0  0    -d14  -2d11
3  0    0     0  0    0     0

* Relations *
  d12 = -d11
  d25 = -d14
  d26 = -2d11
  every other component is zero

$ crystod-group --tensor piezoelectric -c ../test_POSCARs/186_PPOSCAR_ZnO

* Point group *
  6mm (C6v), point group of P6_3mc (No. 186), order 12, hexagonal, Laue class 6/mmm, non-centrosymmetric, polar
  source: structure ../test_POSCARs/186_PPOSCAR_ZnO (symprec 1e-05)
  axes: x || a, z || c, y = z x x of the standard conventional cell
  tensor axes in the Cartesian frame of the input file: x = (1.0000, 0.0000, 0.0000), y = (0.0000, 1.0000, 0.0000), z = (0.0000, 0.0000, 1.0000)
  6 || [001] (z)
  m perpendicular to [100] (x), [120] (y), [010], [110], [1-10], [210]

* Tensor *
  kind: piezoelectric strain coefficients d_ijk, P_i = d_ijk sigma_jk
  Jahn symbol: V[V2] (polar, time-reversal even)
  rank: 3
  intrinsic symmetry: symmetric in (jk)
  matrix notation (Nye): d_iL, L = 1..6 for jk = 11, 22, 33, 23, 13, 12; d_iL = d_ijk for L = 1-3 and 2 d_ijk for L = 4-6

* Independent components *
  3: d15, d31, d33

* Matrix form *
d  1    2    3    4    5    6
1  0    0    0    0    d15  0
2  0    0    0    d15  0    0
3  d31  d31  d33  0    0    0

* Relations *
  d24 = d15
  d32 = d31
  every other component is zero

$ crystod-group --tensor "e[V2]" --sg P4_32_12

* Point group *
  422 (D4), point group of P4_32_12 (No. 96), order 8, tetragonal, Laue class 4/mmm, non-centrosymmetric, chiral
  source: space group P4_32_12 (No. 96)
  axes: x || a, y || b, z || c of the conventional cell
  4 || [001] (z)
  2 || [100] (x), [010] (y), [110], [1-10]

* Tensor *
  kind: tensor given by its Jahn symbol (the symmetry type of: gyration)
  Jahn symbol: e[V2] (axial, time-reversal even)
  rank: 2
  intrinsic symmetry: symmetric in (ij)

* Independent components *
  2: T11, T33

* Matrix form *
T  1    2    3
1  T11  0    0
2  0    T11  0
3  0    0    T33

* Relations *
  T22 = T11
  every other component is zero

$ crystod-group --tensor raman --pg m-3m

* Point group *
  m-3m (Oh), order 48, cubic, Laue class m-3m, centrosymmetric
  source: point group m-3m
  axes: x || a, y || b, z || c
  4 || [100] (x), [010] (y), [001] (z)
  -3 || [111], [11-1], [1-11], [1-1-1]
  2 || [110], [101], [10-1], [1-10], [011], [01-1]
  m perpendicular to [100] (x), [010] (y), [001] (z), [110], [101], [10-1], [1-10], [011], [01-1]
  -1 (inversion)

* Tensor *
  kind: Raman tensors: symmetric second-rank polarizability derivatives, one set per Raman-active irrep
  Jahn symbol: [V2] (polar, time-reversal even)
  rank: 2
  intrinsic symmetry: symmetric in (ij)

* Raman tensors *
  Cartesian axes of the point group above; every Raman-active irrep, Mulliken labels of the phonopy character table
  A1g (1 tensor):  [[a, 0, 0], [0, a, 0], [0, 0, a]]
  Eg (2 tensors):  [[a, 0, 0], [0, a, 0], [0, 0, -2*a]]   [[a, 0, 0], [0, -a, 0], [0, 0, 0]]
  T2g (3 tensors):  [[0, 0, 0], [0, 0, a], [0, a, 0]]   [[0, 0, a], [0, 0, 0], [a, 0, 0]]   [[0, a, 0], [a, 0, 0], [0, 0, 0]]

$ crystod-group --tensor raman -c ../test_POSCARs/186_PPOSCAR_ZnO

* Point group *
  6mm (C6v), point group of P6_3mc (No. 186), order 12, hexagonal, Laue class 6/mmm, non-centrosymmetric, polar
  source: structure ../test_POSCARs/186_PPOSCAR_ZnO (symprec 1e-05)
  axes: x || a, z || c, y = z x x of the standard conventional cell
  tensor axes in the Cartesian frame of the input file: x = (1.0000, 0.0000, 0.0000), y = (0.0000, 1.0000, 0.0000), z = (0.0000, 0.0000, 1.0000)
  6 || [001] (z)
  m perpendicular to [100] (x), [120] (y), [010], [110], [1-10], [210]

* Tensor *
  kind: Raman tensors: symmetric second-rank polarizability derivatives, one set per Raman-active irrep
  Jahn symbol: [V2] (polar, time-reversal even)
  rank: 2
  intrinsic symmetry: symmetric in (ij)

* Raman tensors *
  Cartesian axes of the input cell (not the standard axes above); the Gamma phonon irreps of the structure, ISO-IR [Mulliken]
  GM1 [A1] (2 tensors):  [[a, 0, 0], [0, a, 0], [0, 0, 0]]   [[0, 0, 0], [0, 0, 0], [0, 0, a]]
  GM5 [E2] (2 tensors):  [[a, 0, 0], [0, -a, 0], [0, 0, 0]]   [[0, a, 0], [a, 0, 0], [0, 0, 0]]
  GM6 [E1] (2 tensors):  [[0, 0, 0], [0, 0, a], [0, a, 0]]   [[0, 0, a], [0, 0, 0], [a, 0, 0]]

$ crystod-group --tensor "a[V2]" --pg 4mm

* Point group *
  4mm (C4v), order 8, tetragonal, Laue class 4/mmm, non-centrosymmetric, polar
  source: point group 4mm
  axes: x || a, y || b, z || c
  4 || [001] (z)
  m perpendicular to [100] (x), [010] (y), [110], [1-10]

* Tensor *
  kind: tensor given by its Jahn symbol
  Jahn symbol: a[V2] (polar, time-reversal odd)
  rank: 2
  intrinsic symmetry: symmetric in (ij)

* Independent components *
  0

* Matrix form *
T  1  2  3
1  0  0  0
2  0  0  0
3  0  0  0

* Relations *
  time-reversal odd: forbidden in the non-magnetic point group 4mm1' (time reversal is a symmetry); this mode takes non-magnetic point groups only
