File: example.py

package info (click to toggle)
spglib 2.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 14,180 kB
  • sloc: ansic: 125,066; python: 7,717; cpp: 2,197; f90: 2,143; ruby: 792; makefile: 22; sh: 18
file content (30 lines) | stat: -rw-r--r-- 1,037 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""Example to use get_symmetry_dataset with Wurtzite structure input (P6_3mc)."""

from spglib import get_symmetry_dataset

lattice = [[3.111, 0, 0], [-1.5555, 2.6942050311733885, 0], [0, 0, 4.988]]
position = [
    [1.0 / 3, 2.0 / 3, 0.0],
    [2.0 / 3, 1.0 / 3, 0.5],
    [1.0 / 3, 2.0 / 3, 0.6181],
    [2.0 / 3, 1.0 / 3, 0.1181],
]
types = [1, 1, 2, 2]
symprec = 1e-5

cell = (lattice, position, types)
dataset = get_symmetry_dataset(cell, symprec=symprec)

print(f"International symbol: {dataset.international} ({dataset.number})")
print(f"Hall symbol: {dataset.hall}")
print("Wyckoff letters: ", end="")
print(" ".join([f"{w}" for w in dataset.wyckoffs]))
print("Equivalent atoms:")
for i, equiv_atom in enumerate(dataset.equivalent_atoms):
    print(f"{i} -> {equiv_atom}")
print("Space group operations:")
for i, (r, t) in enumerate(zip(dataset.rotations, dataset.translations)):
    print(f"--- {i + 1} ---")
    for vec in r:
        print(f"{vec[0]:2d} {vec[1]:2d} {vec[2]:2d}")
    print(f"{t[0]:.5f} {t[1]:.5f} {t[2]:.5f}")