source: sasview/realSpaceModeling/pointsmodelpy/pointsmodelpymodule/misc.cc @ f2d6445

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since f2d6445 was f2d6445, checked in by Mathieu Doucet <doucetm@…>, 17 years ago

moving realSpaceModeling to trunk

  • Property mode set to 100644
File size: 19.2 KB
Line 
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
17char pypointsmodelpy_copyright__doc__[] = "";
18char pypointsmodelpy_copyright__name__[] = "copyright";
19
20static char pypointsmodelpy_copyright_note[] = 
21    "pointsmodelpy python module: Copyright (c) 2007 University of Tennessee";
22
23
24PyObject * 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
32char pypointsmodelpy_new_loresmodel__doc__[] = "Low-resolution shapes:real space geometric complex models";
33char pypointsmodelpy_new_loresmodel__name__[] = "new_loresmodel";
34
35PyObject * 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   
46void PyDelLores(void *ptr){
47  LORESModel * oldlores = static_cast<LORESModel *>(ptr);
48  delete oldlores;
49  return;
50}
51
52//LORESModel methods add(GeoShape &, double sld)
53char pypointsmodelpy_lores_add__name__[] = "lores_add";
54char pypointsmodelpy_lores_add__doc__[] = "loresmodel method:add(Geoshape &,sld)";
55
56PyObject * 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> &)
74char pypointsmodelpy_get_lorespoints__name__[] = "get_lorespoints";
75char pypointsmodelpy_get_lorespoints__doc__[] = "get the points from the lores model";
76
77PyObject * 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
97char pypointsmodelpy_new_pdbmodel__doc__[] = "PDB model: contain atomic coordinate from PDB file & Scattering length density";
98char pypointsmodelpy_new_pdbmodel__name__[] = "new_pdbmodel";
99
100PyObject * pypointsmodelpy_new_pdbmodel(PyObject *, PyObject *args)
101{
102  PDBModel *newpdb = new PDBModel();
103  return PyCObject_FromVoidPtr(newpdb, PyDelPDB);
104}
105   
106void PyDelPDB(void *ptr){
107  PDBModel * oldpdb = static_cast<PDBModel *>(ptr);
108  delete oldpdb;
109  return;
110}
111
112//PDBModel methods AddPDB(char * pdbfile)
113char pypointsmodelpy_pdbmodel_add__name__[] = "pdbmodel_add";
114char pypointsmodelpy_pdbmodel_add__doc__[] = "Add a structure from PDB";
115
116PyObject * 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 &)
133char pypointsmodelpy_get_pdbpoints__name__[] = "get_pdbpoints";
134char pypointsmodelpy_get_pdbpoints__doc__[] = "Get atomic points from pdb with SLD";
135
136PyObject * 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
155char pypointsmodelpy_new_complexmodel__doc__[] = "COMPLEX model: contain LORES and PDB models";
156char pypointsmodelpy_new_complexmodel__name__[] = "new_complexmodel";
157
158PyObject * pypointsmodelpy_new_complexmodel(PyObject *, PyObject *args)
159{
160  ComplexModel *newcomplex = new ComplexModel();
161  return PyCObject_FromVoidPtr(newcomplex, PyDelComplex);
162}
163   
164void PyDelComplex(void *ptr){
165  ComplexModel * oldcomplex = static_cast<ComplexModel *>(ptr);
166  delete oldcomplex;
167  return;
168}
169
170//ComplexModel methods Add(PointsModel *)
171char pypointsmodelpy_complexmodel_add__name__[] = "complexmodel_add";
172char pypointsmodelpy_complexmodel_add__doc__[] = "Add LORES model or PDB Model,type has to be specified (either PDB or LORES)";
173
174PyObject * 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 &)
201char pypointsmodelpy_get_complexpoints__name__[] = "get_complexpoints";
202char pypointsmodelpy_get_complexpoints__doc__[] = "Get points from complex model (container for LORES & PDB model)";
203
204PyObject * 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
221char pypointsmodelpy_new_point3dvec__doc__[] = "";
222char pypointsmodelpy_new_point3dvec__name__[] = "new_point3dvec";
223
224PyObject * 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
233void 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)
242char pypointsmodelpy_get_lores_pr__name__[] = "get_lores_pr";
243char pypointsmodelpy_get_lores_pr__doc__[] = "calculate distance distribution function";
244
245PyObject * 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)
262char pypointsmodelpy_distdistribution_xy__name__[] = "distdistribution_xy";
263char pypointsmodelpy_distdistribution_xy__doc__[] = "calculate distance distribution function on XY plane";
264
265PyObject * 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)
283char pypointsmodelpy_get_pdb_pr_xy__name__[] = "get_pdb_pr_xy";
284char pypointsmodelpy_get_pdb_pr_xy__doc__[] = "calculate distance distribution function on XY plane";
285
286PyObject * 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)
303char pypointsmodelpy_get_pdb_pr__name__[] = "get_pdb_pr";
304char pypointsmodelpy_get_pdb_pr__doc__[] = "calculate distance distribution function";
305
306PyObject * 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)
323char pypointsmodelpy_get_complex_pr__name__[] = "get_complex_pr";
324char pypointsmodelpy_get_complex_pr__doc__[] = "calculate distance distribution function";
325
326PyObject * 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)
343char pypointsmodelpy_get_lores_iq__name__[] = "get_lores_iq";
344char pypointsmodelpy_get_lores_iq__doc__[] = "calculate scattering intensity";
345
346PyObject * 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)
364char pypointsmodelpy_get_lores_i__name__[] = "get_lores_i";
365char pypointsmodelpy_get_lores_i__doc__[] = "calculate averaged scattering intensity from a single q";
366
367PyObject * 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)
384char pypointsmodelpy_calculateIQ_2D__name__[] = "calculateIQ_2D";
385char pypointsmodelpy_calculateIQ_2D__doc__[] = "calculate scattering intensity";
386
387PyObject * 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)
406char pypointsmodelpy_calculateI_Qxy__name__[] = "calculateI_Qxy";
407char pypointsmodelpy_calculateI_Qxy__doc__[] = "calculate scattering intensity on a 2D pixel";
408
409PyObject * 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// PDBModel method calculateIQ(iq)
427char pypointsmodelpy_get_pdb_iq__name__[] = "get_pdb_iq";
428char pypointsmodelpy_get_pdb_iq__doc__[] = "calculate scattering intensity for PDB model";
429
430PyObject * pypointsmodelpy_get_pdb_iq(PyObject *, PyObject *args)
431{
432  PyObject *pymodel = 0, *pyiq = 0;
433  int ok = PyArg_ParseTuple(args, "OO", &pymodel, &pyiq);
434  if(!ok) return NULL;
435
436  void *temp = PyCObject_AsVoidPtr(pymodel);
437  void *temp2 = PyCObject_AsVoidPtr(pyiq);
438
439  PDBModel * thispdb = static_cast<PDBModel *>(temp);
440  IQ * thisiq = static_cast<IQ *>(temp2);
441
442  thispdb->CalculateIQ(thisiq);
443
444  return Py_BuildValue("i",0);
445}
446
447// PDBModel method calculateIQ_2D(qx,qy)
448char pypointsmodelpy_get_pdb_Iqxy__name__[] = "get_pdb_Iqxy";
449char pypointsmodelpy_get_pdb_Iqxy__doc__[] = "calculate scattering intensity by a given (qx,qy) for PDB model";
450
451PyObject * pypointsmodelpy_get_pdb_Iqxy(PyObject *, PyObject *args)
452{
453  PyObject *pypdb = 0;
454  double qx = 0, qy = 0;
455  double I = 0;
456
457  int ok = PyArg_ParseTuple(args, "Odd", &pypdb, &qx,&qy);
458  if(!ok) return NULL;
459
460  void *temp = PyCObject_AsVoidPtr(pypdb);
461  PDBModel * thispdb = static_cast<PDBModel *>(temp);
462
463  I = thispdb->CalculateIQ_2D(qx,qy);
464
465  return Py_BuildValue("d",I);
466}
467
468// ComplexModel method calculateIQ(iq)
469char pypointsmodelpy_get_complex_iq__name__[] = "get_complex_iq";
470char pypointsmodelpy_get_complex_iq__doc__[] = "calculate scattering intensity for COMPLEX model";
471
472PyObject * pypointsmodelpy_get_complex_iq(PyObject *, PyObject *args)
473{
474  PyObject *pymodel = 0, *pyiq = 0;
475  int ok = PyArg_ParseTuple(args, "OO", &pymodel, &pyiq);
476  if(!ok) return NULL;
477
478  void *temp = PyCObject_AsVoidPtr(pymodel);
479  void *temp2 = PyCObject_AsVoidPtr(pyiq);
480
481  ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp);
482  IQ * thisiq = static_cast<IQ *>(temp2);
483
484  thiscomplex->CalculateIQ(thisiq);
485
486  return Py_BuildValue("i",0);
487}
488
489//LORESModel method CalculateIQ(q)
490char pypointsmodelpy_get_complex_i__name__[] = "get_complex_i";
491char pypointsmodelpy_get_complex_i__doc__[] = "calculate averaged scattering intensity from a single q";
492
493PyObject * pypointsmodelpy_get_complex_i(PyObject *, PyObject *args)
494{
495  PyObject *pylores = 0;
496  double q = 0;
497  int ok = PyArg_ParseTuple(args, "Od", &pylores, &q);
498  if(!ok) return NULL;
499
500  void *temp = PyCObject_AsVoidPtr(pylores);
501
502  ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp);
503
504  double I = thiscomplex->CalculateIQ(q);
505
506  return Py_BuildValue("d",I);
507}
508
509char pypointsmodelpy_get_complex_i_error__name__[] = "get_complex_i_error";
510char pypointsmodelpy_get_complex_i_error__doc__[] = "calculate error on averaged scattering intensity from a single q";
511
512PyObject * pypointsmodelpy_get_complex_i_error(PyObject *, PyObject *args)
513{
514  PyObject *pylores = 0;
515  double q = 0;
516  int ok = PyArg_ParseTuple(args, "Od", &pylores, &q);
517  if(!ok) return NULL;
518
519  void *temp = PyCObject_AsVoidPtr(pylores);
520
521  ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp);
522
523  double I = thiscomplex->CalculateIQError(q);
524
525  return Py_BuildValue("d",I);
526}
527
528
529
530
531//method outputPR(string filename)
532char pypointsmodelpy_outputPR__name__[] = "outputPR";
533char pypointsmodelpy_outputPR__doc__[] = "print out P(R) to a file";
534
535PyObject * pypointsmodelpy_outputPR(PyObject *, PyObject *args)
536{
537  PyObject *pymodel = 0;
538  char *outfile;
539  int ok = PyArg_ParseTuple(args, "Os", &pymodel, &outfile);
540  if(!ok) return NULL;
541
542  void *temp = PyCObject_AsVoidPtr(pymodel);
543
544  LORESModel * thislores = static_cast<LORESModel *>(temp);
545
546  thislores->OutputPR(outfile);
547
548  return Py_BuildValue("i", 0);
549}
550
551//method outputPR_xy(string filename)
552char pypointsmodelpy_outputPR_xy__name__[] = "outputPR_xy";
553char pypointsmodelpy_outputPR_xy__doc__[] = "print out P(R) to a file";
554
555PyObject * pypointsmodelpy_outputPR_xy(PyObject *, PyObject *args)
556{
557  PyObject *pyloresmodel = 0;
558  char *outfile;
559  int ok = PyArg_ParseTuple(args, "Os", &pyloresmodel, &outfile);
560  if(!ok) return NULL;
561
562  void *temp = PyCObject_AsVoidPtr(pyloresmodel);
563
564  LORESModel * thislores = static_cast<LORESModel *>(temp);
565
566  thislores->OutputPR_XY(outfile);
567
568  return Py_BuildValue("i", 0);
569}
570
571//PDBModel method outputPR(string filename)
572char pypointsmodelpy_save_pdb_pr__name__[] = "save_pdb_pr";
573char pypointsmodelpy_save_pdb_pr__doc__[] = "print out P(R) to a file";
574
575PyObject * pypointsmodelpy_save_pdb_pr(PyObject *, PyObject *args)
576{
577  PyObject *pymodel = 0;
578  char *outfile;
579  int ok = PyArg_ParseTuple(args, "Os", &pymodel, &outfile);
580  if(!ok) return NULL;
581
582  void *temp = PyCObject_AsVoidPtr(pymodel);
583
584  PDBModel * thispdb = static_cast<PDBModel *>(temp);
585
586  thispdb->OutputPR(outfile);
587
588  return Py_BuildValue("i", 0);
589}
590
591//ComplexModel method outputPR(string filename)
592char pypointsmodelpy_save_complex_pr__name__[] = "save_complex_pr";
593char pypointsmodelpy_save_complex_pr__doc__[] = "print out P(R) to a file";
594
595PyObject * pypointsmodelpy_save_complex_pr(PyObject *, PyObject *args)
596{
597  PyObject *pymodel = 0;
598  char *outfile;
599  int ok = PyArg_ParseTuple(args, "Os", &pymodel, &outfile);
600  if(!ok) return NULL;
601
602  void *temp = PyCObject_AsVoidPtr(pymodel);
603
604  ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp);
605
606  thiscomplex->OutputPR(outfile);
607
608  return Py_BuildValue("i", 0);
609}
610
611
612//method outputPDB(string filename)
613char pypointsmodelpy_outputPDB__name__[] = "outputPDB";
614char pypointsmodelpy_outputPDB__doc__[] = "save the monte-carlo distributed points of the geomodel into a PDB format file.\
615                                           a .pdb extension will be automatically added";
616
617PyObject * pypointsmodelpy_outputPDB(PyObject *, PyObject *args)
618{
619  PyObject *pyloresmodel = 0, *pypoint3dvec=0;
620  char *outfile;
621  int ok = PyArg_ParseTuple(args, "OOs", &pyloresmodel, &pypoint3dvec,&outfile);
622  if(!ok) return NULL;
623
624  void *temp = PyCObject_AsVoidPtr(pyloresmodel);
625
626  LORESModel * thislores = static_cast<LORESModel *>(temp);
627
628  void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec);
629  vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2);
630
631  thislores->OutputPDB(*thisvec,outfile);
632
633  return Py_BuildValue("i", 0);
634}
635
636// version
637// $Id$
638
639// End of file
Note: See TracBrowser for help on using the repository browser.