Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#!/bin/env python
import gc
from import bulk, cut
from gpaw import GPAW, mpi
my_comm =[])
my_output = "log_%d" %
def chunker(seq, size):
return (seq[pos:pos + size] for pos in range(0, len(seq), size))
calculations = []
for i in range(100):
b = bulk("GaP", crystalstructure="zincblende", cubic=True, a=5.4504)
cell = cut(b, a=(2,0,0), b=(0,2,0), c=(0,0,1))
cell.set_pbc((True, True, False))
pos = cell.positions.copy()
cell.positions[:,2] = pos[:,2]
for ichunk, group in enumerate(chunker(calculations,
if < len(group):
calc = GPAW(mode='pw', xc='LDA', h=0.3, communicator=my_comm, txt=my_output)
atoms = group[].copy()
print("Success!", ichunk,, atoms.get_potential_energy())
del atoms
del calc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment