Exemple #1
0
 def testTagAdd(self):
     atoms = Atoms('4Ge', positions=np.array([[0, 1*i, -2*i] for i in range(4)]))
     atoms2 = atoms.copy()
     atoms2.setTag('hello', [1,2])
     self.assertArraysEqual(atoms2.tag('hello').picker(), [1,2])
     atoms = atoms + atoms2
     self.assertArraysEqual(atoms.tag('hello').picker(), [5,6])
Exemple #2
0
    def testTagCut(self):
        n = 6
        atoms = Atoms('%dGe'%n, positions=np.array([[0, 1*i, -2*i] for i in range(n)]))
        atoms.setTag('hello', [2, 3, 4])
        atoms2 = atoms[[1, 2, 3]]
        atoms3 = atoms[[0]]
        atoms4 = atoms[[4, 5]]
        atoms5 = atoms[-3:]
        atoms6 = atoms[:3]
        atoms7 = atoms[:]
        atoms8 = atoms[[]]
        self.assertArraysEqual(atoms.tag('hello').picker(), [2, 3, 4])
        self.assertArraysEqual(atoms7.tag('hello').picker(), [2, 3, 4])
        self.assertArraysEqual(atoms8.tag('hello').picker(), [])

        self.assertArraysEqual(atoms2.tag('hello').picker(), [1, 2])
        self.assertArraysEqual(atoms3.tag('hello').picker(), [])
        self.assertArraysEqual(atoms4.tag('hello').picker(), [0])
        self.assertArraysEqual(atoms5.tag('hello').picker(), [0, 1])
        self.assertArraysEqual(atoms6.tag('hello').picker(), [2])