Xray::SpaceGroup(3pm) | User Contributed Perl Documentation | Xray::SpaceGroup(3pm) |
Xray::SpaceGroup - Symmetry operations for the crystal space groups
This documentation refers to libperlxray version 0.1.
my $sg = Xray::SpaceGroup -> new("Pm3m"); $sg -> fix({a => $a, b => $b, c => $c, alpha => $alpha, beta => $beta, gamma => $gamma}) @symmetry_ops = $sg -> positions; @bravais_trans = $sg -> bravais; print $sg -> report;
The two lists can be used to populate a unit cell, given a set of Wyckoff positions. The report is a user-readable summary of the properties of the space group.
This provides an object-oriented interface to a database of space group symmetries transcribed from volume A of the International Tables for Crystallography.
my $sg = Xray::SpaceGroup -> new({group=>"Pm3m"});
The space group symbol can be a Hermann-Maguin symbol, a Schoenflies symbol, the number of the space group, one of several nicknames (diamond, cscl, etc), or a few other symbols from the International Tables.
The H-M symbol can contain any number of spaces and is case insensitive. An overscore is indicated by a leading dash ("-") and a subscript is simply written as a normal character, as in "p 42 3 2" where "4 sub 2" is written as 42. A slash is indicated by a forward slash ("/").
The sub- and superscripts of the Schoenflies symbol can come in either order and are indicated by caret ("^") and underscore ("_").
The nicknames are as follows:
symbol number nicknames ------------------------------------------------------------ p 63 m c 186 graphite, gra p 63/m m c 194 hex, hcp f -4 3 m 216 zincblende, zns p m -3 m 221 cubic, cscl, perov, perovskite f m -3 m 225 fcc, salt, nacl f m -3 d 227 diamond i m -3 m 229 bcc
$sg -> fix({a => $a, b => $b, c => $c, alpha => $alpha, beta => $beta, gamma => $gamma})
The first chore of this method is quite necessary for a space group with multiple settings. Selecting the correct setting requires knowledge of the lattice parameters. For many space groups, including all cubic groups, this is a no-op.
use Data::Dumper; my $sg = Xray::SpaceGroup -> new({group=>'7'}); my @positions = $sg->positions; print Data::Dumper->Dump([\@positions], [qw(positions)]); ==prints==> $positions = [ [ '$x', '$y', '$z' ], [ '$x', '-$y', '$z+1/2' ] ];
The elements of these lists are strings and are intended to be evaluated using perl's eval function. For example, if you have a Wyckoff position of "(0.2, 0.3, 0.4)", then you might do this:
($x, $y, $z) = (0.2, 0.3, 0.4); @pos0 = (eval "$positions[0]->[0]", eval "$positions[0]->[1]", eval "$positions[0]->[2]" ); @pos1 = (eval "$positions[1]->[0]", eval "$positions[1]->[1]", eval "$positions[1]->[2]" );
This will result in "@pos0 = (0.2, 0.3, 0.4)" and "@pos2 = (0.2, -0.3, 0.9)". You would, in practice, wrap these evaluations inside proper control structures. You might also use a Safe compartment if you are worried about the possibility of the database having been tainted.
For high symmetry groups and high symmetry Wyckoff positions, these evaluations will generate the same positions repeatedly. It is the responsibility of your application to weed out these repetitions.
There are also "set" and "get" methods, but properties of the space group should be obtained via the reporting methods listed below.
my $space = Xray::SpaceGroup -> new({group=>7}); print join(", ", $space->bravais), $/; ==prints==> Space group: p c (7) supplied symbol : 7 crystal class : monoclinic Schoenflies symbol : c_s^2 crystal setting : b_unique_1 Bravais translations : none Positions : $x $y $z $x -$y $z+1/2
print $sg->group, $/; ==prints==> p m -3 m
print $sg->given, $/; ==prints==> Pm3m
print $sg->number, $/; ==prints==> 221
print $sg->full, $/; ==prints==> p 4/m -3 2/m
print $sg->schoenflies, $/; ==prints==> o_h^1
print $sg->thirtyfive, $/; ==prints==> p m 3 m
my $sgnew = Xray::SpaceGroup -> new({group=>"a b a 2"}); print $sgnew->newsymbol, $/; ==prints==> a e a 2
print $sg->class, $/; ==prints==> cubic
For rhombohedral space groups, this returns a string -- either "positions" or "rhombohedral" -- indicating which set of symmetry operations should be used.
For most monoclinic groups, this returns one of "b_unique", "c_unique", or "a_unique", indicating which set of symmetry operations should be used. If the beta angle is not 90 degrees, the "b_unique" setting should be used. If the gamma or alpha angles are not 90 degrees, the "c_unique" or "a_unique" settings should be used, respectively.
For several monoclinic space groups, there are additional settings for each unique axis. These are indicated as "b_unique_1", "b_unique_2", "b_unique_3", and so on.
my $diamond = Xray::SpaceGroup -> new({group=>"f d -3 m"}); print join(", ", $diamond->bravais), $/; ==prints==> 0.000, 0.500, 0.500, 0.500, 0.000, 0.500, 0.500, 0.500, 0.000
Each triplet is a Bravais translation.
The Bravais translations attempt to be sensitive to the specified crystal setting. If you use ambiguous input (i.e. the number or the Schoenflies symbol) it is possible that a Bravais translation other than the one you want will be returned. The telepathic interface is planned for version 2.0.
When the reference to the Xray::SpaceGroup object is used in string context, the "group" method is returned. When used in numerical context, the "number" method is returned.
This requires that the space_groups.db file, which is generated by the space_groups.db.PL script, be installed in the correct location. There are no other configuration options.
This module uses several things from the standard distribution along with:
Class::Std
List::MoreUtils
Readonly
Regexp::List
Missing features:
Please report problems to Bruce Ravel (bravel AT bnl DOT gov)
Patches are welcome.
Bruce Ravel (bravel AT bnl DOT gov)
http://cars9.uchicago.edu/~ravel/software/
Julie Cross and Matt Newville gave me a copy of volume A of the International Tables for Crystallography as a graduation present from grad school. Was that a blessing or a curse?
Saulius Grazulis, whose useful feedback inspired this most recent rewrite of this code. Earlier versions of Atoms benefited from the help and criticism of Shelly Kelly, Daniel Haskel, Chuck Bouldin, Hannes Fischer, Glenn Forney, Chris Glover, John Rehr, Hubert Renevier, Julia Wienold, Andrzej Wilamowski, Boyan Boyanovich, Ed Stern, Hans Stragier, Kalle Voss, Steve Zabinsky, and Yanjun Zhang. All the users of my codes over the years have driven me to provide the best possible code.
Copyright (c) 1999-2008 Bruce Ravel (bravel AT bnl DOT gov). All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
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.
2021-01-07 | perl v5.32.0 |