-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathElecElecRepulsionTest.jl
128 lines (100 loc) · 4.07 KB
/
ElecElecRepulsionTest.jl
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
push!(LOAD_PATH,"../src")
using Test
using TypesParticles
using TypesBasis
using BuildBasis
using InputParser
using ElecElecRepulsion
"""
run_buildelecelecrepul_test()
""" function run_buildelecelecrepul_test()
@testset "Electron-Electron Repulsion" begin
system,basisset = getcalcsetup("../examples/HatreeFock.in")
basisfunc,numelec = buildbasisfunc(system,basisset);
elecelecrepcalc = buildelecelecrepulsion(numelec,basisfunc,basisset);
elecelecreptest = gettestdata();
tolerance = 1.0e-4;
for i=1:4
for j=1:4
for k=1:4
for l=1:4
@test sign(elecelecrepcalc[i,j,k,l]) == sign(elecelecreptest[i,j,k,l]);
diff = abs(elecelecrepcalc[i,j,k,l]-elecelecreptest[i,j,k,l]);
@test diff <= tolerance;
end
end #k=1:4
end
end #i=1:4
end#testset
end #run_elecelecrepul_test()
"""
Test data
"""
function gettestdata()
testdata = zeros(4,4,4,4);
testdata[:,:,1,1]= [1.07657 0.57847 0.77610 0.53268;
0.57847 0.58740 0.48970 0.55254;
0.77610 0.48970 0.89630 0.51160;
0.53268 0.55254 0.51160 0.55730];
testdata[:,:,2,1] =[0.57847 0.32942 0.42735 0.30366;
0.32942 0.36130 0.28576 0.34043;
0.42735 0.28576 0.51160 0.30076;
0.30366 0.34043 0.30076 0.34503];
testdata[:,:,3,1] = [0.77610 0.42735 0.61361 0.40139;
0.42735 0.44585 0.40139 0.43066;
0.61361 0.40139 0.77610 0.42735;
0.40139 0.43066 0.42735 0.44585];
testdata[:,:,4,1] = [0.53268 0.30366 0.40139 0.28144;
0.30366 0.33360 0.27019 0.31697;
0.40139 0.27019 0.48970 0.28576;
0.28144 0.31697 0.28576 0.32383];
testdata[:,:,1,2] = [0.57847 0.32942 0.42735 0.30366;
0.32942 0.36130 0.28576 0.34043;
0.42735 0.28576 0.51160 0.30076;
0.30366 0.34043 0.30076 0.34503];
testdata[:,:,2,2] = [0.58740 0.36130 0.44585 0.33360;
0.36130 0.45315 0.32383 0.42858;
0.44585 0.32383 0.55730 0.34503;
0.33360 0.42858 0.34503 0.43911];
testdata[:,:,3,2] = [0.48970 0.28576 0.40139 0.27019;
0.28576 0.32383 0.28144 0.31697;
0.40139 0.28144 0.53268 0.30366;
0.27019 0.31697 0.30366 0.33360];
testdata[:,:,4,2] = [0.55254 0.34043 0.43066 0.31697;
0.34043 0.42858 0.31697 0.41183;
0.43066 0.31697 0.55254 0.34043;
0.31697 0.41183 0.34043 0.42858];
testdata[:,:,1,3] = [0.77610 0.42735 0.61361 0.40139;
0.42735 0.44585 0.40139 0.43066;
0.61361 0.40139 0.77610 0.42735;
0.40139 0.43066 0.42735 0.44585];
testdata[:,:,2,3] = [0.48970 0.28576 0.40139 0.27019;
0.28576 0.32383 0.28144 0.31697;
0.40139 0.28144 0.53268 0.30366;
0.27019 0.31697 0.30366 0.33360];
testdata[:,:,3,3] = [0.89630 0.51160 0.77610 0.48970;
0.51160 0.55730 0.53268 0.55254;
0.77610 0.53268 1.07657 0.57847;
0.48970 0.55254 0.57847 0.58740];
testdata[:,:,4,3] = [0.51160 0.30076 0.42735 0.28576;
0.30076 0.34503 0.30366 0.34043;
0.42735 0.30366 0.57847 0.32942;
0.28576 0.34043 0.32942 0.36130];
testdata[:,:,1,4] = [0.53268 0.30366 0.40139 0.28144;
0.30366 0.33360 0.27019 0.31697;
0.40139 0.27019 0.48970 0.28576;
0.28144 0.31697 0.28576 0.32383];
testdata[:,:,2,4] = [0.55254 0.34043 0.43066 0.31697;
0.34043 0.42858 0.31697 0.41183;
0.43066 0.31697 0.55254 0.34043;
0.31697 0.41183 0.34043 0.42858];
testdata[:,:,3,4] = [0.51160 0.30076 0.42735 0.28576;
0.30076 0.34503 0.30366 0.34043;
0.42735 0.30366 0.57847 0.32942;
0.28576 0.34043 0.32942 0.36130];
testdata[:,:,4,4] = [0.55730 0.34503 0.44585 0.32383;
0.34503 0.43911 0.33360 0.42858;
0.44585 0.33360 0.58740 0.36130;
0.32383 0.42858 0.36130 0.45315];
return testdata
end #gettestdata