from __future__ import print_function
from ase.parallel import paropen
from ase.units import Hartree
from gpaw.xc.rpa import RPACorrelation
from gpaw.xc.fxc import FXCCorrelation
from gpaw.mpi import world

fxc0 = FXCCorrelation('CO.ralda.pbe_wfcs_CO.gpw',
                      xc='rAPBE',
                      txt='CO.ralda_02_CO_rapbe.txt',
                      wcomm=world.size)

E0_i = fxc0.calculate(ecut=400)

f = paropen('CO.ralda_rapbe_CO.dat', 'w')
for ecut, E0 in zip(fxc0.ecut_i, E0_i):
    print(ecut * Hartree, E0, file=f)
f.close()

rpa0 = RPACorrelation('CO.ralda.pbe_wfcs_CO.gpw',
                      txt='CO.ralda_02_CO_rpa.txt',
                      wcomm=world.size)

E0_i = rpa0.calculate(ecut=400)

f = paropen('CO.ralda_rpa_CO.dat', 'w')
for ecut, E0 in zip(rpa0.ecut_i, E0_i):
    print(ecut * Hartree, E0, file=f)
f.close()
Exemple #2
0
from gpaw.xc.fxc import FXCCorrelation
from ase.parallel import paropen

fxc = FXCCorrelation('diam_kern.ralda.lda_wfcs.gpw', xc='rALDA',
                     txt='diam_kern.ralda_03_ralda_wave.txt',
                     av_scheme='wavevector')
E_i = fxc.calculate(ecut=[131.072])

resultfile = paropen('diam_kern.ralda_kernel_comparison.dat', 'w')
resultfile.write(str(E_i[-1]) + '\n')
resultfile.close()
Exemple #3
0
from ase.parallel import paropen
from ase.units import Hartree
from gpaw.xc.rpa import RPACorrelation
from gpaw.xc.fxc import FXCCorrelation
from gpaw.mpi import world

fxc0 = FXCCorrelation('CO.gpw', xc='rAPBE', txt='rapbe_CO.txt', wcomm=world.size)    
fxc1 = FXCCorrelation('C.gpw', xc='rAPBE', txt='rapbe_C.txt', wcomm=world.size)    
fxc2 = FXCCorrelation('O.gpw', xc='rAPBE', txt='rapbe_O.txt', wcomm=world.size)

E0_i = fxc0.calculate(ecut=400)
E1_i = fxc1.calculate(ecut=400)
E2_i = fxc2.calculate(ecut=400)

f = paropen('rapbe_CO.dat', 'w')
for ecut, E0, E1, E2 in zip(fxc0.ecut_i, E0_i, E1_i, E2_i):
    print >> f, ecut * Hartree, E0 - E1 - E2, E1
f.close()

rpa0 = RPACorrelation('CO.gpw', txt='rpa_CO.txt', wcomm=world.size)    
rpa1 = RPACorrelation('C.gpw', txt='rpa_C.txt', wcomm=world.size)    
rpa2 = RPACorrelation('O.gpw', txt='rpa_O.txt', wcomm=world.size)

E0_i = rpa0.calculate(ecut=400)
E1_i = rpa1.calculate(ecut=400)
E2_i = rpa2.calculate(ecut=400)

f = paropen('rpa_CO.dat', 'w')
for ecut, E0, E1, E2 in zip(rpa0.ecut_i, E0_i, E1_i, E2_i):
    print >> f, ecut * Hartree, E0 - E1 - E2, E1
f.close()
Exemple #4
0
H2.set_pbc(True)
H2.set_cell((2., 2., 3.))
H2.center()
calc = GPAW(mode=PW(210),
            eigensolver='rmm-diis',
            dtype=complex,
            xc='LDA',
            basis='dzp',
            nbands=8,
            convergence={'density': 1.e-6})
H2.set_calculator(calc)
H2.get_potential_energy()
calc.diagonalize_full_hamiltonian(nbands=80, scalapack=scalapack1)
calc.write('H2.gpw', mode='all')

ralda = FXCCorrelation('H2.gpw', xc='rALDA')
E_ralda_H2 = ralda.calculate(ecut=[200])

rapbe = FXCCorrelation('H2.gpw', xc='rAPBE')
E_rapbe_H2 = rapbe.calculate(ecut=[200])

# H ---------------------------------------
H = Atoms('H', [(0, 0, 0)])
H.set_pbc(True)
H.set_cell((2., 2., 3.))
H.center()
calc = GPAW(mode=PW(210),
            eigensolver='rmm-diis',
            dtype=complex,
            xc='LDA',
            basis='dzp',
Exemple #5
0
    kpts = monkhorst_pack((3, 3, 3))

    calc = GPAW(mode='pw',
                kpts=kpts,
                occupations=FermiDirac(0.001),
                setups={'Ni': '10'},
                communicator=serial_comm)

    Ni.set_calculator(calc)
    Ni.get_potential_energy()
    calc.diagonalize_full_hamiltonian()
    calc.write('Ni.gpw', mode='all')

world.barrier()

rpa = FXCCorrelation('Ni.gpw', xc='RPA', nfrequencies=8, skip_gamma=True)
E_rpa = rpa.calculate(ecut=[50])

ralda = FXCCorrelation('Ni.gpw',
                       xc='rALDA',
                       unit_cells=[2, 1, 1],
                       nfrequencies=8,
                       skip_gamma=True)
E_ralda = ralda.calculate(ecut=[50])

rapbe = FXCCorrelation('Ni.gpw',
                       xc='rAPBE',
                       unit_cells=[2, 1, 1],
                       nfrequencies=8,
                       skip_gamma=True)
E_rapbe = rapbe.calculate(ecut=[50])
Exemple #6
0
kpts = monkhorst_pack((2,2,2))
kpts += np.array([1/4., 1/4., 1/4.])

calc = GPAW(mode='pw',
            kpts=kpts,
            occupations=FermiDirac(0.001),
            communicator=serial_comm)
Si.set_calculator(calc)
E = Si.get_potential_energy()
calc.diagonalize_full_hamiltonian(nbands=50)

rpa = RPACorrelation(calc)
E_rpa1 = rpa.calculate(ecut=[25, 50])

fxc = FXCCorrelation(calc, xc='RPA', nlambda=16)
E_rpa2 = fxc.calculate(ecut=[25, 50])

fxc = FXCCorrelation(calc, xc='rALDA', unit_cells=[1,1,2])
E_ralda = fxc.calculate(ecut=[25, 50])

fxc = FXCCorrelation(calc, xc='rAPBE', unit_cells=[1,1,2])
E_rapbe = fxc.calculate(ecut=[25, 50])

fxc = FXCCorrelation(calc, xc='rALDA', av_scheme='wavevector')
E_raldawave = fxc.calculate(ecut=[25, 50])

fxc = FXCCorrelation(calc, xc='rAPBE', av_scheme='wavevector')
E_rapbewave = fxc.calculate(ecut=[25, 50])

fxc = FXCCorrelation(calc, xc='JGMs', av_scheme='wavevector',Eg=3.1,nlambda=2)
Exemple #7
0
N2 = molecule('N2')
N2.set_cell((2.5, 2.5, 3.5))
N2.center()
calc = GPAW(mode='pw',
            eigensolver='rmm-diis',
            dtype=complex,
            xc='LDA',
            nbands=16,
            basis='dzp',
            convergence={'density': 1.e-6})
N2.set_calculator(calc)
N2.get_potential_energy()
calc.diagonalize_full_hamiltonian(nbands=80, scalapack=scalapack1)
calc.write('N2.gpw', mode='all')

ralda = FXCCorrelation('N2.gpw', xc='rALDA')
Ec_N2 = ralda.calculate(ecut=[50])

# N ---------------------------------------
N = Atoms('N', [(0,0,0)])
N.set_cell((2.5, 2.5, 3.5))
N.center()
calc = GPAW(mode='pw',
            eigensolver='rmm-diis',
            dtype=complex,
            xc='LDA',
            basis='dzp',
            nbands=8,
            hund=True,
            convergence={'density': 1.e-6})
N.set_calculator(calc)
from gpaw.xc.fxc import FXCCorrelation
from ase.parallel import paropen

fxc = FXCCorrelation('diam_kern.ralda.lda_wfcs.gpw',
                     xc='JGMs',
                     txt='diam_kern.ralda_04_jgm.txt',
                     av_scheme='wavevector',
                     Eg=7.3)
E_i = fxc.calculate(ecut=[131.072])

resultfile = paropen('diam_kern.ralda_kernel_comparison.dat', 'a')
resultfile.write(str(E_i[-1]) + '\n')
resultfile.close()
Exemple #9
0
Si = Atoms('Si2', cell=cell, pbc=True,
           scaled_positions=((0,0,0), (0.25,0.25,0.25)))

kpts = monkhorst_pack((2,2,2))
kpts += np.array([1/4., 1/4., 1/4.])

calc = GPAW(mode='pw',
            kpts=kpts,
            occupations=FermiDirac(0.001),
            communicator=serial_comm)
Si.set_calculator(calc)
E = Si.get_potential_energy()
calc.diagonalize_full_hamiltonian(nbands=50)

rpa = RPACorrelation(calc)
E_rpa1 = rpa.calculate(ecut=[25, 50])

fxc = FXCCorrelation(calc, xc='RPA', nlambda=16)
E_rpa2 = fxc.calculate(ecut=[25, 50])

fxc = FXCCorrelation(calc, xc='rALDA', unit_cells=[1,1,2])
E_ralda = fxc.calculate(ecut=[25, 50])

fxc = FXCCorrelation(calc, xc='rAPBE', unit_cells=[1,1,2])
E_rapbe = fxc.calculate(ecut=[25, 50])

equal(E_rpa1[-1], E_rpa2[-1], 0.01)
equal(E_rpa2[-1], -12.6495, 0.001)
equal(E_ralda[-1], -11.3817, 0.001)
equal(E_rapbe[-1], -11.1640, 0.001)
Exemple #10
0
from gpaw.xc.fxc import FXCCorrelation
from ase.parallel import paropen

fxc = FXCCorrelation('diam_kern.ralda.lda_wfcs.gpw',
                     xc='range_RPA',
                     txt='diam_kern.ralda_07_range_rpa.txt',
                     range_rc=2.0)
E_i = fxc.calculate(ecut=[131.072, 80.0])

resultfile = paropen('diam_kern.ralda_kernel_comparison.dat', 'a')
resultfile.write(str(E_i[-1]) + '\n')
resultfile.close()
Exemple #11
0
from gpaw.xc.fxc import FXCCorrelation

fxc = FXCCorrelation('H.ralda.lda_wfcs.gpw',
                     xc='rALDA',
                     txt='H.ralda_03_ralda.output.txt')
fxc.calculate(ecut=300)
Exemple #12
0
H2 = Atoms('H2', [(0, 0, 0), (0, 0, 0.7413)])
H2.set_pbc(True)
H2.set_cell((2., 2., 3.))
H2.center()
calc = GPAW(mode=PW(210, force_complex_dtype=True),
            eigensolver='rmm-diis',
            xc='LDA',
            basis='dzp',
            nbands=8,
            convergence={'density': 1.e-6})
H2.set_calculator(calc)
H2.get_potential_energy()
calc.diagonalize_full_hamiltonian(nbands=80, scalapack=scalapack1)
calc.write('H2.gpw', mode='all')

ralda = FXCCorrelation('H2.gpw', xc='rALDA', nblocks=min(4, world.size))
E_ralda_H2 = ralda.calculate(ecut=[200])

rapbe = FXCCorrelation('H2.gpw', xc='rAPBE')
E_rapbe_H2 = rapbe.calculate(ecut=[200])

# H
H = Atoms('H')
H.set_pbc(True)
H.set_cell((2., 2., 3.))
H.center()
calc = GPAW(mode=PW(210, force_complex_dtype=True),
            eigensolver='rmm-diis',
            xc='LDA',
            basis='dzp',
            nbands=4,
Exemple #13
0
from ase.build import bulk
from gpaw import GPAW, FermiDirac
from gpaw.mpi import serial_comm
from gpaw.test import equal
from gpaw.xc.rpa import RPACorrelation
from gpaw.xc.fxc import FXCCorrelation

a0 = 5.43
Ni = bulk('Ni', 'fcc')
Ni.set_initial_magnetic_moments([0.7])

calc = GPAW(mode='pw',
            kpts=(3, 3, 3),
            occupations=FermiDirac(0.001),
            setups={'Ni': '10'},
            communicator=serial_comm)
Ni.set_calculator(calc)
E = Ni.get_potential_energy()
calc.diagonalize_full_hamiltonian(nbands=50)

rpa = RPACorrelation(calc, nfrequencies=8, skip_gamma=True)
E_rpa = rpa.calculate(ecut=[50])

fxc = FXCCorrelation(calc, nlambda=16, nfrequencies=8, skip_gamma=True)
E_fxc = fxc.calculate(ecut=[50])

equal(E_rpa, -7.826, 0.01)
equal(E_fxc, -7.826, 0.01)
from ase.lattice import bulk
from gpaw import GPAW, FermiDirac
from gpaw.mpi import serial_comm
from gpaw.test import equal
from gpaw.xc.rpa import RPACorrelation
from gpaw.xc.fxc import FXCCorrelation

a0 = 5.43
Ni = bulk("Ni", "fcc")
Ni.set_initial_magnetic_moments([0.7])

calc = GPAW(mode="pw", kpts=(3, 3, 3), occupations=FermiDirac(0.001), setups={"Ni": "10"}, communicator=serial_comm)
Ni.set_calculator(calc)
E = Ni.get_potential_energy()
calc.diagonalize_full_hamiltonian(nbands=50)

rpa = RPACorrelation(calc, nfrequencies=8, skip_gamma=True)
E_rpa = rpa.calculate(ecut=[50])

fxc = FXCCorrelation(calc, nlambda=16, nfrequencies=8, skip_gamma=True)
E_fxc = fxc.calculate(ecut=[50])

equal(E_rpa, -7.826, 0.01)
equal(E_fxc, -7.826, 0.01)
from gpaw.xc.fxc import FXCCorrelation

fxc = FXCCorrelation('diam_kern.ralda.lda_wfcs.gpw',
                     xc='rALDA',
                     txt='diam_kern.ralda_02_ralda_dens.txt')
E_i = fxc.calculate(ecut=[131.072])
from gpaw.xc.fxc import FXCCorrelation

fxc = FXCCorrelation('H.ralda.pbe_wfcs.gpw', xc='rAPBE',
                     txt='H.ralda_06_rapbe.output.txt')
fxc.calculate(ecut=300)
Exemple #17
0
from gpaw.xc.fxc import FXCCorrelation
from ase.units import Hartree
from ase.parallel import paropen

resultfile = paropen('range_results.dat', 'w')

# Standard RPA result
resultfile.write(str(0.0) + ' ' + str(-12.250) + '\n')

# Suggested parameters from Bruneval, PRL 108, 256403 (2012)
rc_list = [0.5, 1.0, 2.0, 3.0, 4.0]
cutoff_list = [11.0, 5.0, 2.25, 0.75, 0.75]
nbnd_list = [500, 200, 100, 50, 40]

for rc, ec, nbnd in zip(rc_list, cutoff_list, nbnd_list):
    fxc = FXCCorrelation('si.lda_wfcs.gpw',
                         xc='range_RPA',
                         txt='si_range.' + str(rc) + '.txt',
                         range_rc=rc)
    E_i = fxc.calculate(ecut=[ec * Hartree], nbands=nbnd)
    resultfile.write(str(rc) + ' ' + str(E_i[0]) + '\n')
Exemple #18
0
from gpaw.xc.fxc import FXCCorrelation

fxc = FXCCorrelation('H.ralda.pbe_wfcs.gpw',
                     xc='rAPBE',
                     txt='H.ralda_06_rapbe.output.txt')
fxc.calculate(ecut=300)
Exemple #19
0
from __future__ import print_function
from ase.parallel import paropen
from ase.units import Hartree
from gpaw.xc.rpa import RPACorrelation
from gpaw.xc.fxc import FXCCorrelation

fxc = FXCCorrelation('diamond.ralda.pbe_wfcs.gpw', xc='rAPBE',
                     txt='diamond.ralda_02_rapbe.txt')
E_i = fxc.calculate(ecut=400)

f = paropen('diamond.ralda.rapbe.dat', 'w')
for ecut, E in zip(fxc.ecut_i, E_i):
    print(ecut * Hartree, E, file=f)
f.close()

rpa = RPACorrelation('diamond.ralda.pbe_wfcs.gpw',
                     txt='diamond.ralda_02_rpa.txt')
E_i = rpa.calculate(ecut=400)

f = paropen('diamond.ralda.rpa.dat', 'w')
for ecut, E in zip(rpa.ecut_i, E_i):
    print(ecut * Hartree, E, file=f)
f.close()
H2.set_pbc(True)
H2.set_cell((2., 2., 3.))
H2.center()
calc = GPAW(mode=PW(210),
            eigensolver='rmm-diis',
            dtype=complex,
            xc='LDA',
            basis='dzp',
            nbands=8,
            convergence={'density': 1.e-6})
H2.set_calculator(calc)
H2.get_potential_energy()
calc.diagonalize_full_hamiltonian(nbands=80, scalapack=scalapack1)
calc.write('H2.gpw', mode='all')

ralda = FXCCorrelation('H2.gpw', xc='rALDA')
E_ralda_H2 = ralda.calculate(ecut=[200])

rapbe = FXCCorrelation('H2.gpw', xc='rAPBE')
E_rapbe_H2 = rapbe.calculate(ecut=[200])

# H ---------------------------------------
H = Atoms('H', [(0,0,0)])
H.set_pbc(True)
H.set_cell((2., 2., 3.))
H.center()
calc = GPAW(mode=PW(210),
            eigensolver='rmm-diis',
            dtype=complex,
            xc='LDA',
            basis='dzp',
Exemple #21
0
from gpaw.xc.fxc import FXCCorrelation
from ase.parallel import paropen

fxc = FXCCorrelation('diam_kern.ralda.lda_wfcs.gpw',
                     xc='RPA',
                     txt='diam_kern.ralda_08_rpa.txt')
E_i = fxc.calculate(ecut=[131.072, 80.0])

resultfile = paropen('diam_kern.ralda_kernel_comparison.dat', 'a')
resultfile.write(str(E_i[-1]) + '\n')
resultfile.close()
N2 = molecule('N2')
N2.set_cell((2.5, 2.5, 3.5))
N2.center()
calc = GPAW(mode='pw',
            eigensolver='rmm-diis',
            dtype=complex,
            xc='LDA',
            nbands=16,
            basis='dzp',
            convergence={'density': 1.e-6})
N2.set_calculator(calc)
N2.get_potential_energy()
calc.diagonalize_full_hamiltonian(nbands=80, scalapack=scalapack1)
calc.write('N2.gpw', mode='all')

ralda = FXCCorrelation('N2.gpw', xc='rALDA')
Ec_N2 = ralda.calculate(ecut=[50])

# N ---------------------------------------
N = Atoms('N', [(0, 0, 0)])
N.set_cell((2.5, 2.5, 3.5))
N.center()
calc = GPAW(mode='pw',
            eigensolver='rmm-diis',
            dtype=complex,
            xc='LDA',
            basis='dzp',
            nbands=8,
            hund=True,
            convergence={'density': 1.e-6})
N.set_calculator(calc)
Exemple #23
0
    kpts = monkhorst_pack((3,3,3))

    calc = GPAW(mode='pw',
                kpts=kpts,
                occupations=FermiDirac(0.001),
                setups={'Ni': '10'},
                communicator=serial_comm)
    
    Ni.set_calculator(calc)
    Ni.get_potential_energy()
    calc.diagonalize_full_hamiltonian()
    calc.write('Ni.gpw', mode='all')

world.barrier()

rpa = FXCCorrelation('Ni.gpw', xc='RPA',
                     nfrequencies=8, skip_gamma=True)
E_rpa = rpa.calculate(ecut=[50])

ralda = FXCCorrelation('Ni.gpw', xc='rALDA', unit_cells=[2,1,1],
                       nfrequencies=8, skip_gamma=True)
E_ralda = ralda.calculate(ecut=[50])

rapbe = FXCCorrelation('Ni.gpw', xc='rAPBE', unit_cells=[2,1,1],
                       nfrequencies=8, skip_gamma=True)
E_rapbe = rapbe.calculate(ecut=[50])

equal(E_rpa, -7.827, 0.01)
equal(E_ralda, -7.501, 0.01)
equal(E_rapbe, -7.444, 0.01)