Debian Codegraph @

wrappers/perl/t/02_path.t

raw
1 #!/usr/bin/perl -w
2
3 use strict;
4 use warnings;
5 use Test::More tests => 12;
6 use Cwd;
7
8 use Xray::Feff;
9
10
11 my $epsilon = 1e-3;
12
13 my $path = Xray::Feff::Path->new();
14 ok(ref($path) =~ m{Feff::Path}, "object created ".$path);
15
16 my $ret = $path->atom(0, 0, -3.61, 1);
17 ok((not $ret), "added first leg");
18 ok($path->nleg == 2, "nleg=2");
19 $ret = $path->atom(-1.805, 0, -1.805, 1);
20 ok((not $ret), "added second leg");
21 ok($path->nleg == 3, "nleg = 3");
22
23 $path->phpad('../fortran/phase_orig.pad');
24 $path->degen(48);
25 $path->Index(4);
26 $ret = $path->path;
27 ok((not $ret), "made path");
28
29 ok($path->ne == 59, "correct length of energy grid");
30 ok(abs($path->reff-4.3577) < $epsilon, "reff");
31
32 ok( (($path->rat->[0]->[0] < $epsilon) and
33 ($path->rat->[0]->[1] < $epsilon) and
34 (abs($path->rat->[0]->[2]+3.61) < $epsilon)), "first atom coordinates");
35
36
37 ok( ((abs($path->rat->[1]->[0]+1.805) < $epsilon) and
38 ($path->rat->[1]->[1] < $epsilon) and
39 (abs($path->rat->[1]->[2]+1.805) < $epsilon)), "second atom coordinates");
40
41 ok( ((abs($path->ri->[0]-3.610) < $epsilon) and
42 (abs($path->ri->[1]-2.553) < $epsilon) and
43 (abs($path->ri->[2]-2.553) < $epsilon)), "ri array");
44
45 ok( ((abs($path->beta->[0]-135) < $epsilon) and
46 (abs($path->beta->[1]-90 ) < $epsilon) and
47 (abs($path->beta->[2]-135) < $epsilon)), "beta array");
48
49 # 0.000 0.000 -3.610 1 3.610 135.000 0.000 29
50 # -1.805 0.000 -1.805 1 2.553 90.000 0.000 29
51 # 0.000 0.000 0.000 0 2.553 135.000 0.000 29
52
53 undef $path;