Add __main__ section to script

parent 8032580c
......@@ -3,8 +3,9 @@ from ase import Atoms
from gpaw import GPAW, PW, MixerDif
def agts(queue):
queue.add('cr.agts.py', ncpus=8)
def workflow():
from myqueue.job import Job
return [Job('cr.agts.py', cores=8)]
def angle(a, b):
......@@ -19,28 +20,29 @@ def check(m_av):
assert abs(theta - 120) < 0.5, theta
d = 2.66
atoms = Atoms('Cr3', positions=[(0, 0, 0), (d, 0, 0), (2 * d, 0, 0)],
cell=[[d * 3 / 2, -d * np.sqrt(3) / 2, 0],
[d * 3 / 2, d * np.sqrt(3) / 2, 0],
[0, 0, 6]],
pbc=True)
if __name__ == '__main__':
d = 2.66
atoms = Atoms('Cr3', positions=[(0, 0, 0), (d, 0, 0), (2 * d, 0, 0)],
cell=[[d * 3 / 2, -d * np.sqrt(3) / 2, 0],
[d * 3 / 2, d * np.sqrt(3) / 2, 0],
[0, 0, 6]],
pbc=True)
magmoms = [[3, 3, 0], [3, -1, 0], [-4, 0, 1.0]]
magmoms = [[3, 3, 0], [3, -1, 0], [-4, 0, 1.0]]
calc = GPAW(mode=PW(400),
symmetry='off',
mixer=MixerDif(),
experimental={'magmoms': magmoms},
kpts=(4, 4, 1))
atoms.calc = calc
atoms.get_potential_energy()
calc = GPAW(mode=PW(400),
symmetry='off',
mixer=MixerDif(),
experimental={'magmoms': magmoms},
kpts=(4, 4, 1))
atoms.calc = calc
atoms.get_potential_energy()
_, m_av = calc.density.estimate_magnetic_moments()
check(m_av)
_, m_av = calc.density.estimate_magnetic_moments()
check(m_av)
calc.write('Cr3.gpw')
calc = GPAW('Cr3.gpw', txt=None)
calc.write('Cr3.gpw')
calc = GPAW('Cr3.gpw', txt=None)
_, m_av = calc.density.estimate_magnetic_moments()
check(m_av)
_, m_av = calc.density.estimate_magnetic_moments()
check(m_av)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment