Esempio n. 1
0
def test_magmom(convcell_cr: PhonopyAtoms):
    """Test symmetry search with hmagnetic moments."""
    symprec = 1e-5
    symmetry_nonspin = Symmetry(convcell_cr, symprec=symprec)
    atom_map_nonspin = symmetry_nonspin.get_map_atoms()
    len_sym_nonspin = len(symmetry_nonspin.symmetry_operations["rotations"])

    spin = [1, -1]
    cell_withspin = convcell_cr.copy()
    cell_withspin.magnetic_moments = spin
    symmetry_withspin = Symmetry(cell_withspin, symprec=symprec)
    atom_map_withspin = symmetry_withspin.get_map_atoms()
    len_sym_withspin = len(symmetry_withspin.symmetry_operations["rotations"])

    broken_spin = [1, -2]
    cell_brokenspin = convcell_cr.copy()
    cell_brokenspin = convcell_cr.copy()
    cell_brokenspin.magnetic_moments = broken_spin
    symmetry_brokenspin = Symmetry(cell_brokenspin, symprec=symprec)
    atom_map_brokenspin = symmetry_brokenspin.get_map_atoms()
    len_sym_brokenspin = len(
        symmetry_brokenspin.symmetry_operations["rotations"])

    assert (atom_map_nonspin == atom_map_withspin).all()
    assert (atom_map_nonspin != atom_map_brokenspin).any()
    assert len_sym_nonspin == len_sym_withspin
    assert len_sym_nonspin != len_sym_brokenspin
Esempio n. 2
0
def test_Cr_copy_magnetic_moments(convcell_cr: PhonopyAtoms, helper_methods):
    """Test by Cr with [1, -1] magnetic moments."""
    convcell_cr.magnetic_moments = [1, -1]
    helper_methods.compare_cells(convcell_cr, convcell_cr.copy())
    helper_methods.compare_cells_with_order(convcell_cr, convcell_cr.copy())
    convcell_cr.magnetic_moments = None