Example #1
0
def _print_scf_info(scf, out):
    out.write(separator_string('SCF'))
    out.write('maxiter: {}\n'.format(scf.maxiter))
    out.write('density_error_tol (e / # electrons): {}\n'.format(
        scf.density_error_tol))
    out.write('energy_error_tol (eV / # electrons): {}\n'.format(
        scf.energy_error_tol))
Example #2
0
def Setups(atoms, out):
    """Returns dict of {symbol : Setup(symbol)}."""
    out.write(separator_string('Pseudopotentials'))

    setups = dict()
    for s in set(atoms.symbols):
        setups[s] = Setup(s)
        _print_pseudopotential(setups[s], out)

    return setups
Example #3
0
def Setups(atoms, out):
    """Returns dict of {symbol : Setup(symbol)}."""
    out.write(separator_string('Pseudopotentials'))

    setups = dict()
    for s in set(atoms.symbols):
        setups[s] = Setup(s)
        _print_pseudopotential(setups[s], out)

    return setups
Example #4
0
File: scf.py Project: yidapa/lfdft
    def run(self, wfs, hamiltonian, density, fn):
        """
        1)
        update wfs based on hamiltonian
        orthogonalizes if needed           
        2) 
        calculate new density from updated wfs
        mix with previous density            
        
        3) update the hamiltonian based on the new density
        4) update energies and check convergence
        """
        self.out.write(separator_string("SCF LOOP"))
        self.out.write("{} | {} | {} | {} | {}\n".format("iteration", "Q", "Energy", "Density Error", "Energy Error"))
        for i in xrange(1, self.maxiter + 1):
            wfs.iterate(hamiltonian)
            density.update(wfs)
            hamiltonian.update(density)

            if self.converged(i, hamiltonian, wfs, density):
                break
        self.out.write(separator_string())
Example #5
0
    def run(self, wfs, hamiltonian, density, fn):
        """
        1)
        update wfs based on hamiltonian
        orthogonalizes if needed           
        2) 
        calculate new density from updated wfs
        mix with previous density            
        
        3) update the hamiltonian based on the new density
        4) update energies and check convergence
        """
        self.out.write(separator_string('SCF LOOP'))
        self.out.write("{} | {} | {} | {} | {}\n".format(
            'iteration', 'Q', 'Energy', 'Density Error', 'Energy Error'))
        for i in xrange(1, self.maxiter+1):
            wfs.iterate(hamiltonian)
            density.update(wfs)
            hamiltonian.update(density)

            if self.converged(i, hamiltonian, wfs, density):
                break
        self.out.write(separator_string())
Example #6
0
File: scf.py Project: yidapa/lfdft
def _print_scf_info(scf, out):
    out.write(separator_string("SCF"))
    out.write("maxiter: {}\n".format(scf.maxiter))
    out.write("density_error_tol (e / # electrons): {}\n".format(scf.density_error_tol))
    out.write("energy_error_tol (eV / # electrons): {}\n".format(scf.energy_error_tol))
Example #7
0
File: grid.py Project: yidapa/lfdft
def _print_grid(grid, out):
    out.write(separator_string('Grid'))
    out.write('gpts:    {} {} {}\n'.format(*grid.gpts))
    out.write('spacing: {} {} {}\n'.format(*grid.h))
    out.write('vol:     {}\n'.format(grid.vol))
    out.write('N pts:   {}\n'.format(grid.n))
Example #8
0
def _print_grid(grid, out):
    out.write(separator_string('Grid'))
    out.write('gpts:    {} {} {}\n'.format(*grid.gpts))
    out.write('spacing: {} {} {}\n'.format(*grid.h))
    out.write('vol:     {}\n'.format(grid.vol))
    out.write('N pts:   {}\n'.format(grid.n))