Skip to content

Commit 61ab6bc

Browse files
authoredMar 8, 2025
Merge pull request #176 from spglib/classical-spin
Add usual co-representations for magnetic space group
2 parents 3c7f009 + bfd0096 commit 61ab6bc

File tree

4 files changed

+347
-96
lines changed

4 files changed

+347
-96
lines changed
 

‎src/spgrep/core.py

+87-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
import numpy as np
88
from spglib import get_magnetic_symmetry_dataset, get_symmetry_dataset
99

10-
from spgrep.corep import enumerate_spinor_small_corepresentations
10+
from spgrep.corep import (
11+
enumerate_small_corepresentations,
12+
enumerate_spinor_small_corepresentations,
13+
)
1114
from spgrep.group import get_little_group
1215
from spgrep.irreps import (
1316
enumerate_small_representations,
@@ -260,6 +263,89 @@ def get_crystallographic_pointgroup_irreps_from_symmetry(
260263
return irreps
261264

262265

266+
################################################################################
267+
# Co-representation
268+
################################################################################
269+
270+
271+
def get_magnetic_spacegroup_coreps_from_primitive_symmetry(
272+
rotations: NDArrayInt,
273+
translations: NDArrayFloat,
274+
time_reversals: NDArrayInt,
275+
kpoint: NDArrayFloat,
276+
method: Literal["Neto", "random"] = "Neto",
277+
rtol: float = 1e-5,
278+
atol: float = 1e-8,
279+
max_num_random_generations: int = 4,
280+
) -> tuple[list[NDArrayComplex], list[NDArrayBool], NDArrayInt]:
281+
r"""Compute all irreducible co-representations of given magnetic space group up to unitary transformation.
282+
283+
Note that ``rotations`` and ``translations`` should be specified in a primitive magnetic cell.
284+
285+
Parameters
286+
----------
287+
rotations: array[int], (order, 3, 3)
288+
Assume a fractional coordinates `x` are transformed by the i-th symmetry operation as follows:
289+
``np.dot(rotations[i, :, :], x) + translations[i, :]``
290+
translations: array, (order, 3)
291+
kpoint: array, (3, )
292+
Reciprocal vector with respect to reciprocal lattice.
293+
For pure translation :math:`\mathbf{t}`, returned irrep :math:`\Gamma^{(\alpha)}` takes
294+
295+
.. math::
296+
\Gamma^{(\alpha)}((E, \mathbf{t})) = e^{ -i\mathbf{k}\cdot\mathbf{t} } \mathbf{1}.
297+
298+
See :ref:`physically_irreps` for details.
299+
300+
method: str, 'Neto' or 'random'
301+
'Neto': construct irreps from a fixed chain of subgroups of little co-group
302+
'random': construct irreps by numerically diagonalizing a random matrix commute with regular representation
303+
rtol: float
304+
Relative tolerance
305+
atol: float
306+
Absolute tolerance to distinguish difference eigenvalues
307+
max_num_random_generations: int
308+
Maximum number of trials to generate random matrix
309+
310+
Returns
311+
-------
312+
irreps: list of Irreps with (little_group_order, dim, dim)
313+
Let ``i = mapping_little_group[idx]``. ``irreps[alpha][i, :, :]`` is the ``alpha``-th irreducible matrix representation of ``(rotations[i], translations[i])``.
314+
anti_linear: array[bool], (order, )
315+
If ``anti_linear[i] == True``, the ``i``-th operator is anti-linear.
316+
mapping_little_group: array, (little_group_order, )
317+
Let ``i = mapping_little_group[idx]``.
318+
``(rotations[i], translations[i])`` belongs to the little group of given space space group and kpoint.
319+
"""
320+
# Sanity check to use primitive cell
321+
for rotation, translation, time_reversal in zip(rotations, translations, time_reversals):
322+
if (
323+
np.allclose(rotation, np.eye(3), rtol=rtol, atol=atol)
324+
and not np.allclose(translation, 0, atol=atol)
325+
and (time_reversal == 0)
326+
):
327+
raise ValueError("Specify magnetic symmetry operations in primitive cell!")
328+
329+
little_rotations, little_translations, mapping_little_group = get_little_group(
330+
rotations, translations, kpoint, atol=atol
331+
)
332+
little_time_reversals = time_reversals[mapping_little_group]
333+
334+
# Small representations of little group
335+
irreps, anti_linear = enumerate_small_corepresentations(
336+
little_rotations=little_rotations,
337+
little_translations=little_translations,
338+
little_time_reversals=little_time_reversals,
339+
kpoint=kpoint,
340+
method=method,
341+
rtol=rtol,
342+
atol=atol,
343+
max_num_random_generations=max_num_random_generations,
344+
)
345+
346+
return irreps, anti_linear, mapping_little_group
347+
348+
263349
################################################################################
264350
# Spin representation
265351
################################################################################

0 commit comments

Comments
 (0)