File: check_spacegroups_001.sh

package info (click to toggle)
cod-tools 2.3%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 114,852 kB
  • sloc: perl: 53,336; sh: 23,842; ansic: 6,318; xml: 1,982; yacc: 1,112; makefile: 716; python: 158; sql: 73
file content (56 lines) | stat: -rwxr-xr-x 2,002 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#! /bin/sh

#BEGIN DEPEND------------------------------------------------------------------

INPUT_MODULES='src/lib/perl5/COD/Spacegroups/Builder.pm \
               src/lib/perl5/COD/Spacegroups/Lookup.pm \
               src/lib/perl5/COD/Spacegroups/Lookup/COD.pm \
               src/lib/perl5/COD/Spacegroups/Symop/Parse.pm'

#END DEPEND--------------------------------------------------------------------

perl <<'END_SCRIPT'
#------------------------------------------------------------------------------
#$Author: antanas $
#$Date: 2017-02-21 10:31:14 +0200 (An, 21 vas. 2017) $ 
#$Revision: 4960 $
#$URL: svn://www.crystallography.net/cod-tools/tags/v2.3/tests/shtests/check_spacegroups_001.sh $
#------------------------------------------------------------------------------
#*
#  Check whether COD::Spacegroups::Builder.pm correctly builds all space groups.
#**

use strict;
use warnings;

use COD::Spacegroups::Builder;
use COD::Spacegroups::Lookup qw( make_symop_hash make_symop_key );
use COD::Spacegroups::Lookup::COD;
use COD::Spacegroups::Symop::Parse qw( string_from_symop
                                       symop_string_canonical_form );

# Identify the space group from the symmetry operators:
my %symop_lookup_table = make_symop_hash( [
                            \@COD::Spacegroups::Lookup::COD::table,
                            \@COD::Spacegroups::Lookup::COD::extra_settings
                         ] );

for my $sg_data (@COD::Spacegroups::Lookup::COD::table) {

    my $spacegroup = new COD::Spacegroups::Builder;

    $spacegroup->insert_symop_strings( $sg_data->{symops} );

    my @symops = $spacegroup->all_symops();

    my $key = make_symop_key( [ map { string_from_symop($_) } @symops ] );

    if( exists $symop_lookup_table{$key} ) {
        my $estimated_sg = $symop_lookup_table{$key};
        print $estimated_sg->{universal_h_m}, "\n";
    } else {
        print "$0: space group '$sg_data->{universal_h_m}' could not be identified\n"
    }

}
END_SCRIPT