Commit 20eee3b2 authored by Ask Hjorth Larsen's avatar Ask Hjorth Larsen

use atoms.calc more

parent afce267e
......@@ -267,7 +267,7 @@ different :mod:`ase.calculators`.
A calculator object *calc* is attached to the atoms like this:
>>> atoms.set_calculator(calc)
>>> atoms.calc = calc
After the calculator has been appropriately setup the energy of the
atoms can be obtained through
......
......@@ -57,7 +57,7 @@ saved in A.traj and B.traj::
neb.interpolate()
# Set calculators:
for image in images[1:4]:
image.set_calculator(MyCalculator(...))
image.calc = MyCalculator(...)
# Optimize:
optimizer = MDMin(neb, trajectory='A2B.traj')
optimizer.run(fmax=0.04)
......@@ -236,7 +236,7 @@ only some of them have a calculator attached::
j = world.rank * n // world.size
for i, image in enumerate(images[1:-1]):
if i == j:
image.set_calculator(EMT())
image.calc = EMT()
Create the NEB object with ``NEB(images, parallel=True)``.
For a complete example using GPAW_, see here_.
......
......@@ -370,7 +370,7 @@ cube of copper containing a vacancy::
['None', 'Exp(A=3)']):
log_calc.label = label
atoms = a0.copy()
atoms.set_calculator(log_calc)
atoms.calc = log_calc
opt = PreconLBFGS(atoms, precon=precon, use_armijo=True)
opt.run(fmax=1e-3)
......@@ -430,7 +430,7 @@ is computed using a standalone force field calculator::
['None', 'FF']):
log_calc.label = label
atoms = a0.copy()
atoms.set_calculator(log_calc)
atoms.calc = log_calc
opt = PreconLBFGS(atoms, precon=precon, use_armijo=True)
opt.run(fmax=1e-4)
......
......@@ -19,7 +19,7 @@ log_calc = LoggingCalculator(EMT())
for precon, label in [(None, 'None'), (Exp(A=3, mu=1.0), 'Exp(A=3)')]:
log_calc.label = label
atoms = a0.copy()
atoms.set_calculator(log_calc)
atoms.calc = log_calc
opt = PreconLBFGS(atoms, precon=precon, use_armijo=True)
opt.run(fmax=1e-3)
......
......@@ -11,7 +11,7 @@ atoms = crystal('Au', (0., 0., 0.),
cellpar=[a, a, a, 90, 90, 90],
pbc=(1, 1, 1))
calc = EMT()
atoms.set_calculator(calc)
atoms.calc = calc
qn = QuasiNewton(atoms)
qn.run(fmax=0.05)
potentialenergy = atoms.get_potential_energy()
......
......@@ -5,7 +5,7 @@ from ase.vibrations import Vibrations
from ase.thermochemistry import IdealGasThermo
atoms = molecule('N2')
atoms.set_calculator(EMT())
atoms.calc = EMT()
dyn = QuasiNewton(atoms)
dyn.run(fmax=0.01)
potentialenergy = atoms.get_potential_energy()
......
......@@ -9,11 +9,11 @@ d = 1.10
slab = fcc111('Cu', size=(4, 4, 2), vacuum=10.0)
slab.set_calculator(EMT())
slab.calc = EMT()
e_slab = slab.get_potential_energy()
molecule = Atoms('2N', positions=[(0., 0., 0.), (0., 0., d)])
molecule.set_calculator(EMT())
molecule.calc = EMT()
e_N2 = molecule.get_potential_energy()
add_adsorbate(slab, molecule, h, 'ontop')
......
......@@ -57,8 +57,8 @@ We can attach a calculator to the previously created
:class:`~ase.Atoms` objects::
>>> from ase.calculators.emt import EMT
>>> slab.set_calculator(EMT())
>>> molecule.set_calculator(EMT())
>>> slab.calc = EMT()
>>> molecule.calc = EMT()
and use it to calculate the total energies for the systems by using
the :meth:`~ase.Atoms.get_potential_energy` method from the
......
......@@ -22,7 +22,7 @@ logo.center()
if 1:
from gpaw import GPAW
calc = GPAW()
logo.set_calculator(calc)
logo.calc = calc
e = logo.get_potential_energy()
calc.write('logo2.gpw')
if 0:
......
from ase import Atoms
from ase.calculators.emt import EMT
atom = Atoms('N', calculator=EMT())
atom = Atoms('N')
atom.calc = EMT()
e_atom = atom.get_potential_energy()
d = 1.1
molecule = Atoms('2N', [(0., 0., 0.), (0., 0., d)])
molecule.set_calculator(EMT())
molecule.calc = EMT()
e_molecule = molecule.get_potential_energy()
e_atomization = e_molecule - 2 * e_atom
......
......@@ -21,7 +21,7 @@ N2mol = Atoms('N2',positions=[[0.0,0.0,0.0],[0.5*3**0.5*d,0.5*d,0.0]])
add_adsorbate(slab,N2mol,height=1.0,position='fcc')
# Use the EMT calculator for the forces and energies:
slab.set_calculator(EMT())
slab.calc = EMT()
# We don't want to worry about the Cu degrees of freedom,
# so fix these atoms:
......
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