def _read(self, tar, reads, ws):
        BaseInducedField._read(self, tar, reads, ws)
        
        # Test time
        time = tar['time']
        if abs(time - self.time) >= 1e-9:
            raise IOError('Timestamp is incompatible with calculator.')

        # Allocate
        self.allocate()

        # Read arrays
        if 'n0' in reads:
            big_g = tar.get('n0_G')
            self.gd.distribute(big_g, self.n0_G)
        
        if 'Fn' in reads:
            for w, wread in enumerate(ws):
                big_g = tar.get('Fn_wsG', wread)
                self.gd.distribute(big_g, self.Fn_wsG[w])
        
        if 'eps0' in reads:
            self.eps0_G = self.gd.empty(dtype=float)
            big_g = tar.get('eps0_G')
            self.gd.distribute(big_g, self.eps0_G)
        else:
            self.eps0_G = None
Exemplo n.º 2
0
    def _read(self, tar, reads, ws):
        BaseInducedField._read(self, tar, reads, ws)

        # Test time
        time = tar['time']
        if abs(time - self.time) >= 1e-9:
            raise IOError('Timestamp is incompatible with calculator.')

        # Allocate
        self.allocate()

        # Dimensions for D_p for all atoms
        self.np_a = {}
        for a in range(self.na):
            if self.domain_comm.rank == self.rank_a[a]:
                self.np_a[a] = np.array(tar.dimension('np_%d' % a))

        # Read arrays
        if 'n0t' in reads:
            for s in range(self.nspins):
                big_g = tar.get('n0t_sG', s)
                self.gd.distribute(big_g, self.n0t_sG[s])

        if 'Fnt' in reads:
            for w, wread in enumerate(ws):
                for s in range(self.nspins):
                    big_g = tar.get('Fnt_wsG', wread, s)
                    self.gd.distribute(big_g, self.Fnt_wsG[w][s])

        if 'D0' in reads:
            self.D0_asp = {}
            for a in range(self.na):
                if self.domain_comm.rank == self.rank_a[a]:
                    self.D0_asp[a] = tar.get('D0_%dsp' % a)

        if 'FD' in reads:
            self.FD_awsp = {}
            for a in range(self.na):
                if self.domain_comm.rank == self.rank_a[a]:
                    self.FD_awsp[a] = tar.get('FD_%dwsp' % a)[ws]
    def _read(self, tar, reads, ws):
        BaseInducedField._read(self, tar, reads, ws)
        
        # Test time
        time = tar['time']
        if abs(time - self.time) >= 1e-9:
            raise IOError('Timestamp is incompatible with calculator.')

        # Allocate
        self.allocate()

        # Dimensions for D_p for all atoms
        self.np_a = {}
        for a in range(self.na):
            if self.domain_comm.rank == self.rank_a[a]:
                self.np_a[a] = np.array(tar.dimension('np_%d' % a))

        # Read arrays
        if 'n0t' in reads:
            for s in range(self.nspins):
                big_g = tar.get('n0t_sG', s)
                self.gd.distribute(big_g, self.n0t_sG[s])
        
        if 'Fnt' in reads:
            for w, wread in enumerate(ws):
                for s in range(self.nspins):
                    big_g = tar.get('Fnt_wsG', wread, s)
                    self.gd.distribute(big_g, self.Fnt_wsG[w][s])
        
        if 'D0' in reads:
            self.D0_asp = {}
            for a in range(self.na):
                if self.domain_comm.rank == self.rank_a[a]:
                    self.D0_asp[a] = tar.get('D0_%dsp' % a)
        
        if 'FD' in reads:
            self.FD_awsp = {}
            for a in range(self.na):
                if self.domain_comm.rank == self.rank_a[a]:
                    self.FD_awsp[a] = tar.get('FD_%dwsp' % a)[ws]
Exemplo n.º 4
0
    def _read(self, reader, reads):
        BaseInducedField._read(self, reader, reads)

        r = reader
        time = r.time
        if self.has_paw:
            # Test time
            if abs(time - self.time) >= 1e-9:
                raise IOError('Timestamp is incompatible with calculator.')
        else:
            self.time = time

        # Allocate
        self.allocate()

        # Dimensions for D_p for all atoms
        self.np_a = r.np_a

        def readarray(name):
            if name.split('_')[0] in reads:
                self.gd.distribute(r.get(name), getattr(self, name))

        # Read arrays
        readarray('n0t_sG')
        readarray('Fnt_wsG')

        if 'D0' in reads:
            D0_asp = r.D0_asp
            self.D0_asp = {}
            for a in range(self.na):
                if self.domain_comm.rank == self.rank_a[a]:
                    self.D0_asp[a] = D0_asp[a]

        if 'FD' in reads:
            FD_awsp = r.FD_awsp
            self.FD_awsp = {}
            for a in range(self.na):
                if self.domain_comm.rank == self.rank_a[a]:
                    self.FD_awsp[a] = FD_awsp[a]
Exemplo n.º 5
0
    def _read(self, reader, reads):
        BaseInducedField._read(self, reader, reads)

        # Test time
        r = reader
        time = r.time
        if self.has_paw:
            # Test time
            if abs(time - self.time) >= 1e-9:
                raise IOError('Timestamp is incompatible with calculator.')
        else:
            self.time = time

        # Allocate
        self.allocate()

        def readarray(name):
            if name.split('_')[0] in reads:
                self.gd.distribute(r.get(name), getattr(self, name))

        # Read arrays
        readarray('n0_G')
        readarray('Fn_wG')
        readarray('eps0_G')