1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 import sys
25
26
29 """Class for testing various aspects specific to consistency tests."""
30
31 self.relax = relax
32
33
34 if test_name == 'set':
35
36
37 self.name = "The user function value.set()"
38
39
40 self.test = self.set_value
41
42
43 if test_name == 'calc':
44
45
46 self.name = "Consistency tests calculation"
47
48
49 self.test = self.calc
50
51
52 - def calc(self, run):
66
67
69 """The consistency tests calculation sub-routine."""
70
71
72 j0 = [4.0958793960056238e-09, 3.7976266046729745e-09]
73 f_eta = [0.20302515844782615, 0.18796462392813956]
74 f_r2 = [2.0611470814962761e-09, 1.9117396355237641e-09]
75
76
77 for index,residue in enumerate(self.relax.data.res[self.run]):
78
79 if index == 0 or index == 1:
80 if not self.relax.data.res[self.run][index].select:
81 print 'Residue', self.relax.data.res[self.run][index].num, 'unexpectedly not selected'
82 return
83
84 if abs(self.relax.data.res[self.run][index].j0 - j0[index]) > j0[index]/1e6:
85 print 'Error in residue', self.relax.data.res[self.run][index].num, 'j0 calculated value'
86 return
87 if abs(self.relax.data.res[self.run][index].f_eta - f_eta[index]) > f_eta[index]/1e6:
88 print 'Error in residue', self.relax.data.res[self.run][index].num, 'f_eta calculated value'
89 return
90 if abs(self.relax.data.res[self.run][index].f_r2 - f_r2[index]) > f_r2[index]/1e6:
91 print 'Error in residue', self.relax.data.res[self.run][index].num, 'f_r2 calculated value'
92 return
93
94
95 else:
96 if self.relax.data.res[self.run][index].select:
97 print 'Residue', self.relax.data.res[self.run][index].num, 'unexpectedly selected'
98 return
99
100
101 return 1
102
103
105 """Setup for the calculation test."""
106
107
108 dir = sys.path[-1] + '/test_suite/data/jw_mapping/'
109
110 dataPaths = [dir + 'noe.dat',
111 dir + 'R1.dat',
112 dir + 'R2.dat']
113
114 dataTypes = [('NOE', '600', 600.0e6),
115 ('R1', '600', 600.0e6),
116 ('R2', '600', 600.0e6)]
117
118
119 self.relax.generic.runs.create(self.run, 'ct')
120
121
122 self.relax.interpreter._Sequence.read(self.run, file='test_seq', dir=sys.path[-1] + '/test_suite/data')
123
124
125 for dataSet in xrange(len(dataPaths)):
126 self.relax.interpreter._Relax_data.read(self.run, dataTypes[dataSet][0], dataTypes[dataSet][1], dataTypes[dataSet][2], dataPaths[dataSet])
127
128
129 self.relax.interpreter._Nuclei.nuclei('N')
130
131
132 self.relax.interpreter._Value.set(self.run, 1.02 * 1e-10, 'bond_length')
133 self.relax.interpreter._Value.set(self.run, -170 * 1e-6, 'csa')
134
135
136 self.relax.interpreter._Value.set(self.run, 15.7, 'orientation')
137
138
139 self.relax.interpreter._Value.set(self.run, 13 * 1e-9, 'tc')
140
141
142 self.relax.interpreter._Consistency_tests.set_frq(self.run, frq=600.0 * 1e6)
143
144
146 """The value.set test."""
147
148
149 self.run = run
150
151
152 self.relax.generic.runs.create(self.run, 'ct')
153
154
155 self.relax.interpreter._Sequence.read(self.run, file='test_seq', dir=sys.path[-1] + '/test_suite/data')
156
157
158 bond_length = 1.02 * 1e-10
159 csa = -170 * 1e-6
160 orientation = 15.7
161 tc = 13 * 1e-9
162 self.relax.interpreter._Value.set(self.run, bond_length, 'bond_length')
163 self.relax.interpreter._Value.set(self.run, csa, 'csa')
164 self.relax.interpreter._Value.set(self.run, orientation, 'orientation')
165 self.relax.interpreter._Value.set(self.run, tc, 'tc')
166
167
168 for i in xrange( len(self.relax.data.res[self.run]) ):
169 if self.relax.data.res[self.run][i].r != bond_length:
170 print 'Value of bond_length has not been set correctly'
171 return
172 if self.relax.data.res[self.run][i].csa != csa:
173 print 'Value of csa has not been set correctly'
174 return
175 if self.relax.data.res[self.run][i].orientation != orientation:
176 print 'Value of orientation has not been set correctly'
177 return
178 if self.relax.data.res[self.run][i].tc != tc:
179 print 'Value of tc has not been set correctly'
180 return
181
182
183 return 1
184