Coverage for gpaw/cli/quick.py: 20%
5 statements
« prev ^ index » next coverage.py v7.7.1, created at 2025-07-19 00:19 +0000
« prev ^ index » next coverage.py v7.7.1, created at 2025-07-19 00:19 +0000
1def quick(project='bulk', system=None):
2 """Create Python script to get going quickly.
4 project: str
5 Must be 'bulk' or 'molecule'.
6 system: str
7 A string representing the system ('H2', 'Si').
8 """
9 if project == 'bulk':
10 template = """\
11from ase.build import bulk
12from gpaw import GPAW
14atoms = bulk('{0}')
15atoms.calc = GPAW(kpts={{'size': (4, 4, 4)}},
16 txt='{0}.txt')
17e = atoms.get_potential_energy()
18f = atoms.get_forces()"""
19 else:
20 template = """\
21from ase.build import molecule
22from ase.optimize import QuasiNewton
23from gpaw import GPAW
25atoms = molecule('{0}')
26atoms.center(vacuum=3.0)
27atoms.calc = GPAW(txt='{0}.txt')
28e = atoms.get_potential_energy()
29opt = QuasiNewton(atoms, trajectory='{0}.traj')
30opt.run(fmax=0.05)"""
31 print(template.format(system))