Exemple #1
0
write('initial.traj', initial)

# Create final state
final = initial.copy()
final.positions[2:5] = initial.positions[[3, 4, 2]]
write('final.traj', final)

# Generate blank images
images = [initial]
nimage = 7

for i in range(nimage):
    images.append(initial.copy())

images.append(final)

# Run IDPP interpolation
neb = NEB(images)
neb.interpolate()

calcs = NEBEspresso(neb, kpts='gamma', pw=300, dw=4000)

# Run NEB calculation
qn = QuasiNewton(neb, logfile='ethane_linear.log')

for j in range(nimage):
    traj = Trajectory('neb%d.traj' % j, 'w', images[j + 1])
    qn.attach(traj)

qn.run(fmax=0.05)
Exemple #2
0
    neb.write('%s-eval.xyz' % basename)
elif not opt.dry_run:
    # Optimize:
    if opt.optimizer == 'FIRE':
        from ase.optimize.fire import FIRE
        optimizer = FIRE(neb)
    elif opt.optimizer == 'MDMin':
        from ase.optimize import MDMin
        optimizer = MDMin(neb)
    else:
        p.error('Unknown optimizer %s' % opt.optimizer)

    if opt.write_traj is not None:

        def write_traj():
            global neb
            n = 0
            while os.path.exists('%s-band-%d.xyz' % (basename, n)):
                n += 1
            neb.write('%s-band-%d.xyz' % (basename, n))

        optimizer.attach(write_traj, interval=opt.write_traj)

    optimizer.run(fmax=opt.fmax)
    if os.path.exists('%s-optimized.xyz' % basename):
        os.unlink('%s-optimized.xyz' % basename)
    neb.write('%s-optimized.xyz' % basename)

if opt.plot:
    neb.plot(color=opt.plot_color, label=opt.plot_label)
Exemple #3
0
                t=traj):  # store a reference to atoms in the definition.
    """Function to print the potential, kinetic and total energy."""
    epot = a.get_potential_energy() / len(a)
    ekin = a.get_kinetic_energy() / len(a)

    stddev = hdt.evtokcal * a.calc.stddev

    print('Step: %d Energy per atom: Epot = %.3feV  Ekin = %.3feV (T=%3.0fK)  '
          'Etot = %.3feV'
          ' StdDev = %.3fKcal/mol/atom' %
          (d.get_number_of_steps(), epot, ekin, ekin /
           (1.5 * units.kB), epot + ekin, stddev))


# Attach the printer
dyn.attach(storeenergy, interval=250)
#dyn.attach(printenergy, interval=1)

# Run production
print('Running production...')
#start_time = time.time()
#for i in range(int(T)):
#    print('Set temp:',i,'K')
#    dyn.set_temperature(float(i) * units.kB)
#    dyn.run(50)

mol.calc.nc_time = 0.0

dyn.set_temperature(T * units.kB)
start_time = time.time()
dyn.run(steps)