def test_time_reversal(orbitals, result_repr_matrix, numeric):
    """
    Test the generation of a representation matrix for time-reversal.
    """
    result = sr.get_time_reversal(orbitals=orbitals, numeric=numeric)
    if numeric:
        assert isinstance(result.repr.matrix, np.ndarray)
        assert np.allclose(result.repr.matrix,
                           np.array(result_repr_matrix).astype(complex))

        assert isinstance(result.real_space_operator.rotation_matrix,
                          np.ndarray)
        assert np.allclose(result.real_space_operator.rotation_matrix,
                           np.eye(3))
        assert isinstance(result.real_space_operator.translation_vector,
                          np.ndarray)
        assert np.allclose(result.real_space_operator.translation_vector,
                           np.zeros(3))
    else:
        assert isinstance(result.repr.matrix, sp.Matrix)
        assert result.repr.matrix == result_repr_matrix

        assert isinstance(result.real_space_operator.rotation_matrix,
                          sp.Matrix)
        assert result.real_space_operator.rotation_matrix.equals(sp.eye(3, 3))
        assert isinstance(result.real_space_operator.translation_vector,
                          sp.Matrix)
        assert result.real_space_operator.translation_vector.equals(
            sp.zeros(3, 1))
    assert result.repr.has_cc
Exemplo n.º 2
0
        sr.Orbital(position=pos_In, function_string="y", spin=spin_up),
        sr.Orbital(position=pos_In, function_string="z", spin=spin_up),
        sr.Orbital(position=pos_As, function_string="x", spin=spin_up),
        sr.Orbital(position=pos_As, function_string="y", spin=spin_up),
        sr.Orbital(position=pos_As, function_string="z", spin=spin_up),
        sr.Orbital(position=pos_In, function_string="1", spin=spin_down),
        sr.Orbital(position=pos_In, function_string="x", spin=spin_down),
        sr.Orbital(position=pos_In, function_string="y", spin=spin_down),
        sr.Orbital(position=pos_In, function_string="z", spin=spin_down),
        sr.Orbital(position=pos_As, function_string="x", spin=spin_down),
        sr.Orbital(position=pos_As, function_string="y", spin=spin_down),
        sr.Orbital(position=pos_As, function_string="z", spin=spin_down),
    ]

    # set up symmetry operations
    time_reversal = sr.get_time_reversal(orbitals=orbitals, numeric=True)
    assert np.allclose(time_reversal.repr.matrix,
                       np.kron([[0, -1j], [1j, 0]], np.eye(7)))

    structure = mg.Structure(
        lattice=model_nosym.uc,
        species=["In", "As"],
        coords=np.array([[0, 0, 0], [0.25, 0.25, 0.25]]),
    )

    # get real-space representations
    analyzer = mg.symmetry.analyzer.SpacegroupAnalyzer(structure)
    symops = analyzer.get_symmetry_operations(cartesian=False)
    symops_cart = analyzer.get_symmetry_operations(cartesian=True)

    symmetries = []
Exemplo n.º 3
0
        ),
        rotation_matrix_cartesian=sp.Matrix([[-1, 0, 0], [0, 1, 0], [0, 0,
                                                                     1]]),
        numeric=False
    ),
    sr.SymmetryOperation.from_orbitals(
        orbitals=orbitals,
        real_space_operator=sr.RealSpaceOperator(
            rotation_matrix=sp.Matrix([[1, 0, 0], [-1, -1, -1], [0, 0, 1]]),
            translation_vector=sp.Matrix([0, 0, 0]),
        ),
        rotation_matrix_cartesian=sp.Matrix([[0, 0, -1], [0, 1, 0], [-1, 0,
                                                                     0]]),
        numeric=False
    ),
    sr.get_time_reversal(orbitals=orbitals, numeric=False)
]


def print_result(order):
    """prints the basis for a given order of k"""
    print('Order:', order)
    for m in kp.symmetric_hamiltonian(
        *symmetry_generators,
        expr_basis=kp.monomial_basis(order),
        repr_basis=kp.hermitian_basis(len(orbitals))
    ):
        print(m)
    print()