Esempio n. 1
0
def test_autoneb(asap3):
    EMT = asap3.EMT
    fmax = 0.02

    # Pt atom adsorbed in a hollow site:
    slab = fcc211('Pt', size=(3, 2, 2), vacuum=4.0)
    add_adsorbate(slab, 'Pt', 0.5, (-0.1, 2.7))

    # Fix second and third layers:
    slab.set_constraint(FixAtoms(range(6, 12)))

    # Use EMT potential:
    slab.calc = EMT()

    # Initial state:
    qn = QuasiNewton(slab, trajectory='neb000.traj')
    qn.run(fmax=fmax)

    # Final state:
    slab[-1].x += slab.get_cell()[0, 0]
    slab[-1].y += 2.8
    qn = QuasiNewton(slab, trajectory='neb001.traj')
    qn.run(fmax=fmax)

    # Stops PermissionError on Win32 for access to
    # the traj file that remains open.
    del qn

    def attach_calculators(images):
        for i in range(len(images)):
            images[i].calc = EMT()

    autoneb = AutoNEB(attach_calculators,
                      prefix='neb',
                      optimizer='BFGS',
                      n_simul=3,
                      n_max=7,
                      fmax=fmax,
                      k=0.5,
                      parallel=False,
                      maxsteps=[50, 1000])
    autoneb.run()

    nebtools = NEBTools(autoneb.all_images)
    assert abs(nebtools.get_barrier()[0] - 0.937) < 1e-3
Esempio n. 2
0
# Final state:
slab[-1].x += slab.get_cell()[0, 0]
slab[-1].y += 2.8
qn = QuasiNewton(slab, trajectory='neb001.traj')
qn.run(fmax=0.05)

# Stops PermissionError on Win32 for access to
# the traj file that remains open.
del qn


def attach_calculators(images):
    for i in range(len(images)):
        images[i].set_calculator(EMT())


autoneb = AutoNEB(attach_calculators,
                  prefix='neb',
                  optimizer='BFGS',
                  n_simul=3,
                  n_max=7,
                  fmax=0.05,
                  k=0.5,
                  parallel=False,
                  maxsteps=[50, 1000])
autoneb.run()

nebtools = NEBTools(autoneb.all_images)
assert abs(nebtools.get_barrier()[0] - 0.938) < 1e-3
Esempio n. 3
0
    nim = len(images)
    n = size // nim  # number of cpu's per image
    j = rank // n  # image number
    assert nim * n == size

    for i in range(nim):
        ranks = range(i * n, (i + 1) * n)
        if rank in ranks:
            calc = getcalc(txt='neb%d.txt' % j, communicator=ranks)
            images[i].set_calculator(calc)


autoneb = AutoNEB(attach_calculators,
                  prefix='neb',
                  n_simul=2,
                  parallel=True,
                  climb=True,
                  n_max=5,
                  optimizer='FIRE',
                  fmax=0.05,
                  k=0.5,
                  maxsteps=[25, 1000])
autoneb.run()

nebtools = NEBtools(autoneb.all_images)
barrier, delta_e = nebtools.get_barrier()
print('barrier', barrier)
ref = 0.74051020956857272  # 1.484 <- with better parameters
err = abs(barrier - ref)
assert err < 1e-3, 'barrier={}, expected={}, err={}'.format(barrier, ref, err)
Esempio n. 4
0
qn.run(fmax=0.05)

# Final state:
slab[-1].x += slab.get_cell()[0, 0]
slab[-1].y += 2.8
qn = QuasiNewton(slab, trajectory='neb001.traj')
qn.run(fmax=0.05)

# Stops PermissionError on Win32 for access to
# the traj file that remains open.
del qn


def attach_calculators(images):
    for i in range(len(images)):
        images[i].set_calculator(EMT())


autoneb = AutoNEB(attach_calculators,
                  prefix='neb',
                  n_simul=3,
                  n_max=7,
                  fmax=0.05,
                  k=0.5,
                  parallel=False,
                  maxsteps=[50, 1000])
autoneb.run()

nebtools = NEBTools(autoneb.all_images)
assert abs(nebtools.get_barrier()[0] - 0.938) < 1e-3