예제 #1
0
    def get_wavefunction012(self, ss, nn, ll):
        """Returns radial wave function and its first and second derivatives.

        Returns
        -------
        density : GridData
           Grid data with the wavefunction and its first and second derivatives.
        """
        if ss == 0:
            formstr = "wave_{:02d}{:s}_up.dat"
        else:
            formstr = "wave_{:02d}{:s}_dn.dat"
        wavefile = formstr.format(nn, sc.ANGMOM_TO_SHELL[ll])
        wavefile = os.path.join(self._workdir, wavefile)
        if not os.path.exists(wavefile):
            raise sc.SkgenException("Missing wave function file " + wavefile)
        fp = open(wavefile, "r")
        fp.readline()
        fp.readline()
        ngrid = int(fp.readline())
        fp.readline()
        # noinspection PyNoneFunctionAssignment,PyTypeChecker
        wavefunc = np.fromfile(fp, dtype=float, count=5 * ngrid, sep=" ")
        wavefunc.shape = (ngrid, 5)
        grid = oc.RadialGrid(wavefunc[:, 0], wavefunc[:, 1])
        wfcs = wavefunc[:, 2:5]
        return oc.GridData(grid, wfcs)
예제 #2
0
    def get_potentials(self):
        """Returns various potential components of the atom

        Returns
        -------
        potentials : GridData
           Grid data with following potentials:
           nuclear, coulomb, xc-spinup, xc-spindown.
        """
        fp = open(os.path.join(self._workdir, "pot.dat"), "r")
        fp.readline()
        fp.readline()
        ngrid = int(fp.readline())
        # noinspection PyNoneFunctionAssignment,PyTypeChecker
        pots = np.fromfile(fp, dtype=float, count=ngrid * 6, sep=" ")
        fp.close()
        pots.shape = (ngrid, 6)
        grid = oc.RadialGrid(pots[:, 0], pots[:, 1])
        potentials = pots[:, 2:6]
        return oc.GridData(grid, potentials)
예제 #3
0
    def get_density012(self):
        """Returns the radial density and its first and second derivatives.

        Returns
        -------
        density : GridData
           Grid data with the density and its first and second derivatives.
        """
        fp = open(os.path.join(self._workdir, "dens.dat"), "r")
        fp.readline()
        fp.readline()
        fp.readline()
        fp.readline()
        fp.readline()
        ngrid = int(fp.readline())
        # noinspection PyNoneFunctionAssignment,PyTypeChecker
        dens = np.fromfile(fp, dtype=float, count=ngrid * 7, sep=" ")
        fp.close()
        dens.shape = (ngrid, 7)
        grid = oc.RadialGrid(dens[:, 0], dens[:, 1])
        density = dens[:, 2:5]
        return oc.GridData(grid, density)