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
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 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
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
def testMatter(): pwInput = PWInput(config=testSCFString) struct = matter.Structure() struct.read('data/graphite.cif', format='cif') #struct.read('data/PbTe.cif', format='cif') #struct.read('data/Ni.stru', format='pdffit') #struct.read('data/CdSe-wurtzite.stru', format='pdffit') print struct print struct.lattice.base #struct = Structure(filename='data/Ni.stru') #struct = Structure(filename='data/graphite.cif') #struct = Structure(filename='data/PbTe.cif') #struct = Structure(filename='data/CdSe-wurtzite.stru') #struct = Structure(pbte) # does not work well in matter: #s = pbte.writeStr(format='cif') at1 = Atom('V', [0., 0., 0.]) at2 = Atom('V', [0.5, 0., 0.]) at3 = Atom('V', [0., 0.5, 0.]) at4 = Atom('V', [0., 0., 0.5]) at5 = Atom('V', [0.5, 0.5, 0.]) at6 = Atom('V', [0., 0.5, 0.5]) at7 = Atom('V', [0.5, 0., 0.5]) at8 = Atom('V', [0.5, 0.5, 0.5]) at9 = Atom('V', [0.25, 0.25, 0.25]) at10 = Atom('Fe', [0.75, 0.25, 0.25]) at11 = Atom('V', [0.75, 0.75, 0.25]) at12 = Atom('Fe', [0.25, 0.75, 0.25]) at13 = Atom('Fe', [0.25, 0.25, 0.75]) at14 = Atom('V', [0.75, 0.25, 0.75]) at15 = Atom('Fe', [0.75, 0.75, 0.75]) at16 = Atom('V', [0.25, 0.75, 0.75]) struct2 = Structure([ at1, at2, at3, at4, at5, at6, at7, at8, at9, at10, at11, at12, at13, at14, at15, at16 ], lattice=Lattice(2, 2, 2, 90, 90, 90)) #print struct massList = [50., 55.] psList = ['ps1', 'ps2'] #massList = [1, 2, 3, 4, 5, 6,1, 2, 3, 4, 5, 6] #psList = ['ps1', 'ps2', 'ps2', 'ps3', 'ps4','ps1', 'ps2', 'ps2', 'ps3', 'ps4'] # pwInput.structure.load(ibrav = 0, structure = struct, \ # massList = massList, psList = psList) #pwInput.structure.load(structure = struct ) #print pwInput.structure.atomLabels() pwInput.structure.load(structure = struct, ibrav = 2, \ massList = massList, psList = psList) # pwInput.structure.setStructureFromDiffpyStructure(struct, \ # massList = massList,\ # psList = psList) # pwInput.structure.setReducedStructureFromDiffpyStructure(struct, ibrav = 2, \ # massList = massList,\ # psList = psList) # this will update string s: #s = '' #s = pwInput.structure.toString(string = s) #pwInput.removeNamelist('system') #pwInput.removeCard('atomic_species') #pwInput.removeCard('atomic_positions') #pwInput.removeCard('cell_parameters') #pwInput.structure.parseInput() s = pwInput.structure.toString() #pwInput.structure.atomicPositionsType = 'alat' #s = pwInput.structure.toString() #pwInput.structure.save('scf.in') print s