コード例 #1
0
 def test_parabolic_fit(self):
     print ""
     kpt, stepsize, band, prg, basis = emc.parse_inpcar(self.inpcar_fh, debug=False) # will need stepsize later
     st = []
     st.append([-5.0, -5.0, 0.0])
     st.append([-4.0, -4.0, 0.0])
     st.append([-3.0, -3.0, 0.0])
     st.append([-2.0, -2.0, 0.0])
     st.append([-1.0, -1.0, 0.0])
     st.append([0.0, 0.0, 0.0])
     st.append([1.0, 1.0, 0.0])
     st.append([2.0, 2.0, 0.0])
     st.append([3.0, 3.0, 0.0])
     st.append([4.0, 4.0, 0.0])
     st.append([5.0, 5.0, 0.0])
     #
     kpts = emc.generate_kpoints(kpt, st, stepsize, prg, basis)
     #print kpts
     kpoints_fh = open('KPOINTS', 'w')
     kpoints_fh.write("EMC \n")
     kpoints_fh.write("%d\n" % len(kpts))
     kpoints_fh.write("Reciprocal\n")
     #
     for i, kpt in enumerate(kpts):
         kpoints_fh.write( '%15.10f %15.10f %15.10f 0.01\n' % (kpt[0], kpt[1], kpt[2]) )
     #
     kpoints_fh.close()
コード例 #2
0
ファイル: test_gaas.py プロジェクト: 12182007/emc
    def test_kpoints(self):
        kpt, stepsize, band, prg, basis = emc.parse_inpcar(self.inpcar_fh, debug=False) # will need stepsize later
        kpts = emc.generate_kpoints(kpt, emc.st3, stepsize, prg, basis)

        self.kpoints_fh.readline() # title
        nkpt = int(self.kpoints_fh.readline()) # Reciprocal
        self.assertEquals(nkpt, len(kpts), msg='Length of the list is not equal to the number from KPOINTS')
        self.kpoints_fh.readline() # Reciprocal

        for i in range(len(kpts)):
            kp = [float(x) for x in self.kpoints_fh.readline().split()[0:3]] # kx ky kz w
            self.assertListAlmostEqual(kpts[i], kp, places=5, msg='K-point %d is not equal to that from the KPOINTS file' % i)
コード例 #3
0
    def test_kpoints(self):
        kpt, stepsize, band, prg, basis = emc.parse_inpcar(
            self.inpcar_fh, debug=False)  # will need stepsize later
        kpts = emc.generate_kpoints(kpt, emc.st3, stepsize, prg, basis)

        self.kpoints_fh.readline()  # title
        nkpt = int(self.kpoints_fh.readline())  # Reciprocal
        self.assertEquals(
            nkpt,
            len(kpts),
            msg='Length of the list is not equal to the number from KPOINTS')
        self.kpoints_fh.readline()  # Reciprocal

        for i in range(len(kpts)):
            kp = [float(x) for x in self.kpoints_fh.readline().split()[0:3]
                  ]  # kx ky kz w
            self.assertListAlmostEqual(
                kpts[i],
                kp,
                places=5,
                msg='K-point %d is not equal to that from the KPOINTS file' %
                i)