Beispiel #1
0
def test_spin2():
    s1 = Spin()
    s2 = Spin('p')
    s3 = Spin('nc')
    s4 = Spin('so')

    assert s1.kind == Spin.UNPOLARIZED
    assert s2.kind == Spin.POLARIZED
    assert s3.kind == Spin.NONCOLINEAR
    assert s4.kind == Spin.SPINORBIT

    assert s1 == s1.copy()
    assert s2 == s2.copy()
    assert s3 == s3.copy()
    assert s4 == s4.copy()

    assert s1 < s2
    assert s2 < s3
    assert s3 < s4

    assert s1 <= s2
    assert s2 <= s3
    assert s3 <= s4

    assert s2 > s1
    assert s3 > s2
    assert s4 > s3

    assert s2 >= s1
    assert s3 >= s2
    assert s4 >= s3

    assert s1.is_unpolarized
    assert not s1.is_polarized
    assert not s1.is_noncolinear
    assert not s1.is_spinorbit

    assert not s2.is_unpolarized
    assert s2.is_polarized
    assert not s2.is_noncolinear
    assert not s2.is_spinorbit

    assert not s3.is_unpolarized
    assert not s3.is_polarized
    assert s3.is_noncolinear
    assert not s3.is_spinorbit

    assert not s4.is_unpolarized
    assert not s4.is_polarized
    assert not s4.is_noncolinear
    assert s4.is_spinorbit
Beispiel #2
0
    def test_spin2(self):
        s1 = Spin()
        s2 = Spin('p')
        s3 = Spin('nc')
        s4 = Spin('so')

        assert_true(s1 == s1.copy())
        assert_true(s2 == s2.copy())
        assert_true(s3 == s3.copy())
        assert_true(s4 == s4.copy())

        assert_true(s1 < s2)
        assert_true(s2 < s3)
        assert_true(s3 < s4)

        assert_true(s1 <= s2)
        assert_true(s2 <= s3)
        assert_true(s3 <= s4)

        assert_true(s2 > s1)
        assert_true(s3 > s2)
        assert_true(s4 > s3)

        assert_true(s2 >= s1)
        assert_true(s3 >= s2)
        assert_true(s4 >= s3)

        assert_true(s1.is_unpolarized)
        assert_false(s1.is_polarized)
        assert_false(s1.is_noncolinear)
        assert_false(s1.is_spinorbit)

        assert_false(s2.is_unpolarized)
        assert_true(s2.is_polarized)
        assert_false(s2.is_noncolinear)
        assert_false(s2.is_spinorbit)

        assert_false(s3.is_unpolarized)
        assert_false(s3.is_polarized)
        assert_true(s3.is_noncolinear)
        assert_false(s3.is_spinorbit)

        assert_false(s4.is_unpolarized)
        assert_false(s4.is_polarized)
        assert_false(s4.is_noncolinear)
        assert_true(s4.is_spinorbit)
Beispiel #3
0
 def test_spin1(self):
     for val in ['unpolarized', '',
                 'polarized', 'p',
                 'non-colinear', 'nc',
                 'spin-orbit', 'so']:
         s = Spin(val)
         repr(s)
         s1 = s.copy()
         assert_equal(s, s1)
Beispiel #4
0
def test_spin1():
    for val in ['unpolarized', '', Spin.UNPOLARIZED,
                'polarized', 'p', Spin.POLARIZED,
                'non-collinear', 'nc', Spin.NONCOLINEAR,
                'spin-orbit', 'so', Spin.SPINORBIT]:
        s = Spin(val)
        str(s)
        s1 = s.copy()
        assert s == s1