Remove old stuff

parent bbb78e65
Pipeline #21494786 passed with stage
in 3 minutes and 10 seconds
from myqueue.job import Job
def workflow():
jobs = [Job('{}@4x13h'.format(i)) for i in range(10)]
return jobs + [Job('', deps=jobs)]
import time
import ase.db
import ase.optimize
from ase.collections import g2
from gpaw import GPAW, Mixer
optimizers = ['BFGS', 'BFGSLineSearch',
'FIRE', 'GoodOldQuasiNewton',
'LBFGS', 'LBFGSLineSearch']
con = ase.db.connect('g2_dzp.db')
for name, atoms in zip(g2.names, g2):
if len(atoms) == 1:
for optimizer in optimizers:
id = con.reserve(name=name, optimizer=optimizer)
if id is None:
mol = atoms.copy()
mol.calc = GPAW(mode='lcao',
mixer=Mixer(0.05, 2),
txt='{0}-{1}.txt'.format(name, optimizer))
Optimizer = getattr(ase.optimize, optimizer)
opt = Optimizer(mol)
t = time.time()
try:, steps=50)
except Exception as ex:
print(name, optimizer, ex)
con.write(mol, name=name, optimizer=optimizer,
steps=opt.nsteps, time=time.time() - t)
del con[id]
# Creates: g2_dzp.csv
from __future__ import print_function
import numpy as np
import ase.db
con = ase.db.connect('g2_dzp.db')
N = 6 # number of optimizers
M = len(con) // N # number of molecules
data = []
for row in
row.get('time', 42),
row.get('steps', 42),
row.get('energy', 42),
row.get('fmax', 42)))
optimizers = [x[0] for x in data[::M]]
data = np.array([x[2:] for x in data]).reshape((N, M, 4))
e0 = data[:, :, 2].min(0)
results = []
for opt, d in zip(optimizers, data):
ok = (d[:, 3] < 0.05) & (d[:, 2] < e0 + 0.1)
failed = M - sum(ok)
time, niter = d[ok, :2].mean(0)
results.append((failed, time, niter, opt))
with open('g2_dzp.csv', 'w') as f:
for failed, time, niter, opt in sorted(results):
print('{0}, {1}, {2:.1f}, {3:.1f}'.format(opt, failed, time, niter),
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