How to use the gpaw.PW function in gpaw

To help you get started, we’ve selected a few gpaw examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pyiron / pyiron / pyiron / gpaw / gpaw.py View on Github external
def run_if_interactive(self):
        if self.structure.calc is None:
            kpoints = self.input["kpoints"]
            if isinstance(kpoints, str):
                kpoints = (
                    self.input["kpoints"].replace("[", "").replace("]", "").split()
                )
            self._create_working_directory()
            calc = GPAW(
                mode=PW(float(self.input["encut"])),
                xc=self.input["potential"],
                occupations=MethfesselPaxton(width=float(self.input["sigma"])),
                kpts=kpoints,
                txt=self.working_directory + "/" + self.job_name + ".txt",
            )
            self.structure.set_calculator(calc)
        self.status.running = True
        self.structure.calc.calculate(self.structure)
        self.interactive_collect()
github rosswhitfield / ase / doc / gettingstarted / tut06_database / solution / solution.py View on Github external
from ase.dft.bandgap import bandgap
from gpaw import GPAW, PW


if Path('database.db').is_file():
    Path('database.db').unlink()

structures = ['Si', 'Ge', 'C']
db = connect('database.db')

for f in structures:
    db.write(bulk(f))

for row in db.select():
    atoms = row.toatoms()
    calc = GPAW(mode=PW(400),
                kpts=(4, 4, 4),
                txt=f'{row.formula}-gpaw.txt', xc='LDA')
    atoms.calc = calc
    atoms.get_stress()
    filter = ExpCellFilter(atoms)
    opt = BFGS(filter)
    opt.run(fmax=0.05)
    db.write(atoms=atoms, relaxed=True)


for row in db.select(relaxed=True):
    atoms = row.toatoms()
    calc = GPAW(mode=PW(400),
                kpts=(4, 4, 4),
                txt=f'{row.formula}-gpaw.txt', xc='LDA')
    atoms.calc = calc
github rosswhitfield / ase / doc / gettingstarted / tut04_bulk / solution / bulk_part1_groundstate.py View on Github external
from ase.build import bulk
from gpaw import GPAW, PW

atoms = bulk('Ag')
calc = GPAW(mode=PW(350), kpts=[8, 8, 8], txt='gpaw.bulk.Ag.txt',
            setups={'Ag': '11'})
atoms.calc = calc
atoms.get_potential_energy()
calc.write('bulk.Ag.gpw')
github rosswhitfield / ase / doc / gettingstarted / tut04_bulk / solution / bulk_part4_cellopt.py View on Github external
from ase.constraints import ExpCellFilter
from ase.io import write
from ase.optimize import BFGS
from ase.spacegroup import crystal
from gpaw import GPAW, PW

a = 4.6
c = 2.95

# Rutile TiO2:
atoms = crystal(['Ti', 'O'], basis=[(0, 0, 0), (0.3, 0.3, 0.0)],
                spacegroup=136, cellpar=[a, a, c, 90, 90, 90])
write('rutile.traj', atoms)

calc = GPAW(mode=PW(800), kpts=[2, 2, 3],
            txt='gpaw.rutile.txt')
atoms.calc = calc

opt = BFGS(ExpCellFilter(atoms), trajectory='opt.rutile.traj')
opt.run(fmax=0.05)

calc.write('groundstate.rutile.gpw')

print('Final lattice:')
print(atoms.cell.get_bravais_lattice())
github rosswhitfield / ase / doc / ase / calculators / dftd3_gpaw.py View on Github external
import numpy as np
from gpaw import GPAW, PW

from ase.calculators.dftd3 import DFTD3
from ase.build import bulk
from ase.constraints import UnitCellFilter

from ase.optimize import LBFGS

np.random.seed(0)

diamond = bulk('C')
diamond.rattle(stdev=0.1, seed=0)
diamond.cell += np.random.normal(scale=0.1, size=(3,3))
dft = GPAW(xc='PBE', kpts=(8,8,8), mode=PW(400))
d3 = DFTD3(dft=dft)
diamond.calc = d3

ucf = UnitCellFilter(diamond)

opt = LBFGS(ucf, logfile='diamond_opt.log', trajectory='diamond_opt.traj')
opt.run(fmax=0.05)