module ase.atoms
<html><head><title>Python: module ase.atoms</title></head><body bgcolor=“#f0f0f8”><br> <br> <p> <table summary=“section” border=“0” cellpadding=“2” cellspacing=“0” width=“100%”> <tbody>
<tr><td> </td> <td width=“100%”><br> <dl> <dd> <dl></dl> </dd> </dl> <p> <table summary=“section” border=“0” cellpadding=“2” cellspacing=“0” width=“100%”> <tbody><tr bgcolor=“#ffc8d8”> <td colspan=“3” valign=“bottom”> <br> <font color=“#000000” face=“helvetica, arial”><a name=“Atoms”>class <strong>Atoms</strong></a>(<a href=“builtin.html#object”>builtin.object</a>)</font></td></tr>
<tr bgcolor=“#ffc8d8”><td rowspan=“2”><tt> </tt></td> <td colspan=“2”><tt><a href=“#Atoms”>Atoms</a> <a href=“builtin.html#object”>object</a>.<br> <br> The <a href=“#Atoms”>Atoms</a> <a href=“builtin.html#object”>object</a> can represent an isolated molecule, or a<br> periodically repeated structure. It has a unit cell and<br> there may be periodic boundary conditions along any of the three<br> unit cell axes.<br> <br> Information about the atoms (atomic numbers and position) is<br> stored in ndarrays. Optionally, there can be information about<br> tags, momenta, masses, magnetic moments and charges.<br> <br> In order to calculate energies, forces and stresses, a calculator<br> <a href=“builtin.html#object”>object</a> has to attached to the atoms <a href=“builtin.html#object”>object</a>.<br> <br> Parameters:<br> <br> symbols: str (formula) or list of str<br> Can be a string formula, a list of symbols or a list of<br> Atom objects. Examples: 'H2O', 'COPt12', ['H', 'H', 'O'],<br> [Atom('Ne', (x, y, z)), …].<br> positions: list of xyz-positions<br> Atomic positions. Anything that can be converted to an<br> ndarray of shape (n, 3) will do: [(x1,y1,z1), (x2,y2,z2),<br> …].<br> scaled_positions: list of scaled-positions<br> Like positions, but given in units of the unit cell.<br> Can not be set at the same time as positions.<br> numbers: list of int<br> Atomic numbers (use only one of symbols/numbers).<br> tags: list of int<br> Special purpose tags.<br> momenta: list of xyz-momenta<br> Momenta for all atoms.<br> masses: list of float<br> Atomic masses in atomic units.<br> magmoms: list of float or list of xyz-values<br> Magnetic moments. Can be either a single value for each atom<br> for collinear calculations or three numbers for each atom for<br> non-collinear calculations.<br> charges: list of float<br> Atomic charges.<br> cell: 3×3 matrix<br> Unit cell vectors. Can also be given as just three<br> numbers for orthorhombic cells. Default value: [1, 1, 1].<br> celldisp: Vector<br> Unit cell displacement vector. To visualize a displaced cell<br> around the center of mass of a Systems of atoms. Default value<br> = (0,0,0)<br> pbc: one or three bool<br> Periodic boundary conditions flags. Examples: True,<br> False, 0, 1, (1, 1, 0), (True, False, False). Default<br> value: False.<br> constraint: constraint <a href=“builtin.html#object”>object</a>(s)<br> Used for applying one or more constraints during structure<br> optimization.<br> calculator: calculator <a href=“builtin.html#object”>object</a><br> Used to attach a calculator for calculating energies and atomic<br> forces.<br> info: dict of key-value pairs<br> Dictionary of key-value pairs with additional information<br> about the system. The following keys may be used by ase:<br> <br> - spacegroup: Spacegroup instance<br> - unit_cell: 'conventional' | 'primitive' | int | 3 ints<br> - adsorbate_info:<br> <br> Items in the info attribute survives copy and slicing and can<br> be store to and retrieved from trajectory files given that the<br> key is a string, the value is picklable and, if the value is a<br> user-defined <a href=“builtin.html#object”>object</a>, its base class is importable. One should<br> not make any assumptions about the existence of keys.<br> <br> Examples:<br> <br> These three are equivalent:<br> <br> >>> d = 1.104 # N2 bondlength<br> >>> a = <a href=“#Atoms”>Atoms</a>('N2', [(0, 0, 0), (0, 0, d)])<br> >>> a = <a href=“#Atoms”>Atoms</a>(numbers=[7, 7], positions=[(0, 0, 0), (0, 0, d)])<br> >>> a = <a href=“#Atoms”>Atoms</a>([Atom('N', (0, 0, 0)), Atom('N', (0, 0, d)])<br> <br> FCC gold:<br> <br> >>> a = 4.05 # Gold lattice constant<br> >>> b = a / 2<br> >>> fcc = <a href=“#Atoms”>Atoms</a>('Au',<br> … cell=[(0, b, b), (b, 0, b), (b, b, 0)],<br> … pbc=True)<br> <br> Hydrogen wire:<br> <br> >>> d = 0.9 # H-H distance<br> >>> L = 7.0<br> >>> h = <a href=“#Atoms”>Atoms</a>('H', positions=[(0, L / 2, L / 2)],<br> … cell=(d, L, L),<br> … pbc=(1, 0, 0))<br> </tt></td></tr> <tr><td> </td> <td width=“100%”>Methods defined here:<br> <dl><dt><a name=“Atoms-add”><strong>add</strong></a>(self, other)</dt></dl>
<dl><dt><a name=“Atoms-delitem”><strong>delitem</strong></a>(self, i)</dt></dl>
<dl><dt><a name=“Atoms-eq”><strong>eq</strong></a>(self, other)</dt><dd><tt>Check for identity of two atoms objects.<br> <br> Identity means: same positions, atomic numbers, unit cell and<br> periodic boundary conditions.</tt></dd></dl>
<dl><dt><a name=“Atoms-getitem”><strong>getitem</strong></a>(self, i)</dt><dd><tt>Return a subset of the atoms.<br> <br> i – scalar integer, list of integers, or slice <a href=“builtin.html#object”>object</a><br> describing which atoms to return.<br> <br> If i is a scalar, return an Atom <a href=“builtin.html#object”>object</a>. If i is a list or a<br> slice, return an <a href=“#Atoms”>Atoms</a> <a href=“builtin.html#object”>object</a> with the same cell, pbc, and<br> other associated info as the original <a href=“#Atoms”>Atoms</a> <a href=“builtin.html#object”>object</a>. The<br> indices of the constraints will be shuffled so that they match<br> the indexing in the subset returned.</tt></dd></dl>
<dl><dt><a name=“Atoms-iadd”><strong>iadd</strong></a> = <a href=“#Atoms-extend”>extend</a>(self, other)</dt></dl>
<dl><dt><a name=“Atoms-imul”><strong>imul</strong></a>(self, m)</dt><dd><tt>In-place repeat of atoms.</tt></dd></dl>
<dl><dt><a name=“Atoms-init”><strong>init</strong></a>(self, symbols<font color=“#909090”>=None</font>, positions<font color=“#909090”>=None</font>, numbers<font color=“#909090”>=None</font>, tags<font color=“#909090”>=None</font>, momenta<font color=“#909090”>=None</font>, masses<font color=“#909090”>=None</font>, magmoms<font color=“#909090”>=None</font>, charges<font color=“#909090”>=None</font>, scaled_positions<font color=“#909090”>=None</font>, cell<font color=“#909090”>=None</font>, pbc<font color=“#909090”>=None</font>, celldisp<font color=“#909090”>=None</font>, constraint<font color=“#909090”>=None</font>, calculator<font color=“#909090”>=None</font>, info<font color=“#909090”>=None</font>)</dt></dl>
<dl><dt><a name=“Atoms-len”><strong>len</strong></a>(self)</dt></dl>
<dl><dt><a name=“Atoms-mul”><strong>mul</strong></a> = <a href=“#Atoms-repeat”>repeat</a>(self, rep)</dt></dl>
<dl><dt><a name=“Atoms-ne”><strong>ne</strong></a>(self, other)</dt></dl>
<dl><dt><a name=“Atoms-repr”><strong>repr</strong></a>(self)</dt></dl>
<dl><dt><a name=“Atoms-append”><strong>append</strong></a>(self, atom)</dt><dd><tt>Append atom to end.</tt></dd></dl>
<dl><dt><a name=“Atoms-center”><strong>center</strong></a>(self, vacuum<font color=“#909090”>=None</font>, axis<font color=“#909090”>=None</font>)</dt><dd><tt>Center atoms in unit cell.<br> <br> Centers the atoms in the unit cell, so there is the same<br> amount of vacuum on all sides.<br> <br> Parameters:<br> <br> vacuum (default: None): If specified adjust the amount of<br> vacuum when centering. If vacuum=10.0 there will thus be 10<br> Angstrom of vacuum on each side.<br> <br> axis (default: None): If specified, only act on the specified<br> axis. Default: Act on all axes.</tt></dd></dl>
<dl><dt><a name=“Atoms-copy”><strong>copy</strong></a>(self)</dt><dd><tt>Return a copy.</tt></dd></dl>
<dl><dt><a name=“Atoms-edit”><strong>edit</strong></a>(self)</dt><dd><tt>Modify atoms interactively through ag viewer.<br> <br> Conflicts leading to undesirable behaviour might arise<br> when matplotlib has been pre-imported with certain<br> incompatible backends and while trying to use the<br> plot feature inside the interactive ag. To circumvent,<br> please set matplotlib.use('gtk') before calling this<br> method.</tt></dd></dl>
<dl><dt><a name=“Atoms-extend”><strong>extend</strong></a>(self, other)</dt><dd><tt>Extend atoms <a href=“builtin.html#object”>object</a> by appending atoms from *other*.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_angle”><strong>get_angle</strong></a>(self, list)</dt><dd><tt>Get angle formed by three atoms.<br> <br> calculate angle between the vectors list[1]->list[0] and<br> list[1]->list[2], where list contains the atomic indexes in<br> question.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_angular_momentum”><strong>get_angular_momentum</strong></a>(self)</dt><dd><tt>Get total angular momentum with respect to the center of mass.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_array”><strong>get_array</strong></a>(self, name, copy<font color=“#909090”>=True</font>)</dt><dd><tt>Get an array.<br> <br> Returns a copy unless the optional argument copy is false.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_atomic_numbers”><strong>get_atomic_numbers</strong></a>(self)</dt><dd><tt>Get integer array of atomic numbers.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_calculation_done”><strong>get_calculation_done</strong></a>(self)</dt><dd><tt>Let the calculator calculate its thing,<br> using the current input.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_calculator”><strong>get_calculator</strong></a>(self)</dt><dd><tt>Get currently attached calculator <a href=“builtin.html#object”>object</a>.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_cell”><strong>get_cell</strong></a>(self)</dt><dd><tt>Get the three unit cell vectors as a 3×3 ndarray.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_celldisp”><strong>get_celldisp</strong></a>(self)</dt><dd><tt>Get the unit cell displacement vectors .</tt></dd></dl>
<dl><dt><a name=“Atoms-get_center_of_mass”><strong>get_center_of_mass</strong></a>(self, scaled<font color=“#909090”>=False</font>)</dt><dd><tt>Get the center of mass.<br> <br> If scaled=True the center of mass in scaled coordinates<br> is returned.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_charges”><strong>get_charges</strong></a>(self)</dt><dd><tt>Get calculated charges.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_chemical_formula”><strong>get_chemical_formula</strong></a>(self, mode<font color=“#909090”>='hill'</font>)</dt><dd><tt>Get the chemial formula as a string based on the chemical symbols.<br> <br> Parameters:<br> <br> mode:<br> There are three different modes available:<br> <br> 'all': The list of chemical symbols are contracted to at string,<br> e.g. ['C', 'H', 'H', 'H', 'O', 'H'] becomes 'CHHHOH'.<br> <br> 'reduce': The same as 'all' where repeated elements are contracted<br> to a single symbol and a number, e.g. 'CHHHOCHHH' is reduced to<br> 'CH3OCH3'.<br> <br> 'hill': The list of chemical symbols are contracted to a string<br> following the Hill notation (alphabetical order with C and H<br> first), e.g. 'CHHHOCHHH' is reduced to 'C2H6O' and 'SOOHOHO' to<br> 'H2O4S'. This is default.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_chemical_symbols”><strong>get_chemical_symbols</strong></a>(self, reduce<font color=“#909090”>=False</font>)</dt><dd><tt>Get list of chemical symbol strings.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_dihedral”><strong>get_dihedral</strong></a>(self, list)</dt><dd><tt>Calculate dihedral angle.<br> <br> Calculate dihedral angle between the vectors list[0]->list[1]<br> and list[2]->list[3], where list contains the atomic indexes<br> in question.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_dipole_moment”><strong>get_dipole_moment</strong></a>(self)</dt><dd><tt>Calculate the electric dipole moment for the atoms <a href=“builtin.html#object”>object</a>.<br> <br> Only available for calculators which has a <a href=“#Atoms-get_dipole_moment”>get_dipole_moment</a>()<br> method.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_distance”><strong>get_distance</strong></a>(self, a0, a1, mic<font color=“#909090”>=False</font>)</dt><dd><tt>Return distance between two atoms.<br> <br> Use mic=True to use the Minimum Image Convention.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_forces”><strong>get_forces</strong></a>(self, apply_constraint<font color=“#909090”>=True</font>)</dt><dd><tt>Calculate atomic forces.<br> <br> Ask the attached calculator to calculate the forces and apply<br> constraints. Use *apply_constraint=False* to get the raw<br> forces.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_initial_charges”><strong>get_initial_charges</strong></a>(self)</dt><dd><tt>Get array of initial charges.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_initial_magnetic_moments”><strong>get_initial_magnetic_moments</strong></a>(self)</dt><dd><tt>Get array of initial magnetic moments.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_isotropic_pressure”><strong>get_isotropic_pressure</strong></a>(self, stress)</dt><dd><tt>Get the current calculated pressure, assume isotropic medium.<br> in Bar</tt></dd></dl>
<dl><dt><a name=“Atoms-get_kinetic_energy”><strong>get_kinetic_energy</strong></a>(self)</dt><dd><tt>Get the kinetic energy.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_magnetic_moment”><strong>get_magnetic_moment</strong></a>(self)</dt><dd><tt>Get calculated total magnetic moment.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_magnetic_moments”><strong>get_magnetic_moments</strong></a>(self)</dt><dd><tt>Get calculated local magnetic moments.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_masses”><strong>get_masses</strong></a>(self)</dt><dd><tt>Get array of masses.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_momenta”><strong>get_momenta</strong></a>(self)</dt><dd><tt>Get array of momenta.</tt></dd></dl>
<dl><dt><a name=“Atoms-get_moments_of_inertia”><strong>get_moments_of_inertia</strong></a>(self, vectors<font color=“#909090”>=False</font>)</dt><dd><tt>Get the moments of inertia along the principal axes.<br> <br> The three principal moments of inertia are computed from the<br> eigenvalues of the symmetric inertial tensor. Periodic boundary<br> conditions are ignored. Units of the moments of inertia are<br> amu*angstrom2.</tt></dd></dl> <dl><dt><a name=“Atoms-get_name”><strong>get_name</strong></a>(self)</dt></dl> <dl><dt><a name=“Atoms-get_number_of_atoms”><strong>get_number_of_atoms</strong></a>(self)</dt><dd><tt>Returns the number of atoms.<br> <br> Equivalent to len(atoms) in the standard ASE <a href=“#Atoms”>Atoms</a> class.</tt></dd></dl> <dl><dt><a name=“Atoms-get_pbc”><strong>get_pbc</strong></a>(self)</dt><dd><tt>Get periodic boundary condition flags.</tt></dd></dl> <dl><dt><a name=“Atoms-get_positions”><strong>get_positions</strong></a>(self, wrap<font color=“#909090”>=False</font>)</dt><dd><tt>Get array of positions. If wrap==True, wraps atoms back<br> into unit cell.</tt></dd></dl> <dl><dt><a name=“Atoms-get_potential_energies”><strong>get_potential_energies</strong></a>(self)</dt><dd><tt>Calculate the potential energies of all the atoms.<br> <br> Only available with calculators supporting per-atom energies<br> (e.g. classical potentials).</tt></dd></dl> <dl><dt><a name=“Atoms-get_potential_energy”><strong>get_potential_energy</strong></a>(self)</dt><dd><tt>Calculate potential energy.</tt></dd></dl> <dl><dt><a name=“Atoms-get_reciprocal_cell”><strong>get_reciprocal_cell</strong></a>(self)</dt><dd><tt>Get the three reciprocal lattice vectors as a 3×3 ndarray.<br> <br> Note that the commonly used factor of 2 pi for Fourier<br> transforms is not included here.</tt></dd></dl> <dl><dt><a name=“Atoms-get_scaled_positions”><strong>get_scaled_positions</strong></a>(self)</dt><dd><tt>Get positions relative to unit cell.<br> <br> <a href=“#Atoms”>Atoms</a> outside the unit cell will be wrapped into the cell in<br> those directions with periodic boundary conditions so that the<br> scaled coordinates are between zero and one.</tt></dd></dl> <dl><dt><a name=“Atoms-get_stress”><strong>get_stress</strong></a>(self, voigt<font color=“#909090”>=True</font>)</dt><dd><tt>Calculate stress tensor.<br> <br> Returns an array of the six independent components of the<br> symmetric stress tensor, in the traditional Voigt order<br> (xx, yy, zz, yz, xz, xy) or as a 3×3 matrix. Default is Voigt<br> order.</tt></dd></dl> <dl><dt><a name=“Atoms-get_stresses”><strong>get_stresses</strong></a>(self)</dt><dd><tt>Calculate the stress-tensor of all the atoms.<br> <br> Only available with calculators supporting per-atom energies and<br> stresses (e.g. classical potentials). Even for such calculators<br> there is a certain arbitrariness in defining per-atom stresses.</tt></dd></dl> <dl><dt><a name=“Atoms-get_tags”><strong>get_tags</strong></a>(self)</dt><dd><tt>Get integer array of tags.</tt></dd></dl> <dl><dt><a name=“Atoms-get_temperature”><strong>get_temperature</strong></a>(self)</dt><dd><tt>Get the temperature. in Kelvin</tt></dd></dl> <dl><dt><a name=“Atoms-get_total_energy”><strong>get_total_energy</strong></a>(self)</dt><dd><tt>Get the total energy - potential plus kinetic energy.</tt></dd></dl> <dl><dt><a name=“Atoms-get_velocities”><strong>get_velocities</strong></a>(self)</dt><dd><tt>Get array of velocities.</tt></dd></dl> <dl><dt><a name=“Atoms-get_volume”><strong>get_volume</strong></a>(self)</dt><dd><tt>Get volume of unit cell.</tt></dd></dl> <dl><dt><a name=“Atoms-has”><strong>has</strong></a>(self, name)</dt><dd><tt>Check for existence of array.<br> <br> name must be one of: 'tags', 'momenta', 'masses', 'magmoms',<br> 'charges'.</tt></dd></dl> <dl><dt><a name=“Atoms-new_array”><strong>new_array</strong></a>(self, name, a, dtype<font color=“#909090”>=None</font>, shape<font color=“#909090”>=None</font>)</dt><dd><tt>Add new array.<br> <br> If *shape* is not *None*, the shape of *a* will be checked.</tt></dd></dl> <dl><dt><a name=“Atoms-pop”><strong>pop</strong></a>(self, i<font color=“#909090”>=-1</font>)</dt><dd><tt>Remove and return atom at index *i* (default last).</tt></dd></dl> <dl><dt><a name=“Atoms-rattle”><strong>rattle</strong></a>(self, stdev<font color=“#909090”>=0.001</font>, seed<font color=“#909090”>=42</font>)</dt><dd><tt>Randomly displace atoms.<br> <br> This method adds random displacements to the atomic positions,<br> taking a possible constraint into account. The random numbers are<br> drawn from a normal distribution of standard deviation stdev.<br> <br> For a parallel calculation, it is important to use the same<br> seed on all processors!</tt></dd></dl> <dl><dt><a name=“Atoms-repeat”><strong>repeat</strong></a>(self, rep)</dt><dd><tt>Create new repeated atoms <a href=“builtin.html#object”>object</a>.<br> <br> The *rep* argument should be a sequence of three positive<br> integers like *(2,3,1)* or a single integer (*r*) equivalent<br> to *(r,r,r)*.</tt></dd></dl> <dl><dt><a name=“Atoms-rotate”><strong>rotate</strong></a>(self, v, a<font color=“#909090”>=None</font>, center<font color=“#909090”>=(0, 0, 0)</font>, rotate_cell<font color=“#909090”>=False</font>)</dt><dd><tt>Rotate atoms based on a vector and an angle, or two vectors.<br> <br> Parameters:<br> <br> v:<br> Vector to rotate the atoms around. Vectors can be given as<br> strings: 'x', '-x', 'y', … .<br> <br> a = None:<br> Angle that the atoms is rotated around the vecor 'v'. If an angle<br> is not specified, the length of 'v' is used as the angle<br> (default). The angle can also be a vector and then 'v' is rotated<br> into 'a'.<br> <br> center = (0, 0, 0):<br> The center is kept fixed under the rotation. Use 'COM' to fix<br> the center of mass, 'COP' to fix the center of positions or<br> 'COU' to fix the center of cell.<br> <br> rotate_cell = False:<br> If true the cell is also rotated.<br> <br> Examples:<br> <br> Rotate 90 degrees around the z-axis, so that the x-axis is<br> rotated into the y-axis:<br> <br> >>> a = pi / 2<br> >>> atoms.<a href=“#Atoms-rotate”>rotate</a>('z', a)<br> >>> atoms.<a href=“#Atoms-rotate”>rotate</a>1)<br> >>> atoms.<a href=“#Atoms-rotate”>rotate</a>('x', 'y')</tt></dd></dl> <dl><dt><a name=“Atoms-rotate_dihedral”><strong>rotate_dihedral</strong></a>(self, list, angle, mask<font color=“#909090”>=None</font>)</dt><dd><tt>Rotate dihedral angle.<br> <br> Complementing the two routines above: rotate a group by a<br> predefined dihedral angle, starting from its current<br> configuration</tt></dd></dl> <dl><dt><a name=“Atoms-rotate_euler”><strong>rotate_euler</strong></a>(self, center<font color=“#909090”>=(0, 0, 0)</font>, phi<font color=“#909090”>=0.0</font>, theta<font color=“#909090”>=0.0</font>, psi<font color=“#909090”>=0.0</font>)</dt><dd><tt>Rotate atoms via Euler angles.<br> <br> See e.g <a href=“http://mathworld.wolfram.com/EulerAngles.html”>http://mathworld.wolfram.com/EulerAngles.html</a> for explanation.<br> <br> Parameters:<br> <br> center :<br> The point to rotate about. A sequence of length 3 with the<br> coordinates, or 'COM' to select the center of mass, 'COP' to<br> select center of positions or 'COU' to select center of cell.<br> phi :<br> The 1st rotation angle around the z axis.<br> theta :<br> Rotation around the x axis.<br> psi :<br> 2nd rotation around the z axis.</tt></dd></dl> <dl><dt><a name=“Atoms-set_angle”><strong>set_angle</strong></a>(self, list, angle, mask<font color=“#909090”>=None</font>)</dt><dd><tt>Set angle formed by three atoms.<br> <br> Sets the angle between vectors list[1]->list[0] and<br> list[1]->list[2].<br> <br> Same usage as in set_dihedral.</tt></dd></dl> <dl><dt><a name=“Atoms-set_array”><strong>set_array</strong></a>(self, name, a, dtype<font color=“#909090”>=None</font>, shape<font color=“#909090”>=None</font>)</dt><dd><tt>Update array.<br> <br> If *shape* is not *None*, the shape of *a* will be checked.<br> If *a* is *None*, then the array is deleted.</tt></dd></dl> <dl><dt><a name=“Atoms-set_atomic_numbers”><strong>set_atomic_numbers</strong></a>(self, numbers)</dt><dd><tt>Set atomic numbers.</tt></dd></dl> <dl><dt><a name=“Atoms-set_calculator”><strong>set_calculator</strong></a>(self, calc<font color=“#909090”>=None</font>)</dt><dd><tt>Attach calculator <a href=“builtin.html#object”>object</a>.</tt></dd></dl> <dl><dt><a name=“Atoms-set_cell”><strong>set_cell</strong></a>(self, cell, scale_atoms<font color=“#909090”>=False</font>, fix<font color=“#909090”>=None</font>)</dt><dd><tt>Set unit cell vectors.<br> <br> Parameters:<br> <br> cell :<br> Unit cell. A 3×3 matrix (the three unit cell vectors) or<br> just three numbers for an orthorhombic cell.<br> scale_atoms : bool<br> Fix atomic positions or move atoms with the unit cell?<br> Default behavior is to *not* move the atoms (scale_atoms=False).<br> <br> Examples:<br> <br> Two equivalent ways to define an orthorhombic cell:<br> <br> >>> a.<a href=“#Atoms-set_cell”>set_cell</a>([a, b, c])<br> >>> a.<a href=“#Atoms-set_cell”>set_cell</a>([(a, 0, 0), (0, b, 0), (0, 0, c)])<br> <br> FCC unit cell:<br> <br> >>> a.<a href=“#Atoms-set_cell”>set_cell</a>([(0, b, b), (b, 0, b), (b, b, 0)])</tt></dd></dl> <dl><dt><a name=“Atoms-set_celldisp”><strong>set_celldisp</strong></a>(self, celldisp)</dt></dl> <dl><dt><a name=“Atoms-set_charges”><strong>set_charges</strong></a>(self, charges<font color=“#909090”>=None</font>)</dt><dd><tt>Deprecated method. Use set_initial_charges.</tt></dd></dl> <dl><dt><a name=“Atoms-set_chemical_symbols”><strong>set_chemical_symbols</strong></a>(self, symbols)</dt><dd><tt>Set chemical symbols.</tt></dd></dl> <dl><dt><a name=“Atoms-set_constraint”><strong>set_constraint</strong></a>(self, constraint<font color=“#909090”>=None</font>)</dt><dd><tt>Apply one or more constrains.<br> <br> The *constraint* argument must be one constraint <a href=“builtin.html#object”>object</a> or a<br> list of constraint objects.</tt></dd></dl> <dl><dt><a name=“Atoms-set_dihedral”><strong>set_dihedral</strong></a>(self, list, angle, mask<font color=“#909090”>=None</font>)</dt><dd><tt>set the dihedral angle between vectors list[0]->list[1] and<br> list[2]->list[3] by changing the atom indexed by list[3]<br> if mask is not None, all the atoms described in mask<br> (read: the entire subgroup) are moved<br> <br> example: the following defines a very crude<br> ethane-like molecule and twists one half of it by 30 degrees.<br> <br> >>> atoms = <a href=“#Atoms”>Atoms</a>('HHCCHH', 0)<br> >>> atoms.<a href=“#Atoms-set_dihedral”>set_dihedral</a>([1,2,3,4],7*pi/6,mask=[0,0,0,1,1,1])</tt></dd></dl> <dl><dt><a name=“Atoms-set_distance”><strong>set_distance</strong></a>(self, a0, a1, distance, fix<font color=“#909090”>=0.5</font>)</dt><dd><tt>Set the distance between two atoms.<br> <br> Set the distance between atoms *a0* and *a1* to *distance*.<br> By default, the center of the two atoms will be fixed. Use<br> *fix=0* to fix the first atom, *fix=1* to fix the second<br> atom and *fix=0.5* (default) to fix the center of the bond.</tt></dd></dl> <dl><dt><a name=“Atoms-set_initial_charges”><strong>set_initial_charges</strong></a>(self, charges<font color=“#909090”>=None</font>)</dt><dd><tt>Set the initial charges.</tt></dd></dl> <dl><dt><a name=“Atoms-set_initial_magnetic_moments”><strong>set_initial_magnetic_moments</strong></a>(self, magmoms<font color=“#909090”>=None</font>)</dt><dd><tt>Set the initial magnetic moments.<br> <br> Use either one or three numbers for every atom (collinear<br> or non-collinear spins).</tt></dd></dl> <dl><dt><a name=“Atoms-set_masses”><strong>set_masses</strong></a>(self, masses<font color=“#909090”>='defaults'</font>)</dt><dd><tt>Set atomic masses.<br> <br> The array masses should contain a list of masses. In case<br> the masses argument is not given or for those elements of the<br> masses list that are None, standard values are set.</tt></dd></dl> <dl><dt><a name=“Atoms-set_momenta”><strong>set_momenta</strong></a>(self, momenta)</dt><dd><tt>Set momenta.</tt></dd></dl> <dl><dt><a name=“Atoms-set_pbc”><strong>set_pbc</strong></a>(self, pbc)</dt><dd><tt>Set periodic boundary condition flags.</tt></dd></dl> <dl><dt><a name=“Atoms-set_positions”><strong>set_positions</strong></a>(self, newpositions)</dt><dd><tt>Set positions, honoring any constraints.</tt></dd></dl> <dl><dt><a name=“Atoms-set_scaled_positions”><strong>set_scaled_positions</strong></a>(self, scaled)</dt><dd><tt>Set positions relative to unit cell.</tt></dd></dl> <dl><dt><a name=“Atoms-set_tags”><strong>set_tags</strong></a>(self, tags)</dt><dd><tt>Set tags for all atoms. If only one tag is supplied, it is<br> applied to all atoms.</tt></dd></dl> <dl><dt><a name=“Atoms-set_velocities”><strong>set_velocities</strong></a>(self, velocities)</dt><dd><tt>Set the momenta by specifying the velocities.</tt></dd></dl> <dl><dt><a name=“Atoms-translate”><strong>translate</strong></a>(self, displacement)</dt><dd><tt>Translate atomic positions.<br> <br> The displacement argument can be a float an xyz vector or an<br> nx3 array (where n is the number of atoms).</tt></dd></dl> <dl><dt><a name=“Atoms-write”><strong>write</strong></a>(self, filename, format<font color=“#909090”>=None</font>, kwargs)</dt><dd><tt>Write yourself to a file.</tt></dd></dl>
<hr> Data descriptors defined here:<br> <dl><dt><strong>dict</strong></dt> <dd><tt>dictionary for instance variables (if defined)</tt></dd> </dl> <dl><dt><strong>weakref</strong></dt> <dd><tt>list of weak references to the object (if defined)</tt></dd> </dl> <dl><dt><strong>calc</strong></dt> <dd><tt>Calculator object.</tt></dd> </dl> <dl><dt><strong>cell</strong></dt> <dd><tt>Attribute for direct manipulation of the unit cell.</tt></dd> </dl> <dl><dt><strong>constraints</strong></dt> <dd><tt>Constraints of the atoms.</tt></dd> </dl> <dl><dt><strong>numbers</strong></dt> <dd><tt>Attribute for direct manipulation of the atomic numbers.</tt></dd> </dl> <dl><dt><strong>pbc</strong></dt> <dd><tt>Attribute for direct manipulation of the periodic boundary condition flags.</tt></dd> </dl> <dl><dt><strong>positions</strong></dt> <dd><tt>Attribute for direct manipulation of the positions.</tt></dd> </dl> <hr> Data and other attributes defined here:<br> <dl><dt><strong>hash</strong> = None</dt></dl>
</td></tr></tbody></table></p></td></tr></tbody></table></p><p> <table summary=“section” border=“0” cellpadding=“2” cellspacing=“0” width=“100%”> <tbody><tr bgcolor=“#55aa55”> <td colspan=“3” valign=“bottom”> <br> <font color=“#ffffff” face=“helvetica, arial”><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor=“#55aa55”><tt> </tt></td><td> </td> <td width=“100%”><strong>atomic_masses</strong> = array([ 0. , 1.00794, 4.0026 , 6…. nan, nan, nan, nan])<br> <strong>atomic_numbers</strong> = {'Ac': 89, 'Ag': 47, 'Al': 13, 'Am': 95, 'Ar': 18, 'As': 33, 'At': 85, 'Au': 79, 'B': 5, 'Ba': 56, …}<br> <strong>chemical_symbols</strong> = ['X', 'H', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', 'Mg', 'Al', 'Si', 'P', 'S', 'Cl', 'Ar', 'K', …]</td></tr></tbody></table> </p></body></html>