def testA2(self):
        import matter
        struct = matter.Structure(
            lattice=matter.Lattice(a=1,
                                   b=1,
                                   c=1,
                                   alpha=acos1_3,
                                   beta=acos1_3,
                                   gamma=acos1_3),
            sgid=229,
            atoms=[matter.Atom('Cu')],
        )
        self.assertEqual(StrukturberichtDesignationFinder().find(struct), A2)

        struct = matter.Structure(
            lattice=matter.Lattice(a=1, b=1, c=1, alpha=90, beta=90, gamma=90),
            sgid=229,
            atoms=[
                matter.Atom('Cu', xyz=[0, 0, 0]),
                matter.Atom('Cu', xyz=[0.5, 0.5, 0.5])
            ],
        )
        self.assertEqual(StrukturberichtDesignationFinder().find(struct), A2)

        return
Пример #2
0
    def test3(self):
        # simple cubic
        import matter
        lattice = matter.Lattice(a=3.701,
                                 b=3.701,
                                 c=3.701,
                                 alpha=90,
                                 beta=90,
                                 gamma=90)
        atom1 = matter.Atom('C')
        atom2 = matter.Atom('H', [0.5, 0.5, 0])
        atom3 = matter.Atom('H', [0.5, 0, 0.5])
        atom4 = matter.Atom('H', [0, 0.5, 0.5])
        struct = matter.Structure([atom1, atom2, atom3, atom4],
                                  lattice=lattice,
                                  sgid=221)

        from bvk.BvKBond import BvKBond
        bond = BvKBond()
        bond.matter = struct
        bond.uses_primitive_unitcell = 1
        bond.A = 0
        bond.B = 0
        bond.Boffset = [1, 1, 0]
        bond.Boffset_is_fractional = 0

        # 110
        print 'bond 110 for sc lattice'
        for constraint in findForceContantTensorConstraints(bond):
            print constraint

        return
 def testB2(self):
     import matter
     struct = matter.Structure(
         lattice=matter.Lattice(a=1, b=1, c=1, alpha=90, beta=90, gamma=90),
         sgid=221,
         atoms=[matter.Atom('Cs'),
                matter.Atom('Cl', xyz=[0.5, 0.5, 0.5])],
     )
     self.assertEqual(StrukturberichtDesignationFinder().find(struct), B2)
     return
Пример #4
0
 def test6(self):
     import matter
     atom = matter.Atom('H')
     atomic_scatterer = bp.atomicscatterer_fromSite(atom)
     self.assert_(atomic_scatterer is not None)
     # print atomic_scatterer
     return
 def testA1(self):
     import matter
     struct = matter.Structure(
         lattice=matter.Lattice(a=1, b=1, c=1, alpha=60, beta=60, gamma=60),
         sgid=225,
         atoms=[matter.Atom('Cu')],
     )
     self.assertEqual(StrukturberichtDesignationFinder().find(struct), A1)
     return
 def testMethodInStructureClass(self):
     import matter
     struct = matter.Structure(
         lattice=matter.Lattice(a=1, b=1, c=1, alpha=60, beta=60, gamma=60),
         sgid=225,
         atoms=[matter.Atom('Cu')],
     )
     self.assertEqual(struct.StrukturberichtDesignation, A1)
     return
Пример #7
0
    def testWriter(self):
        p = getParser()
        import matter
        a = 1.5
        lattice = matter.Lattice(2 * a, 2 * a, 2 * a, 90, 90, 90)
        atoms = [matter.Atom('Ni'), matter.Atom('Ni', (0.5, 0.5, 0.5))]
        struct = Structure(lattice=lattice, atoms=atoms, sgid=229)

        print 'original unitcell, cartesian coords'
        print '\n'.join(p.toLines(struct))

        print 'original unitcell, fractional coords'
        print '\n'.join(p.toLines(struct, use_fractional_coordinates=1))

        print 'primitive unitcell, cartesian coords'
        print '\n'.join(p.toLines(struct, use_primitive_unitcell=1))

        print 'primitive unitcell, fractional coords'
        print '\n'.join(
            p.toLines(struct,
                      use_primitive_unitcell=1,
                      use_fractional_coordinates=1))

        return