~ubuntu-branches/ubuntu/quantal/psicode/quantal

« back to all changes in this revision

Viewing changes to tests/mp2-oeprop/mp2-oeprop.test.pl

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2006-09-10 14:01:33 UTC
  • Revision ID: james.westby@ubuntu.com-20060910140133-ib2j86trekykfsfv
Tags: upstream-3.2.3
ImportĀ upstreamĀ versionĀ 3.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl  
 
2
 
 
3
while ($ARGV = shift) {
 
4
  if   ("$ARGV" eq "-q") { $QUIET = 1; }
 
5
  elsif("$ARGV" eq "-i") { $SRC_PATH = shift; }
 
6
  elsif("$ARGV" eq "-x") { $EXEC_PATH = shift; }
 
7
}
 
8
 
 
9
if($SRC_PATH ne "") {
 
10
  require($SRC_PATH . "/../psitest.pl");
 
11
}
 
12
else {
 
13
  require("../psitest.pl");
 
14
}
 
15
 
 
16
# build the command for the psi3 driver
 
17
$PSICMD = build_psi_cmd($QUIET, $SRC_PATH, $EXEC_PATH);
 
18
 
 
19
$TOL = 10**-8;
 
20
$MTOL = 10**-5;
 
21
if($SRC_PATH ne "") {
 
22
  $REF_FILE = "$SRC_PATH/output.ref";
 
23
}
 
24
else {
 
25
  $REF_FILE = "output.ref";
 
26
}
 
27
$TEST_FILE = "output.dat";
 
28
$RESULT = "mp2-oeprop.test";
 
29
 
 
30
system ("$PSICMD");
 
31
 
 
32
$FAIL = 0;
 
33
 
 
34
open(RE, ">$RESULT") || die "cannot open $RESULT: $!";
 
35
select (RE);
 
36
printf "MP2-OEPROP:\n";
 
37
 
 
38
if (abs(seek_nuc($REF_FILE) - seek_nuc($TEST_FILE)) > $TOL) {
 
39
  fail_test("Nuclear Repulsion Energy"); $FAIL = 1;
 
40
}
 
41
else {
 
42
  pass_test("Nuclear Repulsion Energy");
 
43
}
 
44
 
 
45
if (abs(seek_scf($REF_FILE) - seek_scf($TEST_FILE)) > $TOL) {
 
46
  fail_test("RHF Energy"); $FAIL = 1;
 
47
}
 
48
else { 
 
49
  pass_test("RHF Energy");
 
50
}
 
51
 
 
52
if (abs(seek_mp2($REF_FILE) - seek_mp2($TEST_FILE)) > $TOL) {
 
53
  fail_test("MP2 Energy"); $FAIL = 1;
 
54
}
 
55
else { 
 
56
  pass_test("MP2 Energy");
 
57
}
 
58
 
 
59
@gop_ref = seek_mulliken_gop($REF_FILE);
 
60
@gop_test = seek_mulliken_gop($TEST_FILE);
 
61
 
 
62
if (!compare_arrays(\@gop_ref,\@gop_test,20,20,$MTOL)) {
 
63
  fail_test("Gross orbital populations"); $FAIL = 1;
 
64
}
 
65
else { 
 
66
  pass_test("Gross orbital populations");
 
67
}
 
68
 
 
69
@abp_ref = seek_mulliken_abp($REF_FILE);
 
70
@abp_test = seek_mulliken_abp($TEST_FILE);
 
71
 
 
72
if (!compare_arrays(\@abp_ref,\@abp_test,2,2,$MTOL)) {
 
73
  fail_test("Atomic bond populations"); $FAIL = 1;
 
74
}
 
75
else { 
 
76
  pass_test("Atomic bond populations");
 
77
}
 
78
 
 
79
@apnc_ref = seek_mulliken_apnc($REF_FILE);
 
80
@apnc_test = seek_mulliken_apnc($TEST_FILE);
 
81
 
 
82
if (!compare_arrays(\@apnc_ref,\@apnc_test,2,2,$MTOL)) {
 
83
  fail_test("Gross atomic populations and net charges"); $FAIL = 1;
 
84
}
 
85
else { 
 
86
  pass_test("Gross atomic poplulations and net charges");
 
87
}
 
88
 
 
89
@dipole_ref = seek_dipole($REF_FILE);
 
90
@dipole_test = seek_dipole($TEST_FILE);
 
91
 
 
92
if (!compare_arrays(\@dipole_ref,\@dipole_test,4,4,$MTOL)) {
 
93
  fail_test("Electric dipole moment"); $FAIL = 1;
 
94
}
 
95
else { 
 
96
  pass_test("Electric dipole moment");
 
97
}
 
98
 
 
99
@angmom_ref = seek_angmom($REF_FILE);
 
100
@angmom_test = seek_angmom($TEST_FILE);
 
101
 
 
102
if (!compare_arrays(\@angmom_ref,\@angmom_test,3,3,$MTOL)) {
 
103
  fail_test("Electronic angular momentum"); $FAIL = 1;
 
104
}
 
105
else { 
 
106
  pass_test("Electronic angular momentum");
 
107
}
 
108
 
 
109
@epef_ref = seek_epef($REF_FILE);
 
110
@epef_test = seek_epef($TEST_FILE);
 
111
 
 
112
if (!compare_arrays(\@epef_ref,\@epef_test,8,8,$MTOL)) {
 
113
  fail_test("Electrostatic potential and electric field"); $FAIL = 1;
 
114
}
 
115
else { 
 
116
  pass_test("Electrostatic potential and electric field");
 
117
}
 
118
 
 
119
@edensity_ref = seek_edensity($REF_FILE);
 
120
@edensity_test = seek_edensity($TEST_FILE);
 
121
 
 
122
if (!compare_arrays(\@edensity_ref,\@edensity_test,2,2,$MTOL)) {
 
123
  fail_test("Electron density"); $FAIL = 1;
 
124
}
 
125
else { 
 
126
  pass_test("Electron density");
 
127
}
 
128
 
 
129
if (abs(seek_mvd($REF_FILE) - seek_mvd($TEST_FILE)) > $TOL) {
 
130
  fail_test("Total one-electron MVD terms"); $FAIL = 1;
 
131
}
 
132
else { 
 
133
  pass_test("Total one-electron MVD terms");
 
134
}
 
135
 
 
136
close (RE);
 
137
 
 
138
system("cat $RESULT");
 
139
 
 
140
exit($FAIL);
 
141