| Description | Perl tools for X-ray Absorption Spectroscopy |
Xray::Crystal::Cell - A crystallographic unit cell object
This documentation refers to Demeter version 0.9.26.
$cell = Xray::Crystal::Cell->new;
$cell -> space_group($space);
$cell -> a($val);
## and so on...
$cell -> populate(\@sites);
## where @sites is a list of Site objects.
This is a crystallographic cell object. From lattice constants, a space group symbol, and a list of Wycoff positions, it will fully populate a unit cell. This cell can then be used to make crystal or cluster calculations.
This uses Moose, so each of these attributes has an associated accessor by the same name.
These are the attributes that are typically set by the user:
aThe a lattice constant.
bThe b lattice constant.
cThe c lattice constant.
alphaThe angle between the b and c lattice constants.
betaThe angle between the a and c lattice constants.
gammaThe angle between the a and b lattice constants.
angleThis takes the value of the most recently set angle. This is only needed for the peculiar situation of a monoclinic space group with all three angles equal to 90. The function determine monoclinic will not be able to resolve the setting in that situation without a little help. The idea is that the user has to specify at least one angle in order to unambiguously determine the setting.
space_groupA string specifying the space group of the cell. The supplied value is stored in the given_group attribute and this is filled with the canonical symbol.
The bare minimum required to define is a cell is the a lattice constant and the space group symbol. All other attributes have sensible defaults or are calculated quantities. Of course, any space group of lower than cubic symmetry will require that other axes and/or angles be specified.
There are several other Cell attributes. Except for the Contents attribute, these are updated as triggers when other attributes are updated. These include:
groupThis is a reference to an Xray::Crystal::SpaceGroup object which has been initialized with the value of the space_group attribute.
given_groupThe space group symbol used as the argument for the space_group attribute when the make method is called.
contentsThis is an anonymous list of anonymous lists specifying the contents of the fully decoded unit cell. This attribute is set by caling the populate method. Each list element is itself a list containing the x, y, and z fractional coordinates of the site and a reference to the Site obect which generated that site. To examine the contents of the cell, do something like this:
my ($contents) = $cell -> contents;
foreach my $pos (@{$contents}) {
printf "x=%8.5f, y=%8.5f, z=%8.5f$/",
$$pos[0], $$pos[1], $$pos[2]
};
volumeThe volume of the unit cell computed from the axes and angles.
txxThe x-x element of the metric tensor computed from the axes and angles. This is used to translate from fractional to cartesian coordinates.
tyxThe y-x element of the metric tensor computed from the axes and angles.
tyzThe y-z element of the metric tensor computed from the axes and angles.
tzxThe z-x element of the metric tensor computed from the axes and angles.
tzzThe z-z element of the metric tensor computed from the axes and angles.
The yy element of the metric tensor is unity and the other three are zero. These four are not actually attributes.
populatePopulate a unit cell given a list of sites. Each element of the list of sites must be a Site object. The symmetries operations implied by the space group are applied to each unique site to generate a description of the stoichiometric contents of the unit cell.
$cell -> populate(\@sites)
This fills the contents attribute of the Cell with an anonymous array. Each element of the anonymous array is itself an anonymous array whose first three elements are the x, y, and z fractional coordinates of the site and whose fourth element is a reference to the Site that generated the position. This is, admitedly, a complicated data structure and requires a lot of ``line-noise'' style perl to dereference all its elements. It is, however, fairly efficient.
metricTakes the three fractional coordinates and returns the cartesian coordinates of the position. The fractional coordinates need not be canonicalized into the first octant, thus this method can be used to generate the cartesian coordinates for any atom in a cluster.
($x,$y,$z) = $cell -> metric($xf, $yf, $zf);
This method is called repeatedly by the build_cluster function in the Demeter::Atoms module. The elements of the metric tensor, i.e. the txx, tyx, tyz, tzx, and tzz Cell attributes, are used to make the transformation according to this formula:
/ Txx 0 0 \ / xf \
(x y z) = | Tyx 1 Tyz | | yf |
\ Tzx 0 Tzz / \ zf /
d_spacingTakes the Miller indeces of a scattering plane and returns the d spacing of that plane in Angstroms.
$d = $cell -> d_spacing($h, $k, $l);
multiplicityReturns the multiplicity of a reflection hkl for the cell.
$p = $cell -> multiplicity($h, $k, $l);
See the footnote in Cullity page 523 for a caveat.
cell_checkThis method returns a warning if the cell axes and angles are not appropriate to the space group, otherwise it returns an empty string.
print $cell -> cell_check;
clearReinitialize all attribute values;
There is nothing configurable and no environment variables are used.
Carp
File::Spec
Storable
Const::Fast
These methods are not yet implemented:
overfull
warn_shift
get_symmetry_table
set_ipots
Please report problems to the Ifeffit Mailing List (http://cars9.uchicago.edu/mailman/listinfo/ifeffit/)
Patches are welcome.
Bruce Ravel, http://bruceravel.github.io/home
http://bruceravel.github.io/demeter/
Copyright (c) 2006-2018 Bruce Ravel (http://bruceravel.github.io/home). All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlgpl.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.