Ejemplo n.º 1
0
    def get_grid(self, k_c, r0):
        print('Correction:', self.gd.integrate(self.corrt_G))
        if not hasattr(self, 'written'):
            print('r0', r0, r0 * Bohr)
            dR = 0.3
            AI = AngularIntegral(r0 * Bohr, self.gd, dR=dR)
            r_R = AI.radii()
            psi_R = AI.average(self.corrt_G)
            v_R = AI.average(self.vt_G)
            f = open('radial_dR' + str(dR) + '.dat', 'w')
            print('# R  v(R)    psi(R)', file=f)
            for r, psi, v in zip(r_R, psi_R, v_R):
                print(r, psi, v, file=f)
            f.close()
            self.written = True

        return self.pw.get_grid(k_c, r0) - 1e6 * self.corrt_G
Ejemplo n.º 2
0
    def get_grid(self, k_c, r0):
        print "Correction:", self.gd.integrate(self.corrt_G)
        if not hasattr(self, 'written'):
            print "r0", r0, r0 * Bohr
            dR = 0.3
            AI = AngularIntegral(r0 * Bohr, self.gd, dR=dR)
            r_R = AI.radii()
            psi_R = AI.average(self.corrt_G)
            v_R =  AI.average(self.vt_G)
            f = open('radial_dR'+str(dR)+'.dat', 'w')
            print >> f, '# R  v(R)    psi(R)'
            for r, psi, v in zip(r_R, psi_R, v_R):
                print >> f, r, psi, v
            f.close()
            self.written = True

        return self.pw.get_grid(k_c, r0) - 1e6 * self.corrt_G
Ejemplo n.º 3
0
        kpts=(1, 1, 2),
        convergence={'eigenstates': 1.e-6},
        txt=None,
    )
    H2.set_calculator(calc)
    H2.get_potential_energy()
    if not donot:
        calc.write(fname)

# Check that a / h = 10 is rounded up to 12 as always:
assert (calc.wfs.gd.N_c == (12, 12, 16)).all()

############ AngularIntegral

gd = calc.density.gd
ai = AngularIntegral(H2.positions.mean(0), calc.wfs.gd, Rmax=1.5)
unity_g = gd.zeros() + 1.
average_R = ai.average(unity_g)
integral_R = ai.integrate(unity_g)
for V, average, integral, R, Rm in zip(ai.V_R, average_R, integral_R,
                                       ai.radii(), ai.radii('mean')):
    if V > 0:
        equal(average, 1, 1.e-9)
        equal(integral / (4 * pi * Rm**2), 1, 0.61)
        equal(Rm / R, 1, 0.61)

############ ExpandYl

yl = ExpandYl(H2.positions.mean(0), calc.wfs.gd, Rmax=1.5)

Ejemplo n.º 4
0
    calc = GPAW(gpts=(12, 12, 16), nbands=2,
                convergence={'eigenstates':1.e-6},
                txt=None,
                )
    H2.set_calculator(calc)
    H2.get_potential_energy()
    if not donot:
        calc.write(fname)

# Check that a / h = 10 is rounded up to 12 as always:
assert (calc.wfs.gd.N_c == (12, 12, 16)).all()

############ AngularIntegral

gd = calc.density.gd
ai = AngularIntegral(H2.positions.mean(0), calc.wfs.gd, Rmax=1.5)
unity_g = gd.zeros() + 1.
average_R = ai.average(unity_g)
integral_R = ai.integrate(unity_g)
for V, average, integral, R, Rm in zip(ai.V_R, average_R, integral_R, 
                                       ai.radii(), ai.radii('mean')):
    if V > 0:
        equal(average, 1, 1.e-9)
        equal(integral / (4 * pi * Rm**2), 1, 0.61)
        equal(Rm / R, 1, 0.61)

############ ExpandYl

yl = ExpandYl(H2.positions.mean(0), calc.wfs.gd, Rmax=1.5)

def max_index(l):