Exemplo n.º 1
0
    def collect_lead_data(self, obj):
        data = {}
        data['bzk_kc'] = obj.wfs.kd.bzk_kc
        #data['bzk_qc'] = obj.wfs.bzk_qc
        data['ibzk_kc'] = obj.wfs.kd.ibzk_kc
        data['ibzk_qc'] = obj.wfs.kd.ibzk_qc
        #data['setups'] = obj.wfs.setups
        data['cell_cv'] = obj.gd.cell_cv
        data['parsize_c'] = obj.gd.parsize_c
        data['pbc_c'] = obj.gd.pbc_c
        data['N_c'] = obj.gd.N_c
        data['nao'] = obj.wfs.setups.nao
        data['fine_N_c'] = obj.finegd.N_c
        data['nspins'] = obj.wfs.nspins
        data['fermi'] = obj.get_fermi_level()

        den, ham = obj.density, obj.hamiltonian
        gd = obj.gd
        vt_sG = gd.collect(ham.vt_sG)
        nt_sG = gd.collect(den.nt_sG)
        data['vt_sG'] = vt_sG
        data['nt_sG'] = nt_sG

        finegd = obj.finegd
        vt_sg = finegd.collect(ham.vt_sg)
        nt_sg = finegd.collect(den.nt_sg)
        vHt_g = finegd.collect(ham.vHt_g)
        rhot_g = finegd.collect(den.rhot_g)
        data['vt_sg'] = vt_sg
        data['nt_sg'] = nt_sg
        data['vHt_g'] = vHt_g
        data['rhot_g'] = rhot_g

        D_asp = collect_atomic_matrices(den.D_asp, den.setups,
                                        den.nspins, den.gd.comm,
                                        den.rank_a)
        dH_asp = collect_atomic_matrices(ham.dH_asp, ham.setups,
                                         ham.nspins, ham.gd.comm,
                                         ham.rank_a)
        data['D_asp'] = D_asp
        data['dH_asp'] = dH_asp
        return data
Exemplo n.º 2
0
    def collect_lead_data(self, obj):
        data = {}
        data['bzk_kc'] = obj.wfs.kd.bzk_kc
        #data['bzk_qc'] = obj.wfs.bzk_qc
        data['ibzk_kc'] = obj.wfs.kd.ibzk_kc
        data['ibzk_qc'] = obj.wfs.kd.ibzk_qc
        #data['setups'] = obj.wfs.setups
        data['cell_cv'] = obj.gd.cell_cv
        data['parsize_c'] = obj.gd.parsize_c
        data['pbc_c'] = obj.gd.pbc_c
        data['N_c'] = obj.gd.N_c
        data['nao'] = obj.wfs.setups.nao
        data['fine_N_c'] = obj.finegd.N_c
        data['nspins'] = obj.wfs.nspins
        data['fermi'] = obj.get_fermi_level()

        den, ham = obj.density, obj.hamiltonian
        gd = obj.gd
        vt_sG = gd.collect(ham.vt_sG)
        nt_sG = gd.collect(den.nt_sG)
        data['vt_sG'] = vt_sG
        data['nt_sG'] = nt_sG

        finegd = obj.finegd
        vt_sg = finegd.collect(ham.vt_sg)
        nt_sg = finegd.collect(den.nt_sg)
        vHt_g = finegd.collect(ham.vHt_g)
        rhot_g = finegd.collect(den.rhot_g)
        data['vt_sg'] = vt_sg
        data['nt_sg'] = nt_sg
        data['vHt_g'] = vHt_g
        data['rhot_g'] = rhot_g

        D_asp = collect_atomic_matrices(den.D_asp, den.setups, den.nspins,
                                        den.gd.comm, den.rank_a)
        dH_asp = collect_atomic_matrices(ham.dH_asp, ham.setups, ham.nspins,
                                         ham.gd.comm, ham.rank_a)
        data['D_asp'] = D_asp
        data['dH_asp'] = dH_asp
        return data
Exemplo n.º 3
0
    def abstract_boundary(self):
    #abtract the effective potential, hartree potential, and average density
    #out from the electrode calculation.
        calc = self.atoms.calc
        gd = calc.gd
        finegd = calc.finegd
        nn = finegd.N_c[2]
        ns = calc.wfs.nspins

        dim = gd.N_c
        d1 = dim[0] // 2
        d2 = dim[1] // 2

        vHt_g = finegd.collect(calc.hamiltonian.vHt_g)
        vt_sg = finegd.collect(calc.hamiltonian.vt_sg)
        nt_sg = finegd.collect(calc.density.nt_sg)
        rhot_g = finegd.collect(calc.density.rhot_g)
        vt_sG = gd.collect(calc.hamiltonian.vt_sG)
        nt_sG = gd.collect(calc.density.nt_sG)

        self.boundary_vHt_g = None
        self.boundary_vHt_g1 = None
        self.boundary_vt_sg_line = None
        self.boundary_nt_sg = None
        self.boundary_rhot_g_line = None
        self.boundary_vt_sG = None
        self.boundary_nt_sG = None

        if gd.comm.rank == 0:
            self.boundary_vHt_g = self.slice(nn, vHt_g)
            self.boundary_nt_sg = self.slice(nn, nt_sg)
            if self.direction == '-':
                other_direction= '+'
            else:
                other_direction= '-'
            h = self.h_cz / 2.0
            b_vHt_g0 = self.boundary_vHt_g.copy()
            b_vHt_g1 = self.boundary_vHt_g.copy()

            self.boundary_vHt_g = interpolate_array(b_vHt_g0,
                                                    finegd, h, self.direction)
            self.boundary_vHt_g1 = interpolate_array(b_vHt_g1,
                                                   finegd, h, other_direction)

            vt_sg = interpolate_array(vt_sg, finegd, h, self.direction)
            self.boundary_vt_sg_line =  aa1d(vt_sg)
            self.boundary_nt_sg = interpolate_array(self.boundary_nt_sg,
                                                    finegd, h, self.direction)
            rhot_g = interpolate_array(rhot_g, finegd, h, self.direction)
            self.boundary_rhot_g_line = aa1d(rhot_g)

            nn /= 2
            h *= 2
            self.boundary_vt_sG = self.slice(nn, vt_sG)
            self.boundary_nt_sG = self.slice(nn, nt_sG)
            self.boundary_vt_sG = interpolate_array(self.boundary_vt_sG,
                                                    gd, h, self.direction)
            self.boundary_nt_sG = interpolate_array(self.boundary_nt_sG,
                                                    gd, h, self.direction)

        den, ham = calc.density, calc.hamiltonian
        self.D_asp = collect_atomic_matrices(den.D_asp, den.setups,
                                             den.nspins, den.gd.comm,
                                             den.rank_a)
        self.dH_asp = collect_atomic_matrices(ham.dH_asp, ham.setups,
                                              ham.nspins, ham.gd.comm,
                                              ham.rank_a)

        del self.atoms
Exemplo n.º 4
0
    def abstract_boundary(self):
        #abtract the effective potential, hartree potential, and average density
        #out from the electrode calculation.
        calc = self.atoms.calc
        gd = calc.gd
        finegd = calc.finegd
        nn = finegd.N_c[2]
        ns = calc.wfs.nspins

        dim = gd.N_c
        d1 = dim[0] // 2
        d2 = dim[1] // 2

        vHt_g = finegd.collect(calc.hamiltonian.vHt_g)
        vt_sg = finegd.collect(calc.hamiltonian.vt_sg)
        nt_sg = finegd.collect(calc.density.nt_sg)
        rhot_g = finegd.collect(calc.density.rhot_g)
        vt_sG = gd.collect(calc.hamiltonian.vt_sG)
        nt_sG = gd.collect(calc.density.nt_sG)

        self.boundary_vHt_g = None
        self.boundary_vHt_g1 = None
        self.boundary_vt_sg_line = None
        self.boundary_nt_sg = None
        self.boundary_rhot_g_line = None
        self.boundary_vt_sG = None
        self.boundary_nt_sG = None

        if gd.comm.rank == 0:
            self.boundary_vHt_g = self.slice(nn, vHt_g)
            self.boundary_nt_sg = self.slice(nn, nt_sg)
            if self.direction == '-':
                other_direction = '+'
            else:
                other_direction = '-'
            h = self.h_cz / 2.0
            b_vHt_g0 = self.boundary_vHt_g.copy()
            b_vHt_g1 = self.boundary_vHt_g.copy()

            self.boundary_vHt_g = interpolate_array(b_vHt_g0, finegd, h,
                                                    self.direction)
            self.boundary_vHt_g1 = interpolate_array(b_vHt_g1, finegd, h,
                                                     other_direction)

            vt_sg = interpolate_array(vt_sg, finegd, h, self.direction)
            self.boundary_vt_sg_line = aa1d(vt_sg)
            self.boundary_nt_sg = interpolate_array(self.boundary_nt_sg,
                                                    finegd, h, self.direction)
            rhot_g = interpolate_array(rhot_g, finegd, h, self.direction)
            self.boundary_rhot_g_line = aa1d(rhot_g)

            nn /= 2
            h *= 2
            self.boundary_vt_sG = self.slice(nn, vt_sG)
            self.boundary_nt_sG = self.slice(nn, nt_sG)
            self.boundary_vt_sG = interpolate_array(self.boundary_vt_sG, gd, h,
                                                    self.direction)
            self.boundary_nt_sG = interpolate_array(self.boundary_nt_sG, gd, h,
                                                    self.direction)

        den, ham = calc.density, calc.hamiltonian
        self.D_asp = collect_atomic_matrices(den.D_asp, den.setups, den.nspins,
                                             den.gd.comm, den.rank_a)
        self.dH_asp = collect_atomic_matrices(ham.dH_asp, ham.setups,
                                              ham.nspins, ham.gd.comm,
                                              ham.rank_a)

        del self.atoms