Example #1
0
 def test_reorder1(self):
     atom = Atoms(['C', 'Au'])
     atom = atom.sub(1)
     atom = atom.reorder()
     assert_true(atom[0] == Atom['Au'])
     assert_true(len(atom) == 1)
     assert_true(len(atom.atom) == 2)
Example #2
0
 def test_reduce1(self):
     atom = Atoms(['C', 'Au'])
     atom = atom.sub(0)
     atom = atom.reduce()
     assert_true(atom[0] == Atom[6])
     assert_true(len(atom) == 1)
     assert_true(len(atom.atom) == 1)
Example #3
0
def test_reduce1():
    atom = Atoms(['C', 'Au'])
    atom = atom.sub(0)
    atom1 = atom.reduce()
    assert atom[0] == Atom[6]
    assert len(atom) == 1
    assert len(atom.atom) == 2
    assert atom1[0] == Atom[6]
    assert atom1[0] != Atom[8]
    assert len(atom1) == 1
    assert len(atom1.atom) == 1
    atom.reduce(True)
    assert atom[0] == Atom[6]
    assert len(atom) == 1
    assert len(atom.atom) == 1
Example #4
0
def test_reorder1():
    atom = Atoms(['C', 'Au'])
    atom = atom.sub(1)
    atom1 = atom.reorder()
    # Check we haven't done anything to the original Atoms object
    assert atom[0] == Atom['Au']
    assert atom.specie[0] == 1
    assert len(atom) == 1
    assert len(atom.atom) == 2
    assert atom1[0] == Atom['Au']
    assert atom1.specie[0] == 0
    assert len(atom1) == 1
    assert len(atom1.atom) == 2
    # Do in-place
    atom.reorder(True)
    assert atom[0] == Atom['Au']
    assert atom.specie[0] == 0
    assert len(atom) == 1
    assert len(atom.atom) == 2