def cycle(filename="19.json", start=-1.10, stop=-1.80, step=0.05, atom=1, position=2, baselabel='xx'): cnt = 0 with open(filename) as fh: b = fh.read() d = json.loads(b) status = start while status >= stop: d['xyz'][atom][position] = status pprint(d['xyz']) label = str(status).replace('-', '') label = label.replace('.', '_') label = label[:6] print("this step: {}".format(status)) x = execution(d) x.run(baselabel + label) cnt += 1 status = step print("cycle() completed with {} executions.".format(cnt))
''' import json from auto import execution, frange from pprint import pprint as p import gpaw inFile = '01.json' with open(inFile, 'rb') as f: j = json.loads(f.read()) p(j) for _s in frange(2.38, 2.65, 0.01): j['xyz'][3] = ['C', _s, 0.0, 0.0] x = execution(j) p(x.inp) p(x.gpts) try: x.run(str(_s)) p(x.atoms.get_forces()) except gpaw.KohnShamConvergenceError: pass ## EOF ##