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.

translate(displacement)<br />

Translate atomic positions.<br />

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

The displacement argument can be a float an xyz vector or an nx3 array (where n is the number of<br />

atoms).<br />

write(filename, format=None, **kwargs)<br />

Write yourself to a file.<br />

7.2 The Atom object<br />

<strong>ASE</strong> defines a python class called Atom to setup and handle atoms in electronic structure and molecular simulations.<br />

From a python script, atoms can be created like this:<br />

>>> from ase import Atom<br />

>>> a1 = Atom(’Si’, (0, 0, 0))<br />

>>> a2 = Atom(’H’, (1.3, 0, 0), mass=2)<br />

>>> a3 = Atom(position=(0, 0, 0), Z=14) # same is a1<br />

class ase.atom.Atom(symbol=’X’, position=(0, 0, 0), tag=None, momentum=None, mass=None, magmom=None,<br />

charge=None, atoms=None, index=None)<br />

Class for representing a single atom.<br />

Parameters:<br />

symbol: str or int Can be a chemical symbol (str) or an atomic number (int).<br />

position: sequence of 3 floats Atomi position.<br />

tag: int Special purpose tag.<br />

momentum: sequence of 3 floats Momentum for atom.<br />

mass: float Atomic mass in atomic units.<br />

magmom: float or 3 floats Magnetic moment.<br />

charge: float Atomic charge.<br />

The first argument to the constructor of an Atom object is the chemical symbol, and the second argument is the<br />

position in Å units (see units). The position can be any numerical sequence of length three. The properties of<br />

an atom can also be set using keywords like it is done in the a2 and a3 examples above.<br />

More examples:<br />

>>> a = Atom(’O’, charge=-2)<br />

>>> b = Atom(8, charge=-2)<br />

>>> c = Atom(’H’, (1, 2, 3), magmom=1)<br />

>>> print a.charge, a.position<br />

-2 [ 0. 0. 0.]<br />

>>> c.x = 0.0<br />

>>> c.position<br />

array([ 0., 2., 3.])<br />

>>> b.symbol<br />

’O’<br />

>>> c.tag = 42<br />

>>> c.number<br />

1<br />

>>> c.symbol = ’Li’<br />

>>> c.number<br />

3<br />

If the atom object belongs to an Atoms object, then assigning values to the atom attributes will change the corresponding<br />

arrays of the atoms object:<br />

7.2. The Atom object 65

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

Saved successfully!

Ooh no, something went wrong!