Beispiel #1
0
def test_optimizer(systems, optimizer, calculator, prefix='', db=None,
                   eggbox=0.0):
    """Test optimizer on systems."""

    for name, atoms in systems:
        if db is not None:
            optname = optimizer.__name__
            id = db.reserve(optimizer=optname, name=name)
            if id is None:
                continue
        atoms = atoms.copy()
        tag = '{}{}-{}'.format(prefix, optname, name)
        atoms.calc = calculator(txt=tag + '.txt')
        error, nsteps, texcl, tincl = run_test(atoms, optimizer, tag,
                                               eggbox=eggbox)

        if db is not None:
            db.write(atoms,
                     id=id,
                     optimizer=optname,
                     name=name,
                     error=error,
                     n=nsteps,
                     t=texcl,
                     T=tincl,
                     eggbox=eggbox)
Beispiel #2
0
def test_optimizer(systems, optimizer, calculator, prefix='', db=None):
    for atoms in systems:
        formula = atoms.get_chemical_formula()
        if db is not None:
            optname = optimizer.__name__
            id = db.reserve(optimizer=optname, name=formula)
            if id is None:
                continue
        atoms = atoms.copy()
        tag = '{}{}-{}'.format(prefix, optname, formula)
        atoms.calc = calculator(txt=tag + '.txt')
        error, nsteps, texcl, tincl = run_test(atoms, optimizer, tag)

        if db is not None:
            db.write(atoms,
                     id=id,
                     optimizer=optname,
                     name=formula,
                     error=error,
                     n=nsteps,
                     t=texcl,
                     T=tincl)