18.11.2012 Views

ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki

ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki

ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

update(atoms)<br />

Make sure the list is up to date.<br />

7.15 Constraints<br />

<strong>ASE</strong> <strong>Manual</strong>, <strong>Release</strong> 3.6.1.2828<br />

When performing minimizations or dynamics one may wish to keep some degrees of freedom in the system fixed.<br />

One way of doing this is by attaching constraint object(s) directly to the atoms object.<br />

Important: setting constraints will freeze the corresponding atom positions. Changing such atom positions can be<br />

achieved:<br />

• by directly setting the positions attribute (see example of setting Special attributes),<br />

• alternatively, by removing the constraints first:<br />

del atoms.constraints<br />

or:<br />

atoms.set_constraint()<br />

and using the set_positions() method.<br />

7.15.1 The FixAtoms class<br />

This class is used for fixing some of the atoms.<br />

class constraints.FixAtoms(indices=None, mask=None)<br />

You must supply either the indices of the atoms that should be fixed or a mask. The mask is a list of booleans, one<br />

for each atom, being true if the atoms should be kept fixed.<br />

For example, to fix the positions of all the Cu atoms in a simulation with the indices keyword:<br />

>>> c = FixAtoms(indices=[atom.index for atom in atoms if atom.symbol == ’Cu’])<br />

>>> atoms.set_constraint(c)<br />

or with the mask keyword:<br />

>>> c = FixAtoms(mask=[atom.symbol == ’Cu’ for atom in atoms])<br />

>>> atoms.set_constraint(c)<br />

7.15.2 The FixBondLength class<br />

This class is used to fix the distance between two atoms specified by their indices (a1 and a2)<br />

class constraints.FixBondLength(a1, a2)<br />

Example of use:<br />

>>> c = FixBondLength(0, 1)<br />

>>> atoms.set_constraint(c)<br />

In this example the distance between the atoms with indices 0 and 1 will be fixed in all following dynamics and/or<br />

minimizations performed on the atoms object.<br />

This constraint is useful for finding minimum energy barriers for reactions where the path can be described well<br />

by a single bond length (see the Dissociation tutorial).<br />

Important: If fixing multiple bond lengths, use the FixBondLengths class below, particularly if the same atom is<br />

fixed to multiple partners.<br />

7.15. Constraints 139

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!