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