def __init__(self, dft_obj):
     self.dft_obj = dft_obj
     self.kset = dft_obj.k_point_set()
     potential = dft_obj.potential()
     density = dft_obj.density()
     # Hamiltonian, provides gradient H|Ψ>
     self.H = ApplyHamiltonian(potential, self.kset)
     # create object to compute the total energy
     self.E = Energy(self.kset, potential, density, self.H)
    def __init__(self, dft_obj):
        from sirius.edft import FreeEnergy, make_fermi_dirac_smearing
        self.dft_obj = dft_obj
        self.kset = dft_obj.k_point_set()
        potential = dft_obj.potential()
        density = dft_obj.density()
        self.H = ApplyHamiltonian(potential, self.kset)
        # create object to compute the total energy
        self.E = Energy(self.kset, potential, density, self.H)

        # initialize free energy functional
        T = 300
        ctx = self.kset.ctx()
        smearing = make_fermi_dirac_smearing(T, ctx, self.kset)
        self.M = FreeEnergy(E=self.E, T=T, smearing=smearing)
示例#3
0
def initial_state(sirius_input, nscf):
    from sirius import DFT_ground_state_find
    res = DFT_ground_state_find(nscf, config=sirius_input)
    ctx = res['ctx']
    m = ctx.max_occupancy()
    # not yet implemented for single spin channel system
    # assert m == 1
    kset = res['kpointset']
    potential = res['potential']
    density = res['density']
    H = ApplyHamiltonian(potential, kset)
    E = Energy(kset, potential, density, H)

    fn = kset.fn
    X = kset.C

    return X, fn, E, ctx, kset
示例#4
0
logger('precond            :', args.precond)
logger('tolerance          :', args.tol)

np.set_printoptions(precision=4, linewidth=120)

res = DFT_ground_state_find(args.nscf, config=args.input)
ctx = res['ctx']
m = ctx.max_occupancy()
# not yet implemented for single spin channel system

assert m == 1
kset = res['kpointset']
potential = res['potential']
density = res['density']
hamiltonian = res['hamiltonian']
H = ApplyHamiltonian(hamiltonian, kset)
E = Energy(kset, potential, density, H)
T = args.T
kT = kb*T
nel = ctx.unit_cell().num_valence_electrons()
smearing = GaussianSplineSmearing(T=T, nel=nel, nspin=2, kw=kset.w)
# smearing = RegularizedFermiDiracSmearing(T=T, nel=nel, nspin=2, kw=kset.w)

fn = kset.fn
X = kset.C

M = FreeEnergy(H=H, E=E, T=T, smearing=smearing)
cg = CG(M, fd_slope_check=args.check_slope)
tstart = time.time()
FE, X, fn, success = cg.run(X, fn,
                            maxiter=args.maxiter,
示例#5
0
logger('CG update          : ', _cgnames[args.cg_type])
logger('Wfct prec          : ', args.eps)
logger('kappa              : ', args.kappa)
logger('nscf               : ', args.nscf)

np.set_printoptions(precision=4, linewidth=120)

res = DFT_ground_state_find(args.nscf, config=args.input)
ctx = res['ctx']
m = ctx.max_occupancy()
# not yet implemented for single spin channel system
assert m == 1
kset = res['kpointset']
potential = res['potential']
density = res['density']
E = Energy(kset, potential, density, ApplyHamiltonian(potential, kset))
T = args.T
kT = kb * T

fn = kset.fn
X = kset.C

# smearing = make_fermi_dirac_smearing(T, ctx, kset)
smearing = make_gaussian_spline_smearing(T, ctx, kset)
M = FreeEnergy(E=E, T=T, smearing=smearing)
cg = CG(M)
tstart = time.time()


def callback(kset, interval=50, **kwargs):
    def _callback(fn, it, **kwargs):
示例#6
0
logger('num inner          :', args.ni)
logger('precond            :', args.precond)
logger('tolerance          :', args.tol)

np.set_printoptions(precision=4, linewidth=120)

res = DFT_ground_state_find(args.nscf, config=args.input)
ctx = res['ctx']
m = ctx.max_occupancy()
# not yet implemented for single spin channel system

assert m == 1
kset = res['kpointset']
potential = res['potential']
density = res['density']
H = ApplyHamiltonian(potential, kset)
E = Energy(kset, potential, density, H)
T = args.T
kT = kb * T
nel = ctx.unit_cell().num_valence_electrons()
smearing = GaussianSplineSmearing(T=T, nel=nel, nspin=2, kw=kset.w)
# smearing = RegularizedFermiDiracSmearing(T=T, nel=nel, nspin=2, kw=kset.w)

fn = kset.fn
X = kset.C

M = FreeEnergy(E=E, T=T, smearing=smearing)
cg = CG(M, fd_slope_check=args.check_slope)
tstart = time.time()
FE, X, fn, success = cg.run(X,
                            fn,