1 | // -*- C++ -*- |
---|
2 | #include <Python.h> |
---|
3 | |
---|
4 | #include <vector> |
---|
5 | #include <cstring> |
---|
6 | #include <stdexcept> |
---|
7 | #include "Point3D.h" |
---|
8 | #include "misc.h" |
---|
9 | #include "lores_model.h" |
---|
10 | #include "pdb_model.h" |
---|
11 | #include "complex_model.h" |
---|
12 | #include "geo_shape.h" |
---|
13 | #include "iq.h" |
---|
14 | |
---|
15 | // copyright |
---|
16 | |
---|
17 | char pypointsmodelpy_copyright__doc__[] = ""; |
---|
18 | char pypointsmodelpy_copyright__name__[] = "copyright"; |
---|
19 | |
---|
20 | static char pypointsmodelpy_copyright_note[] = |
---|
21 | "pointsmodelpy python module: Copyright (c) 2007 University of Tennessee"; |
---|
22 | |
---|
23 | |
---|
24 | PyObject * pypointsmodelpy_copyright(PyObject *, PyObject *) |
---|
25 | { |
---|
26 | return Py_BuildValue("s", pypointsmodelpy_copyright_note); |
---|
27 | } |
---|
28 | |
---|
29 | // new_loresmodel |
---|
30 | //wrapper for LORESModel constructor LORESModel(double density) |
---|
31 | |
---|
32 | char pypointsmodelpy_new_loresmodel__doc__[] = "Low-resolution shapes:real space geometric complex models"; |
---|
33 | char pypointsmodelpy_new_loresmodel__name__[] = "new_loresmodel"; |
---|
34 | |
---|
35 | PyObject * pypointsmodelpy_new_loresmodel(PyObject *, PyObject *args) |
---|
36 | { |
---|
37 | double density = 0; |
---|
38 | |
---|
39 | int ok = PyArg_ParseTuple(args, "d",&density); |
---|
40 | if(!ok) return NULL; |
---|
41 | |
---|
42 | LORESModel *newlores = new LORESModel(density); |
---|
43 | return PyCObject_FromVoidPtr(newlores, PyDelLores); |
---|
44 | } |
---|
45 | |
---|
46 | void PyDelLores(void *ptr){ |
---|
47 | LORESModel * oldlores = static_cast<LORESModel *>(ptr); |
---|
48 | delete oldlores; |
---|
49 | return; |
---|
50 | } |
---|
51 | |
---|
52 | //LORESModel methods add(GeoShape &, double sld) |
---|
53 | char pypointsmodelpy_lores_add__name__[] = "lores_add"; |
---|
54 | char pypointsmodelpy_lores_add__doc__[] = "loresmodel method:add(Geoshape &,sld)"; |
---|
55 | |
---|
56 | PyObject * pypointsmodelpy_lores_add(PyObject *, PyObject *args){ |
---|
57 | double sld = 1; |
---|
58 | PyObject *pyloresmodel = 0, *pyshape = 0; |
---|
59 | int ok = PyArg_ParseTuple(args, "OOd", &pyloresmodel, &pyshape, &sld); |
---|
60 | if(!ok) return NULL; |
---|
61 | |
---|
62 | void *temp = PyCObject_AsVoidPtr(pyloresmodel); |
---|
63 | void *temp2 = PyCObject_AsVoidPtr(pyshape); |
---|
64 | |
---|
65 | LORESModel * thislores = static_cast<LORESModel *>(temp); |
---|
66 | GeoShape * thisshape = static_cast<GeoShape *>(temp2); |
---|
67 | |
---|
68 | thislores->Add(*thisshape, sld); |
---|
69 | |
---|
70 | return Py_BuildValue("i", 0); |
---|
71 | } |
---|
72 | |
---|
73 | //LORESModel methods GetPoints(vector<Point3D> &) |
---|
74 | char pypointsmodelpy_get_lorespoints__name__[] = "get_lorespoints"; |
---|
75 | char pypointsmodelpy_get_lorespoints__doc__[] = "get the points from the lores model"; |
---|
76 | |
---|
77 | PyObject * pypointsmodelpy_get_lorespoints(PyObject *, PyObject *args){ |
---|
78 | PyObject *pyloresmodel = 0, *pypoint3dvec = 0; |
---|
79 | int ok = PyArg_ParseTuple(args, "OO", &pyloresmodel, &pypoint3dvec); |
---|
80 | if(!ok) return NULL; |
---|
81 | |
---|
82 | void *temp = PyCObject_AsVoidPtr(pyloresmodel); |
---|
83 | void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec); |
---|
84 | |
---|
85 | LORESModel * thislores = static_cast<LORESModel *>(temp); |
---|
86 | vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2); |
---|
87 | |
---|
88 | int npts = thislores->GetPoints(*thisvec); |
---|
89 | //temporary |
---|
90 | thislores->WritePoints2File(*thisvec); |
---|
91 | return Py_BuildValue("i", npts); |
---|
92 | } |
---|
93 | |
---|
94 | // new_pdbmodel |
---|
95 | //wrapper for PDBModel constructor PDBModel() |
---|
96 | |
---|
97 | char pypointsmodelpy_new_pdbmodel__doc__[] = "PDB model: contain atomic coordinate from PDB file & Scattering length density"; |
---|
98 | char pypointsmodelpy_new_pdbmodel__name__[] = "new_pdbmodel"; |
---|
99 | |
---|
100 | PyObject * pypointsmodelpy_new_pdbmodel(PyObject *, PyObject *args) |
---|
101 | { |
---|
102 | PDBModel *newpdb = new PDBModel(); |
---|
103 | return PyCObject_FromVoidPtr(newpdb, PyDelPDB); |
---|
104 | } |
---|
105 | |
---|
106 | void PyDelPDB(void *ptr){ |
---|
107 | PDBModel * oldpdb = static_cast<PDBModel *>(ptr); |
---|
108 | delete oldpdb; |
---|
109 | return; |
---|
110 | } |
---|
111 | |
---|
112 | //PDBModel methods AddPDB(char * pdbfile) |
---|
113 | char pypointsmodelpy_pdbmodel_add__name__[] = "pdbmodel_add"; |
---|
114 | char pypointsmodelpy_pdbmodel_add__doc__[] = "Add a structure from PDB"; |
---|
115 | |
---|
116 | PyObject * pypointsmodelpy_pdbmodel_add(PyObject *, PyObject *args){ |
---|
117 | PyObject *pypdbmodel = 0; |
---|
118 | char * pdbfile; |
---|
119 | |
---|
120 | int ok = PyArg_ParseTuple(args, "Os", &pypdbmodel, &pdbfile); |
---|
121 | if(!ok) return NULL; |
---|
122 | |
---|
123 | void *temp = PyCObject_AsVoidPtr(pypdbmodel); |
---|
124 | |
---|
125 | PDBModel * thispdb = static_cast<PDBModel *>(temp); |
---|
126 | |
---|
127 | thispdb->AddPDB(pdbfile); |
---|
128 | |
---|
129 | return Py_BuildValue("i", 0); |
---|
130 | } |
---|
131 | |
---|
132 | //PDBModel methods GetPoints(Point3DVector &) |
---|
133 | char pypointsmodelpy_get_pdbpoints__name__[] = "get_pdbpoints"; |
---|
134 | char pypointsmodelpy_get_pdbpoints__doc__[] = "Get atomic points from pdb with SLD"; |
---|
135 | |
---|
136 | PyObject * pypointsmodelpy_get_pdbpoints(PyObject *, PyObject *args){ |
---|
137 | PyObject *pypdbmodel = 0, *pypoint3dvec = 0; |
---|
138 | int ok = PyArg_ParseTuple(args, "OO", &pypdbmodel, &pypoint3dvec); |
---|
139 | if(!ok) return NULL; |
---|
140 | |
---|
141 | void *temp = PyCObject_AsVoidPtr(pypdbmodel); |
---|
142 | void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec); |
---|
143 | |
---|
144 | PDBModel * thispdb = static_cast<PDBModel *>(temp); |
---|
145 | vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2); |
---|
146 | |
---|
147 | int npts = thispdb->GetPoints(*thisvec); |
---|
148 | |
---|
149 | return Py_BuildValue("i", npts); |
---|
150 | } |
---|
151 | |
---|
152 | // new_complexmodel |
---|
153 | //wrapper for ComplexModel constructor ComplexModel() |
---|
154 | |
---|
155 | char pypointsmodelpy_new_complexmodel__doc__[] = "COMPLEX model: contain LORES and PDB models"; |
---|
156 | char pypointsmodelpy_new_complexmodel__name__[] = "new_complexmodel"; |
---|
157 | |
---|
158 | PyObject * pypointsmodelpy_new_complexmodel(PyObject *, PyObject *args) |
---|
159 | { |
---|
160 | ComplexModel *newcomplex = new ComplexModel(); |
---|
161 | return PyCObject_FromVoidPtr(newcomplex, PyDelComplex); |
---|
162 | } |
---|
163 | |
---|
164 | void PyDelComplex(void *ptr){ |
---|
165 | ComplexModel * oldcomplex = static_cast<ComplexModel *>(ptr); |
---|
166 | delete oldcomplex; |
---|
167 | return; |
---|
168 | } |
---|
169 | |
---|
170 | //ComplexModel methods Add(PointsModel *) |
---|
171 | char pypointsmodelpy_complexmodel_add__name__[] = "complexmodel_add"; |
---|
172 | char pypointsmodelpy_complexmodel_add__doc__[] = "Add LORES model or PDB Model,type has to be specified (either PDB or LORES)"; |
---|
173 | |
---|
174 | PyObject * pypointsmodelpy_complexmodel_add(PyObject *, PyObject *args){ |
---|
175 | PyObject *pycomplexmodel = 0, *pymodel = 0; |
---|
176 | char * modeltype; |
---|
177 | |
---|
178 | int ok = PyArg_ParseTuple(args, "OOs", &pycomplexmodel,&pymodel, &modeltype); |
---|
179 | if(!ok) return NULL; |
---|
180 | |
---|
181 | void *temp2 = PyCObject_AsVoidPtr(pycomplexmodel); |
---|
182 | ComplexModel *thiscomplex = static_cast<ComplexModel *>(temp2); |
---|
183 | |
---|
184 | void *temp = PyCObject_AsVoidPtr(pymodel); |
---|
185 | if (strcmp(modeltype,"LORES") == 0){ |
---|
186 | LORESModel * thislores = static_cast<LORESModel *>(temp); |
---|
187 | thiscomplex->Add(thislores); |
---|
188 | } |
---|
189 | else if (strcmp(modeltype,"PDB") == 0){ |
---|
190 | PDBModel * thispdb = static_cast<PDBModel *>(temp); |
---|
191 | thiscomplex->Add(thispdb); |
---|
192 | } |
---|
193 | else{ |
---|
194 | throw runtime_error("The model type is either PDB or LORES"); |
---|
195 | } |
---|
196 | |
---|
197 | return Py_BuildValue("i", 0); |
---|
198 | } |
---|
199 | |
---|
200 | //ComplexModel methods GetPoints(Point3DVector &) |
---|
201 | char pypointsmodelpy_get_complexpoints__name__[] = "get_complexpoints"; |
---|
202 | char pypointsmodelpy_get_complexpoints__doc__[] = "Get points from complex model (container for LORES & PDB model)"; |
---|
203 | |
---|
204 | PyObject * pypointsmodelpy_get_complexpoints(PyObject *, PyObject *args){ |
---|
205 | PyObject *pycomplexmodel = 0, *pypoint3dvec = 0; |
---|
206 | int ok = PyArg_ParseTuple(args, "OO", &pycomplexmodel, &pypoint3dvec); |
---|
207 | if(!ok) return NULL; |
---|
208 | |
---|
209 | void *temp = PyCObject_AsVoidPtr(pycomplexmodel); |
---|
210 | void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec); |
---|
211 | |
---|
212 | ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp); |
---|
213 | vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2); |
---|
214 | |
---|
215 | int npts = thiscomplex->GetPoints(*thisvec); |
---|
216 | |
---|
217 | return Py_BuildValue("i", npts); |
---|
218 | } |
---|
219 | |
---|
220 | //create a new vector that holds of class Point3D objects |
---|
221 | char pypointsmodelpy_new_point3dvec__doc__[] = ""; |
---|
222 | char pypointsmodelpy_new_point3dvec__name__[] = "new_point3dvec"; |
---|
223 | |
---|
224 | PyObject * pypointsmodelpy_new_point3dvec(PyObject *, PyObject *args) |
---|
225 | { |
---|
226 | PyObject *pyvec = 0; |
---|
227 | |
---|
228 | vector<Point3D> *newvec = new vector<Point3D>(); |
---|
229 | |
---|
230 | return PyCObject_FromVoidPtr(newvec, PyDelPoint3DVec); |
---|
231 | } |
---|
232 | |
---|
233 | void PyDelPoint3DVec(void *ptr) |
---|
234 | { |
---|
235 | vector<Point3D> * oldvec = static_cast<vector<Point3D> *>(ptr); |
---|
236 | delete oldvec; |
---|
237 | return; |
---|
238 | |
---|
239 | } |
---|
240 | |
---|
241 | //LORESModel method distribution(point3dvec) |
---|
242 | char pypointsmodelpy_get_lores_pr__name__[] = "get_lores_pr"; |
---|
243 | char pypointsmodelpy_get_lores_pr__doc__[] = "calculate distance distribution function"; |
---|
244 | |
---|
245 | PyObject * pypointsmodelpy_get_lores_pr(PyObject *, PyObject *args) |
---|
246 | { |
---|
247 | PyObject *pymodel = 0, *pypoint3dvec = 0; |
---|
248 | int ok = PyArg_ParseTuple(args, "OO", &pymodel, &pypoint3dvec); |
---|
249 | if(!ok) return NULL; |
---|
250 | |
---|
251 | void *temp = PyCObject_AsVoidPtr(pymodel); |
---|
252 | void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec); |
---|
253 | vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2); |
---|
254 | |
---|
255 | LORESModel * thislores = static_cast<LORESModel *>(temp); |
---|
256 | double rmax = thislores->DistDistribution(*thisvec); |
---|
257 | |
---|
258 | return Py_BuildValue("d", rmax); |
---|
259 | } |
---|
260 | |
---|
261 | //LORESModel method distribution_xy(point3dvec) |
---|
262 | char pypointsmodelpy_distdistribution_xy__name__[] = "distdistribution_xy"; |
---|
263 | char pypointsmodelpy_distdistribution_xy__doc__[] = "calculate distance distribution function on XY plane"; |
---|
264 | |
---|
265 | PyObject * pypointsmodelpy_distdistribution_xy(PyObject *, PyObject *args) |
---|
266 | { |
---|
267 | PyObject *pymodel = 0, *pypoint3dvec = 0; |
---|
268 | int ok = PyArg_ParseTuple(args, "OO", &pymodel, &pypoint3dvec); |
---|
269 | if(!ok) return NULL; |
---|
270 | |
---|
271 | void *temp = PyCObject_AsVoidPtr(pymodel); |
---|
272 | void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec); |
---|
273 | |
---|
274 | LORESModel * thislores = static_cast<LORESModel *>(temp); |
---|
275 | |
---|
276 | vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2); |
---|
277 | thislores->DistDistributionXY(*thisvec); |
---|
278 | |
---|
279 | return Py_BuildValue("i", 0); |
---|
280 | } |
---|
281 | |
---|
282 | //PDBModel method distribution_xy(point3dvec) |
---|
283 | char pypointsmodelpy_get_pdb_pr_xy__name__[] = "get_pdb_pr_xy"; |
---|
284 | char pypointsmodelpy_get_pdb_pr_xy__doc__[] = "calculate distance distribution function on XY plane"; |
---|
285 | |
---|
286 | PyObject * pypointsmodelpy_get_pdb_pr_xy(PyObject *, PyObject *args) |
---|
287 | { |
---|
288 | PyObject *pymodel = 0, *pypoint3dvec = 0; |
---|
289 | int ok = PyArg_ParseTuple(args, "OO", &pymodel, &pypoint3dvec); |
---|
290 | if(!ok) return NULL; |
---|
291 | |
---|
292 | void *temp = PyCObject_AsVoidPtr(pymodel); |
---|
293 | void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec); |
---|
294 | vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2); |
---|
295 | |
---|
296 | PDBModel * thispdb = static_cast<PDBModel *>(temp); |
---|
297 | thispdb->DistDistributionXY(*thisvec); |
---|
298 | |
---|
299 | return Py_BuildValue("i", 0); |
---|
300 | } |
---|
301 | |
---|
302 | //PDBModel method distribution(point3dvec) |
---|
303 | char pypointsmodelpy_get_pdb_pr__name__[] = "get_pdb_pr"; |
---|
304 | char pypointsmodelpy_get_pdb_pr__doc__[] = "calculate distance distribution function"; |
---|
305 | |
---|
306 | PyObject * pypointsmodelpy_get_pdb_pr(PyObject *, PyObject *args) |
---|
307 | { |
---|
308 | PyObject *pymodel = 0, *pypoint3dvec = 0; |
---|
309 | int ok = PyArg_ParseTuple(args, "OO", &pymodel, &pypoint3dvec); |
---|
310 | if(!ok) return NULL; |
---|
311 | |
---|
312 | void *temp = PyCObject_AsVoidPtr(pymodel); |
---|
313 | void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec); |
---|
314 | vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2); |
---|
315 | |
---|
316 | PDBModel * thispdb = static_cast<PDBModel *>(temp); |
---|
317 | thispdb->DistDistribution(*thisvec); |
---|
318 | |
---|
319 | return Py_BuildValue("i", 0); |
---|
320 | } |
---|
321 | |
---|
322 | //ComplexModel method distribution(point3dvec) |
---|
323 | char pypointsmodelpy_get_complex_pr__name__[] = "get_complex_pr"; |
---|
324 | char pypointsmodelpy_get_complex_pr__doc__[] = "calculate distance distribution function"; |
---|
325 | |
---|
326 | PyObject * pypointsmodelpy_get_complex_pr(PyObject *, PyObject *args) |
---|
327 | { |
---|
328 | PyObject *pymodel = 0, *pypoint3dvec = 0; |
---|
329 | int ok = PyArg_ParseTuple(args, "OO", &pymodel, &pypoint3dvec); |
---|
330 | if(!ok) return NULL; |
---|
331 | |
---|
332 | void *temp = PyCObject_AsVoidPtr(pymodel); |
---|
333 | void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec); |
---|
334 | vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2); |
---|
335 | |
---|
336 | ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp); |
---|
337 | thiscomplex->DistDistribution(*thisvec); |
---|
338 | |
---|
339 | return Py_BuildValue("i", 0); |
---|
340 | } |
---|
341 | |
---|
342 | //LORESModel method CalculateIQ(iq) |
---|
343 | char pypointsmodelpy_get_lores_iq__name__[] = "get_lores_iq"; |
---|
344 | char pypointsmodelpy_get_lores_iq__doc__[] = "calculate scattering intensity"; |
---|
345 | |
---|
346 | PyObject * pypointsmodelpy_get_lores_iq(PyObject *, PyObject *args) |
---|
347 | { |
---|
348 | PyObject *pylores = 0, *pyiq = 0; |
---|
349 | int ok = PyArg_ParseTuple(args, "OO", &pylores, &pyiq); |
---|
350 | if(!ok) return NULL; |
---|
351 | |
---|
352 | void *temp = PyCObject_AsVoidPtr(pylores); |
---|
353 | void *temp2 = PyCObject_AsVoidPtr(pyiq); |
---|
354 | |
---|
355 | LORESModel * thislores = static_cast<LORESModel *>(temp); |
---|
356 | IQ * thisiq = static_cast<IQ *>(temp2); |
---|
357 | |
---|
358 | thislores->CalculateIQ(thisiq); |
---|
359 | |
---|
360 | return Py_BuildValue("i",0); |
---|
361 | } |
---|
362 | |
---|
363 | //LORESModel method CalculateIQ(q) |
---|
364 | char pypointsmodelpy_get_lores_i__name__[] = "get_lores_i"; |
---|
365 | char pypointsmodelpy_get_lores_i__doc__[] = "calculate averaged scattering intensity from a single q"; |
---|
366 | |
---|
367 | PyObject * pypointsmodelpy_get_lores_i(PyObject *, PyObject *args) |
---|
368 | { |
---|
369 | PyObject *pylores = 0; |
---|
370 | double q = 0; |
---|
371 | int ok = PyArg_ParseTuple(args, "Od", &pylores, &q); |
---|
372 | if(!ok) return NULL; |
---|
373 | |
---|
374 | void *temp = PyCObject_AsVoidPtr(pylores); |
---|
375 | |
---|
376 | LORESModel * thislores = static_cast<LORESModel *>(temp); |
---|
377 | |
---|
378 | double I = thislores->CalculateIQ(q); |
---|
379 | |
---|
380 | return Py_BuildValue("d",I); |
---|
381 | } |
---|
382 | |
---|
383 | // method calculateIQ_2D(iq) |
---|
384 | char pypointsmodelpy_calculateIQ_2D__name__[] = "calculateIQ_2D"; |
---|
385 | char pypointsmodelpy_calculateIQ_2D__doc__[] = "calculate scattering intensity"; |
---|
386 | |
---|
387 | PyObject * pypointsmodelpy_calculateIQ_2D(PyObject *, PyObject *args) |
---|
388 | { |
---|
389 | PyObject *pylores = 0, *pyiq = 0; |
---|
390 | double theta = 0; |
---|
391 | int ok = PyArg_ParseTuple(args, "OOd", &pylores, &pyiq,&theta); |
---|
392 | if(!ok) return NULL; |
---|
393 | |
---|
394 | void *temp = PyCObject_AsVoidPtr(pylores); |
---|
395 | void *temp2 = PyCObject_AsVoidPtr(pyiq); |
---|
396 | |
---|
397 | LORESModel * thislores = static_cast<LORESModel *>(temp); |
---|
398 | IQ * thisiq = static_cast<IQ *>(temp2); |
---|
399 | |
---|
400 | thislores->CalculateIQ_2D(thisiq,theta); |
---|
401 | |
---|
402 | return Py_BuildValue("i",0); |
---|
403 | } |
---|
404 | |
---|
405 | // method calculateI_Qxy(Qx,Qy) |
---|
406 | char pypointsmodelpy_calculateI_Qxy__name__[] = "calculateI_Qxy"; |
---|
407 | char pypointsmodelpy_calculateI_Qxy__doc__[] = "calculate scattering intensity on a 2D pixel"; |
---|
408 | |
---|
409 | PyObject * pypointsmodelpy_calculateI_Qxy(PyObject *, PyObject *args) |
---|
410 | { |
---|
411 | PyObject *pylores = 0; |
---|
412 | double qx = 0, qy = 0; |
---|
413 | double I = 0; |
---|
414 | |
---|
415 | int ok = PyArg_ParseTuple(args, "Odd", &pylores, &qx,&qy); |
---|
416 | if(!ok) return NULL; |
---|
417 | |
---|
418 | void *temp = PyCObject_AsVoidPtr(pylores); |
---|
419 | LORESModel * thislores = static_cast<LORESModel *>(temp); |
---|
420 | |
---|
421 | I = thislores->CalculateIQ_2D(qx,qy); |
---|
422 | |
---|
423 | return Py_BuildValue("d",I); |
---|
424 | } |
---|
425 | |
---|
426 | // method calculateI_Qxy(poitns, Qx,Qy) |
---|
427 | char pypointsmodelpy_calculateI_Qvxy__name__[] = "calculateI_Qvxy"; |
---|
428 | char pypointsmodelpy_calculateI_Qvxy__doc__[] = "calculate scattering intensity on a 2D pixel"; |
---|
429 | |
---|
430 | PyObject * pypointsmodelpy_calculateI_Qvxy(PyObject *, PyObject *args) |
---|
431 | { |
---|
432 | PyObject *pylores = 0, *pypoint3dvec = 0; |
---|
433 | double qx = 0, qy = 0; |
---|
434 | double I = 0; |
---|
435 | |
---|
436 | int ok = PyArg_ParseTuple(args, "OOdd", &pylores, &pypoint3dvec, &qx,&qy); |
---|
437 | if(!ok) return NULL; |
---|
438 | |
---|
439 | void *temp = PyCObject_AsVoidPtr(pylores); |
---|
440 | LORESModel * thislores = static_cast<LORESModel *>(temp); |
---|
441 | void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec); |
---|
442 | vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2); |
---|
443 | |
---|
444 | I = thislores->CalculateIQ_2D(*thisvec, qx,qy); |
---|
445 | |
---|
446 | return Py_BuildValue("d",I); |
---|
447 | } |
---|
448 | |
---|
449 | // PDBModel method calculateIQ(iq) |
---|
450 | char pypointsmodelpy_get_pdb_iq__name__[] = "get_pdb_iq"; |
---|
451 | char pypointsmodelpy_get_pdb_iq__doc__[] = "calculate scattering intensity for PDB model"; |
---|
452 | |
---|
453 | PyObject * pypointsmodelpy_get_pdb_iq(PyObject *, PyObject *args) |
---|
454 | { |
---|
455 | PyObject *pymodel = 0, *pyiq = 0; |
---|
456 | int ok = PyArg_ParseTuple(args, "OO", &pymodel, &pyiq); |
---|
457 | if(!ok) return NULL; |
---|
458 | |
---|
459 | void *temp = PyCObject_AsVoidPtr(pymodel); |
---|
460 | void *temp2 = PyCObject_AsVoidPtr(pyiq); |
---|
461 | |
---|
462 | PDBModel * thispdb = static_cast<PDBModel *>(temp); |
---|
463 | IQ * thisiq = static_cast<IQ *>(temp2); |
---|
464 | |
---|
465 | thispdb->CalculateIQ(thisiq); |
---|
466 | |
---|
467 | return Py_BuildValue("i",0); |
---|
468 | } |
---|
469 | |
---|
470 | // PDBModel method calculateIQ_2D(qx,qy) |
---|
471 | char pypointsmodelpy_get_pdb_Iqxy__name__[] = "get_pdb_Iqxy"; |
---|
472 | char pypointsmodelpy_get_pdb_Iqxy__doc__[] = "calculate scattering intensity by a given (qx,qy) for PDB model"; |
---|
473 | |
---|
474 | PyObject * pypointsmodelpy_get_pdb_Iqxy(PyObject *, PyObject *args) |
---|
475 | { |
---|
476 | PyObject *pypdb = 0; |
---|
477 | double qx = 0, qy = 0; |
---|
478 | double I = 0; |
---|
479 | |
---|
480 | int ok = PyArg_ParseTuple(args, "Odd", &pypdb, &qx,&qy); |
---|
481 | if(!ok) return NULL; |
---|
482 | |
---|
483 | void *temp = PyCObject_AsVoidPtr(pypdb); |
---|
484 | PDBModel * thispdb = static_cast<PDBModel *>(temp); |
---|
485 | |
---|
486 | I = thispdb->CalculateIQ_2D(qx,qy); |
---|
487 | |
---|
488 | return Py_BuildValue("d",I); |
---|
489 | } |
---|
490 | |
---|
491 | // PDBModel method calculateIQ_2Dv(points,qx,qy) |
---|
492 | char pypointsmodelpy_get_pdb_Iqvxy__name__[] = "get_pdb_Iqvxy"; |
---|
493 | char pypointsmodelpy_get_pdb_Iqvxy__doc__[] = "calculate scattering intensity by a given (qx,qy) for PDB model"; |
---|
494 | |
---|
495 | PyObject * pypointsmodelpy_get_pdb_Iqvxy(PyObject *, PyObject *args) |
---|
496 | { |
---|
497 | PyObject *pypdb = 0, *pypoint3dvec = 0; |
---|
498 | double qx = 0, qy = 0; |
---|
499 | double I = 0; |
---|
500 | |
---|
501 | int ok = PyArg_ParseTuple(args, "OOdd", &pypdb, &pypoint3dvec, &qx,&qy); |
---|
502 | if(!ok) return NULL; |
---|
503 | |
---|
504 | void *temp = PyCObject_AsVoidPtr(pypdb); |
---|
505 | PDBModel * thispdb = static_cast<PDBModel *>(temp); |
---|
506 | void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec); |
---|
507 | vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2); |
---|
508 | |
---|
509 | I = thispdb->CalculateIQ_2D(*thisvec,qx,qy); |
---|
510 | |
---|
511 | return Py_BuildValue("d",I); |
---|
512 | } |
---|
513 | |
---|
514 | // ComplexModel method calculateIQ(iq) |
---|
515 | char pypointsmodelpy_get_complex_iq__name__[] = "get_complex_iq"; |
---|
516 | char pypointsmodelpy_get_complex_iq__doc__[] = "calculate scattering intensity for COMPLEX model"; |
---|
517 | |
---|
518 | PyObject * pypointsmodelpy_get_complex_iq(PyObject *, PyObject *args) |
---|
519 | { |
---|
520 | PyObject *pymodel = 0, *pyiq = 0; |
---|
521 | int ok = PyArg_ParseTuple(args, "OO", &pymodel, &pyiq); |
---|
522 | if(!ok) return NULL; |
---|
523 | |
---|
524 | void *temp = PyCObject_AsVoidPtr(pymodel); |
---|
525 | void *temp2 = PyCObject_AsVoidPtr(pyiq); |
---|
526 | |
---|
527 | ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp); |
---|
528 | IQ * thisiq = static_cast<IQ *>(temp2); |
---|
529 | |
---|
530 | thiscomplex->CalculateIQ(thisiq); |
---|
531 | |
---|
532 | return Py_BuildValue("i",0); |
---|
533 | } |
---|
534 | |
---|
535 | //LORESModel method CalculateIQ_2D(points,qx,qy) |
---|
536 | char pypointsmodelpy_get_complex_Iqxy__name__[] = "get_complex_iq_2D"; |
---|
537 | char pypointsmodelpy_get_complex_Iqxy__doc__[] = "calculate averaged scattering intensity from a single q"; |
---|
538 | |
---|
539 | PyObject * pypointsmodelpy_get_complex_Iqxy(PyObject *, PyObject *args) |
---|
540 | { |
---|
541 | PyObject *pylores = 0, *pypoint3dvec = 0; |
---|
542 | double qx = 0, qy = 0; |
---|
543 | int ok = PyArg_ParseTuple(args, "OOdd", &pylores, &pypoint3dvec, &qx, &qy); |
---|
544 | if(!ok) return NULL; |
---|
545 | |
---|
546 | void *temp = PyCObject_AsVoidPtr(pylores); |
---|
547 | ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp); |
---|
548 | void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec); |
---|
549 | vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2); |
---|
550 | |
---|
551 | double I = thiscomplex->CalculateIQ_2D(*thisvec,qx,qy); |
---|
552 | |
---|
553 | return Py_BuildValue("d",I); |
---|
554 | } |
---|
555 | |
---|
556 | //LORESModel method CalculateIQ(q) |
---|
557 | char pypointsmodelpy_get_complex_i__name__[] = "get_complex_i"; |
---|
558 | char pypointsmodelpy_get_complex_i__doc__[] = "calculate averaged scattering intensity from a single q"; |
---|
559 | |
---|
560 | PyObject * pypointsmodelpy_get_complex_i(PyObject *, PyObject *args) |
---|
561 | { |
---|
562 | PyObject *pylores = 0; |
---|
563 | double q = 0; |
---|
564 | int ok = PyArg_ParseTuple(args, "Od", &pylores, &q); |
---|
565 | if(!ok) return NULL; |
---|
566 | |
---|
567 | void *temp = PyCObject_AsVoidPtr(pylores); |
---|
568 | |
---|
569 | ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp); |
---|
570 | |
---|
571 | double I = thiscomplex->CalculateIQ(q); |
---|
572 | |
---|
573 | return Py_BuildValue("d",I); |
---|
574 | } |
---|
575 | |
---|
576 | char pypointsmodelpy_get_complex_i_error__name__[] = "get_complex_i_error"; |
---|
577 | char pypointsmodelpy_get_complex_i_error__doc__[] = "calculate error on averaged scattering intensity from a single q"; |
---|
578 | |
---|
579 | PyObject * pypointsmodelpy_get_complex_i_error(PyObject *, PyObject *args) |
---|
580 | { |
---|
581 | PyObject *pylores = 0; |
---|
582 | double q = 0; |
---|
583 | int ok = PyArg_ParseTuple(args, "Od", &pylores, &q); |
---|
584 | if(!ok) return NULL; |
---|
585 | |
---|
586 | void *temp = PyCObject_AsVoidPtr(pylores); |
---|
587 | |
---|
588 | ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp); |
---|
589 | |
---|
590 | double I = thiscomplex->CalculateIQError(q); |
---|
591 | |
---|
592 | return Py_BuildValue("d",I); |
---|
593 | } |
---|
594 | |
---|
595 | |
---|
596 | |
---|
597 | |
---|
598 | //method outputPR(string filename) |
---|
599 | char pypointsmodelpy_outputPR__name__[] = "outputPR"; |
---|
600 | char pypointsmodelpy_outputPR__doc__[] = "print out P(R) to a file"; |
---|
601 | |
---|
602 | PyObject * pypointsmodelpy_outputPR(PyObject *, PyObject *args) |
---|
603 | { |
---|
604 | PyObject *pymodel = 0; |
---|
605 | char *outfile; |
---|
606 | int ok = PyArg_ParseTuple(args, "Os", &pymodel, &outfile); |
---|
607 | if(!ok) return NULL; |
---|
608 | |
---|
609 | void *temp = PyCObject_AsVoidPtr(pymodel); |
---|
610 | |
---|
611 | LORESModel * thislores = static_cast<LORESModel *>(temp); |
---|
612 | |
---|
613 | thislores->OutputPR(outfile); |
---|
614 | |
---|
615 | return Py_BuildValue("i", 0); |
---|
616 | } |
---|
617 | |
---|
618 | //method outputPR_xy(string filename) |
---|
619 | char pypointsmodelpy_outputPR_xy__name__[] = "outputPR_xy"; |
---|
620 | char pypointsmodelpy_outputPR_xy__doc__[] = "print out P(R) to a file"; |
---|
621 | |
---|
622 | PyObject * pypointsmodelpy_outputPR_xy(PyObject *, PyObject *args) |
---|
623 | { |
---|
624 | PyObject *pyloresmodel = 0; |
---|
625 | char *outfile; |
---|
626 | int ok = PyArg_ParseTuple(args, "Os", &pyloresmodel, &outfile); |
---|
627 | if(!ok) return NULL; |
---|
628 | |
---|
629 | void *temp = PyCObject_AsVoidPtr(pyloresmodel); |
---|
630 | |
---|
631 | LORESModel * thislores = static_cast<LORESModel *>(temp); |
---|
632 | |
---|
633 | thislores->OutputPR_XY(outfile); |
---|
634 | |
---|
635 | return Py_BuildValue("i", 0); |
---|
636 | } |
---|
637 | |
---|
638 | //PDBModel method outputPR(string filename) |
---|
639 | char pypointsmodelpy_save_pdb_pr__name__[] = "save_pdb_pr"; |
---|
640 | char pypointsmodelpy_save_pdb_pr__doc__[] = "print out P(R) to a file"; |
---|
641 | |
---|
642 | PyObject * pypointsmodelpy_save_pdb_pr(PyObject *, PyObject *args) |
---|
643 | { |
---|
644 | PyObject *pymodel = 0; |
---|
645 | char *outfile; |
---|
646 | int ok = PyArg_ParseTuple(args, "Os", &pymodel, &outfile); |
---|
647 | if(!ok) return NULL; |
---|
648 | |
---|
649 | void *temp = PyCObject_AsVoidPtr(pymodel); |
---|
650 | |
---|
651 | PDBModel * thispdb = static_cast<PDBModel *>(temp); |
---|
652 | |
---|
653 | thispdb->OutputPR(outfile); |
---|
654 | |
---|
655 | return Py_BuildValue("i", 0); |
---|
656 | } |
---|
657 | |
---|
658 | //ComplexModel method outputPR(string filename) |
---|
659 | char pypointsmodelpy_save_complex_pr__name__[] = "save_complex_pr"; |
---|
660 | char pypointsmodelpy_save_complex_pr__doc__[] = "print out P(R) to a file"; |
---|
661 | |
---|
662 | PyObject * pypointsmodelpy_save_complex_pr(PyObject *, PyObject *args) |
---|
663 | { |
---|
664 | PyObject *pymodel = 0; |
---|
665 | char *outfile; |
---|
666 | int ok = PyArg_ParseTuple(args, "Os", &pymodel, &outfile); |
---|
667 | if(!ok) return NULL; |
---|
668 | |
---|
669 | void *temp = PyCObject_AsVoidPtr(pymodel); |
---|
670 | |
---|
671 | ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp); |
---|
672 | |
---|
673 | thiscomplex->OutputPR(outfile); |
---|
674 | |
---|
675 | return Py_BuildValue("i", 0); |
---|
676 | } |
---|
677 | |
---|
678 | |
---|
679 | //method outputPDB(string filename) |
---|
680 | char pypointsmodelpy_outputPDB__name__[] = "outputPDB"; |
---|
681 | char pypointsmodelpy_outputPDB__doc__[] = "save the monte-carlo distributed points of the geomodel into a PDB format file.\ |
---|
682 | a .pdb extension will be automatically added"; |
---|
683 | |
---|
684 | PyObject * pypointsmodelpy_outputPDB(PyObject *, PyObject *args) |
---|
685 | { |
---|
686 | PyObject *pyloresmodel = 0, *pypoint3dvec=0; |
---|
687 | char *outfile; |
---|
688 | int ok = PyArg_ParseTuple(args, "OOs", &pyloresmodel, &pypoint3dvec,&outfile); |
---|
689 | if(!ok) return NULL; |
---|
690 | |
---|
691 | void *temp = PyCObject_AsVoidPtr(pyloresmodel); |
---|
692 | |
---|
693 | LORESModel * thislores = static_cast<LORESModel *>(temp); |
---|
694 | |
---|
695 | void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec); |
---|
696 | vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2); |
---|
697 | |
---|
698 | thislores->OutputPDB(*thisvec,outfile); |
---|
699 | |
---|
700 | return Py_BuildValue("i", 0); |
---|
701 | } |
---|
702 | |
---|
703 | // version |
---|
704 | // $Id$ |
---|
705 | |
---|
706 | // End of file |
---|