Esempio n. 1
0
    def abstract_boundary(self):
        # Abtract the effective potential, hartree potential, and average density
        #out from the electrode calculation.
        map = {'-': '0', '+': '1'}
	data = self.tio.read_data(filename='Lead_' + 
	                          map[self.direction], option='Lead')
        nn = data['fine_N_c'][2]
	ns = data['nspins']
        N_c = data['N_c']
	cell_cv = data['cell_cv']
	pbc_c = data['pbc_c']
	#parsize_c = data['parsize_c']
        if type(parsize_domain) is int:
            parsize_c = None
            assert parsize_domain == self.domain_comm.size
        else:
            parsize_c = parsize_domain
        if parsize_c is None:
            parsize_c = decompose_domain(N_c, self.domain_comm.size)
        parsize_c = np.array(parsize_c)
        d1 = N_c[0] // 2
        d2 = N_c[1] // 2
       
        vHt_g = data['vHt_g']
        vt_sg = data['vt_sg']
        nt_sg = data['nt_sg']
        rhot_g = data['rhot_g']
        vt_sG = data['vt_sG']
        nt_sG = data['nt_sG']
        self.D_asp = data['D_asp']
	self.dH_asp = data['dH_asp']
        gd = GridDescriptor(N_c, cell_cv, pbc_c, self.domain_comm, parsize_c)
	finegd = gd.refine()
	
        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 self.tio.domain_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)
Esempio n. 2
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
Esempio n. 3
0
    def abstract_boundary(self):
        # Abtract the effective potential, hartree potential, and average density
        #out from the electrode calculation.
        map = {'-': '0', '+': '1'}
        data = self.tio.read_data(filename='Lead_' + map[self.direction],
                                  option='Lead')
        nn = data['fine_N_c'][2]
        ns = data['nspins']
        N_c = data['N_c']
        cell_cv = data['cell_cv']
        pbc_c = data['pbc_c']
        #parsize_c = data['parsize_c']
        if type(parsize_domain) is int:
            parsize_c = None
            assert parsize_domain == self.domain_comm.size
        else:
            parsize_c = parsize_domain
        if parsize_c is None:
            parsize_c = decompose_domain(N_c, self.domain_comm.size)
        parsize_c = np.array(parsize_c)
        d1 = N_c[0] // 2
        d2 = N_c[1] // 2

        vHt_g = data['vHt_g']
        vt_sg = data['vt_sg']
        nt_sg = data['nt_sg']
        rhot_g = data['rhot_g']
        vt_sG = data['vt_sG']
        nt_sG = data['nt_sG']
        self.D_asp = data['D_asp']
        self.dH_asp = data['dH_asp']
        gd = GridDescriptor(N_c, cell_cv, pbc_c, self.domain_comm, parsize_c)
        finegd = gd.refine()

        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 self.tio.domain_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)
Esempio 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