# Displacement pattern of every isotropy subgroup on a crystal
# (crystod-phonon -c POSCAR --element EL --irrep IR [IR2 ...], no mode flag, no
# force data); testsuite section 04-01
#
# The table of crystod-group --parent SG --irrep IR (several irreps: the coupled
# table) placed on the O atoms of La3Ni2O7 (I4/mmm; PPOSCAR_La3Ni2O7_I4mmm is
# the primitive cell 139_PPOSCAR_La3Ni2O7 of the example 05-02_spin_basis,
# sub-directory La3Ni2O7_I4mmm, under another name): for every
# row, the displacement modes that transform with the matrices of the table,
# times the row's order parameter, give a displacement pattern in the supercell
# common to every arm (2x2x2 for X). The space group of every displaced
# structure, as written, is identified again with spglib (column "structure"
# and the "check (on the displaced structure as written):" line of every
# block). X3- occurs three times in the O displacements (one copy per Wyckoff
# orbit, O(8g), O(4e), O(2a)): one pattern per row and copy. These are
# symmetry-adapted displacement patterns, not eigenvectors of a dynamical
# matrix: a real distortion of a row's symmetry combines the copies with
# amplitudes that only a force calculation fixes. The letters take generic values; the
# "reproduce:" line gives the --order-parameter numbers that rebuild a block.
#
# Files of a run (not kept here): per row and copy a VESTA file of the
# undistorted supercell with arrows (POSCAR_La3Ni2O7_disp_X3-_01_63_Cmcm_c1.vesta)
# and the displaced structure with the largest displacement --amplitude
# (default 0.1 A; MPPOSCAR_La3Ni2O7_I4mmm_X3-_01_63_Cmcm_c1), the undistorted
# supercell SPPOSCAR_La3Ni2O7_I4mmm_X3- and the report saad_La3Ni2O7_O_X3-
# (--qpoint X: saad_La3Ni2O7_O_X). --conventional writes everything in the
# conventional cell (names with _conv).
#
# Without --irrep and --qpoint the command lists first which irreps there are:
# the decomposition of the O displacements (polar vectors) at every special k
# point, as crystod-mag -c POSCAR --element O does for spins and equal (as a
# multiset) to crystod -c PPOSCAR_La3Ni2O7_I4mmm --element O --orbital p (where
# a structure has complex-conjugate pairs, the survey keeps each pair as one
# term, A1A3(2), as the --qpoint header does); report saad_La3Ni2O7_O_survey, no
# structures.
#
# Below: the survey in full, then the beginning of each other output, up to
# the end of its first block.

$ crystod-phonon -c PPOSCAR_La3Ni2O7_I4mmm --element O

* Structure *
  Space group: I4/mmm (#139)
  Displaced atoms: O x 7
    O1: [0.903166, 0.403166, 0.5]
    O2: [0.096834, 0.596834, 0.5]
    O3: [0.403166, 0.903166, 0.5]
    O4: [0.596834, 0.096834, 0.5]
    O5: [0.796696, 0.796696, 0.0]
    O6: [0.203304, 0.203304, 0.0]
    O7: [0.0, 0.0, 0.0]

* Displacement (polar-vector) Irreducible Representations of O sites *
  k point (primitive): GM [0.0, 0.0, 0.0]
    2.0 [GM1+(1)] + 3.0 [GM3-(1)] + 3.0 [GM5+(2)] + 4.0 [GM5-(2)] + 1.0 [GM2+(1)] + 1.0 [GM4-(1)]
  k point (primitive): X [0.0, 0.0, 0.5]
    3.0 [X1+(1)] + 2.0 [X1-(1)] + 2.0 [X3+(1)] + 3.0 [X3-(1)] + 2.0 [X4+(1)] + 3.0 [X4-(1)] + 2.0 [X2+(1)] + 4.0 [X2-(1)]
  k point (primitive): M [0.5, 0.5, 0.5]
    2.0 [M1+(1)] + 3.0 [M3-(1)] + 3.0 [M5+(2)] + 4.0 [M5-(2)] + 1.0 [M2+(1)] + 1.0 [M4-(1)]
  k point (primitive): N [0.0, 0.5, 0.0]
    6.0 [N1+(1)] + 4.0 [N1-(1)] + 3.0 [N2+(1)] + 8.0 [N2-(1)]
  k point (primitive): P [0.25, 0.25, 0.25]
    3.0 [P1(1)] + 2.0 [P4(1)] + 5.0 [P5(2)] + 2.0 [P2(1)] + 4.0 [P3(1)]

Use --qpoint K for the displacement patterns of every irrep at one k point, --irrep IR [IR2 ...] for those of given irreps (VESTA files with arrows and displaced POSCARs).

* Output files *
  Report written to: saad_La3Ni2O7_O_survey (this output)

$ crystod-phonon -c PPOSCAR_La3Ni2O7_I4mmm --element O --irrep X3-

* Structure *
  Space group: I4/mmm (#139)
  Displaced atoms: O x 7
    O1: [0.903166, 0.403166, 0.5]
    O2: [0.096834, 0.596834, 0.5]
    O3: [0.403166, 0.903166, 0.5]
    O4: [0.596834, 0.096834, 0.5]
    O5: [0.796696, 0.796696, 0.0]
    O6: [0.203304, 0.203304, 0.0]
    O7: [0.0, 0.0, 0.0]

* Displacement (polar-vector) representation of O atoms at the k points of the irreps *
  k point (primitive): X [0.0, 0.0, 0.5]
    3.0 [X1+(1)] + 2.0 [X1-(1)] + 2.0 [X3+(1)] + 3.0 [X3-(1)] + 2.0 [X4+(1)] + 3.0 [X4-(1)] + 2.0 [X2+(1)] + 4.0 [X2-(1)]

* Irrep *
X3-: order parameter dimension 2 (star of 2 arm(s) x small dim 1)

* Copies in the displacement representation *
  X3-: 3 copies: c1 = O(8g), c2 = O(4e), c3 = O(2a)
  X3- c1: components 1, 2 = displacements along z, z
  one pattern per choice of copies; any mixture of the copies of an irrep with
  the same order parameter has the same space group
  These are symmetry-adapted displacement patterns, not eigenvectors of a
  dynamical matrix: a real distortion of a row's symmetry combines the copies of
  its irreps with amplitudes that only a force calculation fixes.

* Supercell *
  Commensurate supercell: 2x2x2 (8 primitive cells, 96 atoms), common to every arm of X3-
  displacement modes: |O(g) Psi - Psi D(g)| <= 1.9e-16 over the elements of G/T_S, Psi^T Psi = c 1 within 5.4e-17
  amplitude: largest displacement 0.1 A in every displaced structure (--amplitude); VESTA arrows scaled to a largest length of 1.5 A

* Order parameter directions and isotropy subgroups *
No.  irrep                subgroup           size  index structure
1    X3-(0;a)             63 Cmcm            2     4     63 Cmcm same (x3)
2    X3-(a;a)             136 P4_2/mnm       4     4     136 P4_2/mnm same (x3)
3    X3-(a;b)             58 Pnnm            4     8     58 Pnnm same (x3)

The components of a direction refer to the irrep basis of the table (as with
crystod-group --parent), not to the axes of the POSCAR; the displacement
listings give the Cartesian displacements.

structure = the space group spglib finds on the displaced structure exported for
the row (supercell as written, all atoms, tolerance 1e-05 A),
compared with the table (number, size, index): same, enantiomorph (the partner
type), different; (xN) for N choices of copies.

* 1 c1: X3-(0;a) -> 63 Cmcm *
  copies: X3- c1 = O(8g)
  order parameter: a = 1
  reproduce: --order-parameter "0 1" --copies 1
  displacements: |u| = 0.1000 on 32 of 56 O atoms; zero on 24 atoms (no displacement in X3-)
  space group (displaced structure): 63 Cmcm, point group mmm, size 2, index 4
  check (on the displaced structure as written): table 63 Cmcm (size 2, index 4), structure 63 Cmcm same; 32 elements of G/T_S fix the displacements, 32 the order parameter
  allowed by symmetry: no electric polarization (non-polar point group mmm); inversion kept
  displacements in Angstrom (Cartesian, POSCAR axes; atoms numbered as in the supercell POSCAR) ([2, 2, 2] supercell): 32 O atoms move, 24 stay
    O41: [0.0000, 0.0000, -0.1000]
    O42: [0.0000, 0.0000, -0.1000]
    O43: [0.0000, 0.0000, 0.1000]
    O44: [0.0000, 0.0000, 0.1000]
    O45: [0.0000, 0.0000, 0.1000]
    O46: [0.0000, 0.0000, 0.1000]
    O47: [0.0000, 0.0000, -0.1000]
    O48: [0.0000, 0.0000, -0.1000]
    O49: [0.0000, 0.0000, -0.1000]
    O50: [0.0000, 0.0000, -0.1000]
    O51: [0.0000, 0.0000, 0.1000]
    O52: [0.0000, 0.0000, 0.1000]
    O53: [0.0000, 0.0000, 0.1000]
    O54: [0.0000, 0.0000, 0.1000]
    O55: [0.0000, 0.0000, -0.1000]
    O56: [0.0000, 0.0000, -0.1000]
    O57: [0.0000, 0.0000, -0.1000]
    O58: [0.0000, 0.0000, -0.1000]
    O59: [0.0000, 0.0000, 0.1000]
    O60: [0.0000, 0.0000, 0.1000]
    O61: [0.0000, 0.0000, 0.1000]
    O62: [0.0000, 0.0000, 0.1000]
    O63: [0.0000, 0.0000, -0.1000]
    O64: [0.0000, 0.0000, -0.1000]
    O65: [0.0000, 0.0000, -0.1000]
    O66: [0.0000, 0.0000, -0.1000]
    O67: [0.0000, 0.0000, 0.1000]
    O68: [0.0000, 0.0000, 0.1000]
    O69: [0.0000, 0.0000, 0.1000]
    O70: [0.0000, 0.0000, 0.1000]
    O71: [0.0000, 0.0000, -0.1000]
    O72: [0.0000, 0.0000, -0.1000]

...

$ crystod-phonon -c PPOSCAR_La3Ni2O7_I4mmm --element O --irrep X3- X2+

* Structure *
  Space group: I4/mmm (#139)
  Displaced atoms: O x 7
    O1: [0.903166, 0.403166, 0.5]
    O2: [0.096834, 0.596834, 0.5]
    O3: [0.403166, 0.903166, 0.5]
    O4: [0.596834, 0.096834, 0.5]
    O5: [0.796696, 0.796696, 0.0]
    O6: [0.203304, 0.203304, 0.0]
    O7: [0.0, 0.0, 0.0]

* Displacement (polar-vector) representation of O atoms at the k points of the irreps *
  k point (primitive): X [0.0, 0.0, 0.5]
    3.0 [X1+(1)] + 2.0 [X1-(1)] + 2.0 [X3+(1)] + 3.0 [X3-(1)] + 2.0 [X4+(1)] + 3.0 [X4-(1)] + 2.0 [X2+(1)] + 4.0 [X2-(1)]

* Coupled irreps *
X3-: order parameter dimension 2 (star of 2 arm(s) x small dim 1)
X2+: order parameter dimension 2 (star of 2 arm(s) x small dim 1)
coupled order parameter dimension 4 (2 + 2)

* Copies in the displacement representation *
  X3-: 3 copies: c1 = O(8g), c2 = O(4e), c3 = O(2a)
  X2+: 2 copies: c1 = O(8g), c2 = O(8g)
  X3- c1: components 1, 2 = displacements along z, z
  one pattern per choice of copies; any mixture of the copies of an irrep with
  the same order parameter has the same space group
  These are symmetry-adapted displacement patterns, not eigenvectors of a
  dynamical matrix: a real distortion of a row's symmetry combines the copies of
  its irreps with amplitudes that only a force calculation fixes.

* Supercell *
  Commensurate supercell: 2x2x2 (8 primitive cells, 96 atoms), common to every arm of X3-, X2+
  displacement modes: |O(g) Psi - Psi D(g)| <= 5.7e-15 over the elements of G/T_S, Psi^T Psi = c 1 within 5.6e-16
  amplitude: largest displacement 0.1 A in every displaced structure (--amplitude); VESTA arrows scaled to a largest length of 1.5 A

* Order parameter directions and isotropy subgroups (X3- alone) *
irrep                subgroup           size  index
X3-(0;a)             63 Cmcm            2     4    
X3-(a;a)             136 P4_2/mnm       4     4    
X3-(a;b)             58 Pnnm            4     8    

* Order parameter directions and isotropy subgroups (X2+ alone) *
irrep                subgroup           size  index
X2+(0;c)             64 Cmce            2     4    
X2+(c;c)             127 P4/mbm         4     4    
X2+(c;d)             55 Pbam            4     8    

* Order parameter directions and isotropy subgroups (coupled) *
No.  irrep                subgroup           size  index structure
1    X3-(0;a) X2+(0;c)    36 Cmc2_1          2     8     36 Cmc2_1 same (x6)
2    X3-(0;a) X2+(c;0)    62 Pnma            4     8     62 Pnma same (x6)
3    X3-(a;a) X2+(c;c)    38 Amm2            4     16    38 Amm2 same (x6)
4    X3-(0;a) X2+(c;d)    26 Pmc2_1          4     16    26 Pmc2_1 same (x6)
5    X3-(a;b) X2+(0;c)    31 Pmn2_1          4     16    31 Pmn2_1 same (x6)
6    X3-(a;b) X2+(c;d)    6 Pm               4     32    6 Pm same (x6)

Every irrep of the coupled table condenses with a nonzero
amplitude; every irrep keeps its own independent free
parameters (X3-: a, b; X2+: c, d).

The components of a direction refer to the irrep basis of the table (as with
crystod-group --parent), not to the axes of the POSCAR; the displacement
listings give the Cartesian displacements.

structure = the space group spglib finds on the displaced structure exported for
the row (supercell as written, all atoms, tolerance 1e-05 A),
compared with the table (number, size, index): same, enantiomorph (the partner
type), different; (xN) for N choices of copies.

Displacement patterns are exported for the coupled rows; crystod-phonon --irrep X3- alone exports those of one irrep.

* 1 c1-1: X3-(0;a) X2+(0;c) -> 36 Cmc2_1 *
  copies: X3- c1 = O(8g); X2+ c1 = O(8g)
  order parameter: X3-: a = 1; X2+: c = 1
  parts: X3- : X2+ = 1 : 1 (each part scaled to largest displacement 1, then weighted)
  the relative amplitudes are not fixed by symmetry: other nonzero values that
  keep the pattern of the label (no new zero or equal components) give the
  same group
  reproduce: --order-parameter "0 0.707107 0 0.707107" --copies 1 1
  displacements: |u| = 0.1000 on 32 of 56 O atoms; zero on 24 atoms (no displacement in X3-, X2+)
  space group (displaced structure): 36 Cmc2_1, point group mm2, size 2, index 8
  check (on the displaced structure as written): table 36 Cmc2_1 (size 2, index 8), structure 36 Cmc2_1 same; 16 elements of G/T_S fix the displacements, 16 the order parameter
  allowed by symmetry: electric polarization along [1, -1, 0] (Cartesian, POSCAR axes; polar point group mm2); inversion broken
  displacements in Angstrom (Cartesian, POSCAR axes; atoms numbered as in the supercell POSCAR) ([2, 2, 2] supercell): 32 O atoms move, 24 stay
    O41: [-0.0707, 0.0027, -0.0707]
    O42: [-0.0707, 0.0027, -0.0707]
    O43: [0.0707, -0.0027, 0.0707]
    O44: [0.0707, -0.0027, 0.0707]
    O45: [0.0707, -0.0027, 0.0707]
    O46: [0.0707, -0.0027, 0.0707]
    O47: [-0.0707, 0.0027, -0.0707]
    O48: [-0.0707, 0.0027, -0.0707]
    O49: [0.0707, -0.0027, -0.0707]
    O50: [0.0707, -0.0027, -0.0707]
    O51: [-0.0707, 0.0027, 0.0707]
    O52: [-0.0707, 0.0027, 0.0707]
    O53: [-0.0707, 0.0027, 0.0707]
    O54: [-0.0707, 0.0027, 0.0707]
    O55: [0.0707, -0.0027, -0.0707]
    O56: [0.0707, -0.0027, -0.0707]
    O57: [-0.0027, 0.0707, -0.0707]
    O58: [-0.0027, 0.0707, -0.0707]
    O59: [0.0027, -0.0707, 0.0707]
    O60: [0.0027, -0.0707, 0.0707]
    O61: [0.0027, -0.0707, 0.0707]
    O62: [0.0027, -0.0707, 0.0707]
    O63: [-0.0027, 0.0707, -0.0707]
    O64: [-0.0027, 0.0707, -0.0707]
    O65: [0.0027, -0.0707, -0.0707]
    O66: [0.0027, -0.0707, -0.0707]
    O67: [-0.0027, 0.0707, 0.0707]
    O68: [-0.0027, 0.0707, 0.0707]
    O69: [-0.0027, 0.0707, 0.0707]
    O70: [-0.0027, 0.0707, 0.0707]
    O71: [0.0027, -0.0707, -0.0707]
    O72: [0.0027, -0.0707, -0.0707]

...

$ crystod-phonon -c PPOSCAR_La3Ni2O7_I4mmm --element O --qpoint X

* Structure *
  Space group: I4/mmm (#139)
  Displaced atoms: O x 7
    O1: [0.903166, 0.403166, 0.5]
    O2: [0.096834, 0.596834, 0.5]
    O3: [0.403166, 0.903166, 0.5]
    O4: [0.596834, 0.096834, 0.5]
    O5: [0.796696, 0.796696, 0.0]
    O6: [0.203304, 0.203304, 0.0]
    O7: [0.0, 0.0, 0.0]

* Selected Q point *
  --qpoint X: X (0, 0, 1/2) (primitive reciprocal basis of the POSCAR)

* Displacement (polar-vector) representation of O atoms at X *
    3.0 [X1+(1)] + 2.0 [X1-(1)] + 2.0 [X3+(1)] + 3.0 [X3-(1)] + 2.0 [X4+(1)] + 3.0 [X4-(1)] + 2.0 [X2+(1)] + 4.0 [X2-(1)]
  irreps treated (each with its whole table): X1+, X2+, X3+, X4+, X1-, X2-, X3-, X4-

* Irrep X1+ (1 of 8) *

* Irrep *
X1+: order parameter dimension 2 (star of 2 arm(s) x small dim 1)

* Copies in the displacement representation *
  X1+: 3 copies: c1 = O(8g), c2 = O(8g), c3 = O(4e)
  X1+ c3: components 1, 2 = displacements along z, z
  one pattern per choice of copies; any mixture of the copies of an irrep with
  the same order parameter has the same space group
  These are symmetry-adapted displacement patterns, not eigenvectors of a
  dynamical matrix: a real distortion of a row's symmetry combines the copies of
  its irreps with amplitudes that only a force calculation fixes.

* Supercell *
  Commensurate supercell: 2x2x2 (8 primitive cells, 96 atoms), common to every arm of X1+
  displacement modes: |O(g) Psi - Psi D(g)| <= 1.8e-15 over the elements of G/T_S, Psi^T Psi = c 1 within 4.4e-16
  amplitude: largest displacement 0.1 A in every displaced structure (--amplitude); VESTA arrows scaled to a largest length of 1.5 A

* Order parameter directions and isotropy subgroups *
No.  irrep                subgroup           size  index structure
1    X1+(0;a)             65 Cmmm            2     4     65 Cmmm same (x3)
2    X1+(a;a)             123 P4/mmm         4     4     123 P4/mmm same (x3)
3    X1+(a;b)             47 Pmmm            4     8     47 Pmmm same (x3)

The components of a direction refer to the irrep basis of the table (as with
crystod-group --parent), not to the axes of the POSCAR; the displacement
listings give the Cartesian displacements.

structure = the space group spglib finds on the displaced structure exported for
the row (supercell as written, all atoms, tolerance 1e-05 A),
compared with the table (number, size, index): same, enantiomorph (the partner
type), different; (xN) for N choices of copies.

* 1 c1: X1+(0;a) -> 65 Cmmm *
  copies: X1+ c1 = O(8g)
  order parameter: a = 1
  reproduce: --order-parameter "0 1" --copies 1
  displacements: |u| = 0.1000 on 32 of 56 O atoms; zero on 24 atoms (no displacement in X1+)
  space group (displaced structure): 65 Cmmm, point group mmm, size 2, index 4
  check (on the displaced structure as written): table 65 Cmmm (size 2, index 4), structure 65 Cmmm same; 32 elements of G/T_S fix the displacements, 32 the order parameter
  allowed by symmetry: no electric polarization (non-polar point group mmm); inversion kept
  displacements in Angstrom (Cartesian, POSCAR axes; atoms numbered as in the supercell POSCAR) ([2, 2, 2] supercell): 32 O atoms move, 24 stay
    O41: [0.0382, 0.0924, 0.0000]
    O42: [0.0382, 0.0924, 0.0000]
    O43: [-0.0382, -0.0924, 0.0000]
    O44: [-0.0382, -0.0924, 0.0000]
    O45: [-0.0382, -0.0924, 0.0000]
    O46: [-0.0382, -0.0924, 0.0000]
    O47: [0.0382, 0.0924, 0.0000]
    O48: [0.0382, 0.0924, 0.0000]
    O49: [-0.0382, -0.0924, 0.0000]
    O50: [-0.0382, -0.0924, 0.0000]
    O51: [0.0382, 0.0924, 0.0000]
    O52: [0.0382, 0.0924, 0.0000]
    O53: [0.0382, 0.0924, 0.0000]
    O54: [0.0382, 0.0924, 0.0000]
    O55: [-0.0382, -0.0924, 0.0000]
    O56: [-0.0382, -0.0924, 0.0000]
    O57: [0.0924, 0.0382, 0.0000]
    O58: [0.0924, 0.0382, 0.0000]
    O59: [-0.0924, -0.0382, 0.0000]
    O60: [-0.0924, -0.0382, 0.0000]
    O61: [-0.0924, -0.0382, 0.0000]
    O62: [-0.0924, -0.0382, 0.0000]
    O63: [0.0924, 0.0382, 0.0000]
    O64: [0.0924, 0.0382, 0.0000]
    O65: [-0.0924, -0.0382, 0.0000]
    O66: [-0.0924, -0.0382, 0.0000]
    O67: [0.0924, 0.0382, 0.0000]
    O68: [0.0924, 0.0382, 0.0000]
    O69: [0.0924, 0.0382, 0.0000]
    O70: [0.0924, 0.0382, 0.0000]
    O71: [-0.0924, -0.0382, 0.0000]
    O72: [-0.0924, -0.0382, 0.0000]

...
