File: PyMOL.h

package info (click to toggle)
pymol 1.7.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 42,668 kB
  • ctags: 25,775
  • sloc: ansic: 494,779; python: 75,446; cpp: 20,088; makefile: 351; sh: 172; csh: 21
file content (538 lines) | stat: -rw-r--r-- 19,679 bytes parent folder | download
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538

/* 
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* Copyright (c) Schrodinger, LLC. 
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information. 
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-* 
-* 
-*
Z* -------------------------------------------------------------------
*/

#ifndef _H_CPyMOL
#define _H_CPyMOL


/* WARNING: DO NOT DEVELOP APPLICATIONS AGAINST THIS PyMOL_* API.  
 * 
 * This is a internal interface to PyMOL for the exclusive use of
 * Schrodinger, LLC in development of PyMOL itself, for
 * development of "wrapped" PyMOL products, and for use as foundation
 * layer for support of stable public APIs.
 *
 * Schrodinger, LLC changes this interface regularly and without
 * notice.  It may even vanish altogether.  Code you develop against
 * this interface is likely to be fragile, time-consuming, and
 * expensive to maintain.
 *
 * Our recommended public APIs for PyMOL development are Python-based:
 * (#1) the old "from pymol import cmd" module-based interface, or
 * (#2) the new "from pymol2 import PyMOL; cmd=PyMOL().cmd"
 * instance-based interface.  If you need a C, C++, Java, or
 * ActiveX/COM interface or widget for molecular visualization, then
 * please contact sales@pymol.org about obtaining access to our
 * independent developer and/or OEM product APIs (e.g. JyMOL).
 * 
 * If you feel that you absolutely must rely upon this PyMOL_* API,
 * then please be sure to create your own lightweight wrapper layer
 * around it so that the rest of your code will be relatively
 * insensitive to changes made here.  Failure to do so will almost
 * certainly result in code that is impossible to maintain over time.
 *
 * You have been warned!
 */

#define PYMOL_BUTTON_DOWN           0
#define PYMOL_BUTTON_UP             1

#define PYMOL_KEY_F1         1
#define PYMOL_KEY_F2         2
#define PYMOL_KEY_F3         3
#define PYMOL_KEY_F4         4
#define PYMOL_KEY_F5         5
#define PYMOL_KEY_F6         6
#define PYMOL_KEY_F7         7
#define PYMOL_KEY_F8         8
#define PYMOL_KEY_F9         9
#define PYMOL_KEY_F10        10
#define PYMOL_KEY_F11        11
#define PYMOL_KEY_F12        12
#define PYMOL_KEY_LEFT       100
#define PYMOL_KEY_UP         101
#define PYMOL_KEY_RIGHT      102
#define PYMOL_KEY_DOWN       103
#define PYMOL_KEY_PAGE_UP    104
#define PYMOL_KEY_PAGE_DOWN  105
#define PYMOL_KEY_HOME       106
#define PYMOL_KEY_END        107
#define PYMOL_KEY_INSERT     108

#define PYMOL_BUTTON_LEFT    0
#define PYMOL_BUTTON_MIDDLE  1
#define PYMOL_BUTTON_RIGHT   2
#define PYMOL_BUTTON_SCROLL_FORWARD 3
#define PYMOL_BUTTON_SCROLL_REVERSE 4

#define PYMOL_MODIFIER_SHIFT   1
#define PYMOL_MODIFIER_CTRL    2
#define PYMOL_MODIFIER_ALT     4

#define PYMOL_FALSE    0
#define PYMOL_TRUE     1

#define PYMOL_DEFAULT  -1

#define PYMOL_PROGRESS_SLOW 0
#define PYMOL_PROGRESS_MED  2
#define PYMOL_PROGRESS_FAST 4

#define PYMOL_PROGRESS_SIZE 6
#define PYMOL_RESHAPE_SIZE 5


/* configuration */

#ifndef CPyMOLOptions_DEFINED
typedef struct _CPyMOLOptions CPyMOLOptions;
#define CPyMOLOptions_DEFINED
#endif

CPyMOLOptions *PyMOLOptions_New(void);
void PyMOLOptions_Free(CPyMOLOptions * option);

#ifndef PYMOL_NO_PY
CPyMOLOptions *PyMOLOptions_NewWithPython(int argc, char *argv[]);
#endif


/* PyMOL instance type */

#ifndef CPyMOL_DEFINED
typedef struct _CPyMOL CPyMOL;
#define CPyMOL_DEFINED
#endif


/* return status values */

#define PyMOLstatus_YES               1
#define PyMOLstatus_NO                0

#define PyMOLstatus_SUCCESS           0
#define PyMOLstatus_FAILURE          -1


/* return types */

typedef int PyMOLstatus;

typedef struct {
  PyMOLstatus status;
} PyMOLreturn_status;

typedef struct {
  PyMOLstatus status;
  int value;
} PyMOLreturn_int;

typedef struct {
  PyMOLstatus status;
  float value;
} PyMOLreturn_float;

typedef struct {
  PyMOLstatus status;
  int size;
  float *array;
} PyMOLreturn_float_array;

typedef struct {
  PyMOLstatus status;
  int size;
  int *array;
} PyMOLreturn_int_array;

typedef struct {
  PyMOLstatus status;
  int size;
  char **array;
} PyMOLreturn_string_array;

#define PYMOL_RETURN_VALUE_IS_STRING       0x01
#define PYMOL_RETURN_VALUE_IS_INT          0x02
#define PYMOL_RETURN_VALUE_IS_FLOAT        0x04
#define PYMOL_RETURN_VALUE_IS_FLOAT_ARRAY  0x08

typedef struct {
  PyMOLstatus status;
  short int type;
  char *string;
  int int_value;
  float float_value;
  int array_length;
  float *float_array;
} PyMOLreturn_value;

typedef void PyMOLModalDrawFn(void *G);


/* creation */

CPyMOL *PyMOL_New(void);
CPyMOL *PyMOL_NewWithOptions(CPyMOLOptions * option);


/* destruction */

void PyMOL_Free(CPyMOL * I);


/* starting and stopping */

void PyMOL_Start(CPyMOL * I);
void PyMOL_ConfigureShadersGL(CPyMOL * I);
#ifndef PYMOL_NO_PY
void PyMOL_StartWithPython(CPyMOL * I);
#endif
void PyMOL_Stop(CPyMOL * I);


/* upstream invalidation and configuration events */

void PyMOL_NeedFakeDrag(CPyMOL * I);
void PyMOL_NeedRedisplay(CPyMOL * I);
void PyMOL_NeedSwap(CPyMOL * I);
void PyMOL_SetClickReady(CPyMOL * I, char *name, int index, int button, int mod, int x,
                         int y, float *pos, int state);
void PyMOL_SetPassive(CPyMOL * I, int onOff);
void PyMOL_NeedReshape(CPyMOL * I, int mode, int x, int y, int width, int height);


/* valid context management */

void PyMOL_PushValidContext(CPyMOL * I);
void PyMOL_PopValidContext(CPyMOL * I);


/* methods requiring a valid OpenGL context*/

void PyMOL_AdaptToHardware(CPyMOL * I);
void PyMOL_Draw(CPyMOL * I);


/* methods that do not require a valid OpenGL context */

void PyMOL_Key(CPyMOL * I, unsigned char k, int x, int y, int modifiers);
void PyMOL_Special(CPyMOL * I, int k, int x, int y, int modifiers);
void PyMOL_Reshape(CPyMOL * I, int width, int height, int force);
void PyMOL_Drag(CPyMOL * I, int x, int y, int modifiers);
void PyMOL_Button(CPyMOL * I, int button, int state, int x, int y, int modifiers);
int PyMOL_Idle(CPyMOL * I);     /* return true if PyMOL is busy doing real
                                   work (not simply racing the CPU) */

void PyMOL_ExpireIfIdle(CPyMOL * I);    /* auto-termination for command-line mode */

typedef void PyMOLSwapBuffersFn(void);

void PyMOL_SetSwapBuffersFn(CPyMOL * I, PyMOLSwapBuffersFn * fn);
void PyMOL_SwapBuffers(CPyMOL * I);     /* only works if above function has been set */
void PyMOL_SetDefaultMouse(CPyMOL * I);
void PyMOL_SetStereoCapable(CPyMOL * I, int stereoCapable);
void PyMOL_InitializeCMol(CPyMOL * I);


/* host query methods */

int PyMOL_GetRedisplay(CPyMOL * I, int reset);
int PyMOL_GetPassive(CPyMOL * I, int reset);
int PyMOL_GetSwap(CPyMOL * I, int reset);
int PyMOL_GetClickReady(CPyMOL * I, int reset);

int PyMOL_GetImageReady(CPyMOL * I, int reset);
PyMOLreturn_int_array PyMOL_GetImageInfo(CPyMOL * I);
int PyMOL_GetImageData(CPyMOL * I, int width, int height, int row_bytes,
                       void *buffer, int mode, int reset);
PyMOLreturn_int_array PyMOL_GetImageDataReturned(CPyMOL * I, int width, int height, int row_bytes,
						 int mode, int reset);

int PyMOL_GetReshape(CPyMOL * I);
int PyMOL_GetIdleAndReady(CPyMOL * I);


/* int array results */

PyMOLreturn_int_array PyMOL_GetReshapeInfo(CPyMOL * I, int reset);

/*PyMOLreturn_int_array PyMOL_GetStereoInfo(CPyMOL *I,int reset);  * to come for MacPyMOL -- blue line, etc */


/* string results */

char *PyMOL_GetClickString(CPyMOL * I, int reset);
int PyMOL_FreeResultString(CPyMOL * I, char *st);


/* asynchronous processing (only useful for Python-based multithreaded builds right now) */

int PyMOL_GetBusy(CPyMOL * I, int reset);
void PyMOL_SetBusy(CPyMOL * I, int value);

void PyMOL_ResetProgress(CPyMOL * I);

void PyMOL_SetProgress(CPyMOL * I, int offset, int current, int range);

int PyMOL_GetProgress(CPyMOL * I, int *progress, int reset);
int PyMOL_GetProgressChanged(CPyMOL * I, int reset);

int PyMOL_GetInterrupt(CPyMOL * I, int reset);
void PyMOL_SetInterrupt(CPyMOL * I, int value);


/* modal updates -- PyMOL is busy with some complex task, but we have
   to return control to the host in order to get a valid draw callback */

int PyMOL_GetModalDraw(CPyMOL * I);
void PyMOL_SetModalDraw(CPyMOL * I, PyMOLModalDrawFn * fn);     /* for internal use only */


/* developer/transient privates */

struct _PyMOLGlobals *PyMOL_GetGlobals(CPyMOL * I);
struct _PyMOLGlobals **PyMOL_GetGlobalsHandle(CPyMOL * I);

void PyMOL_RunTest(CPyMOL * I, int group, int test);


/* for python integration */

void PyMOL_LockAPIAndUnblock(CPyMOL * I);
void PyMOL_BlockAndUnlockAPI(CPyMOL * I);


/* for Jmol integration */

int PyMOL_NewG3DStream(CPyMOL * I, int **array_ptr);
int PyMOL_DelG3DStream(CPyMOL * I, int *array_ptr);


/* Command API */

PyMOLreturn_status PyMOL_CmdBackgroundColor(CPyMOL * I, char *value);

PyMOLreturn_status PyMOL_CmdReinitialize(CPyMOL * I, char *what, char *object_name);

PyMOLreturn_status PyMOL_CmdLoad(CPyMOL * I, char *content,
                                 char *content_type,
                                 char *content_format,
                                 char *object_name,
                                 int state, int discrete, int finish,
                                 int quiet, int multiplex, int zoom);

PyMOLreturn_status PyMOL_CmdLoadRaw(CPyMOL * I, char *content,
                                    int content_length,
                                    char *content_format,
                                    char *object_name, int state,
                                    int discrete, int finish,
                                    int quiet, int multiplex, int zoom);

PyMOLreturn_status PyMOL_CmdLoadCGO(CPyMOL * I, float *content,
                                    int content_length,
                                    char *object_name, int state, int quiet, int zoom);

PyMOLreturn_status PyMOL_CmdCreate(CPyMOL * I, char *name,
                                   char *selection, int source_state,
                                   int target_state, int discrete,
                                   int zoom, int quiet, int singletons, char *extract);

PyMOLreturn_status PyMOL_CmdZoom(CPyMOL * I, char *selection, float buffer,
                                 int state, int complete, float animate, int quiet);

PyMOLreturn_status PyMOL_CmdCenter(CPyMOL * I, char *selection, int state, int origin,
                                   float animate, int quiet);

PyMOLreturn_status PyMOL_CmdOrient(CPyMOL * I, char *selection, float buffer, int state,
                                   int complete, float animate, int quiet);

PyMOLreturn_status PyMOL_CmdOrigin(CPyMOL * I, char *selection, int state, int quiet);

PyMOLreturn_status PyMOL_CmdOriginAt(CPyMOL * I, float x, float y, float z, int quiet);

PyMOLreturn_status PyMOL_CmdClip(CPyMOL * I, char *mode, float amount, char *selection,
                                 int state, int quiet);

PyMOLreturn_status PyMOL_CmdShow(CPyMOL * I, char *representation, char *selection,
                                 int quiet);

PyMOLreturn_status PyMOL_CmdHide(CPyMOL * I, char *representation, char *selection,
                                 int quiet);

PyMOLreturn_status PyMOL_CmdEnable(CPyMOL * I, char *name, int quiet);

PyMOLreturn_status PyMOL_CmdDisable(CPyMOL * I, char *name, int quiet);

PyMOLreturn_status PyMOL_CmdDelete(CPyMOL * I, char *name, int quiet);

PyMOLreturn_status PyMOL_CmdSet(CPyMOL * I, char *setting, char *value,
                                char *selection,
                                int state, int quiet, int side_effects);

PyMOLreturn_value PyMOL_CmdGet(CPyMOL * I, char *setting,
			       char *selection,
			       int state, int quiet);

PyMOLreturn_status PyMOL_CmdUnset(CPyMOL * I, char *setting, char *selection,
                                  int state, int quiet, int side_effects);

PyMOLreturn_status PyMOL_CmdSetBond(CPyMOL * I, char *setting, char *value,
                                    char *selection1, char *selection2,
                                    int state, int quiet, int side_effects);

PyMOLreturn_status PyMOL_CmdUnsetBond(CPyMOL * I, char *setting,
                                      char *selection1, char *selection2,
                                      int state, int quiet, int side_effects);

PyMOLreturn_status PyMOL_CmdColor(CPyMOL * I, char *color, char *selection, int flags,
                                  int quiet);

PyMOLreturn_status PyMOL_CmdLabel(CPyMOL * I, char *selection, char *text, int quiet);

PyMOLreturn_status PyMOL_CmdSelect(CPyMOL * I, char *name, char *selection, int quiet);

PyMOLreturn_status PyMOL_CmdSelectList(CPyMOL * I, char *name, char *object, int *list,
                                       int list_len, int state, char *mode, int quiet);

PyMOLreturn_int PyMOL_CmdGetMovieLength(CPyMOL * I,int quiet);

PyMOLreturn_float PyMOL_CmdGetDistance(CPyMOL * I,
                                       char *selection1,
                                       char *selection2, int state, int quiet);

PyMOLreturn_float PyMOL_CmdDistance(CPyMOL * I,
                                    char *name,
                                    char *selection1,
                                    char *selection2,
                                    int mode,
                                    float cutoff,
                                    int label, int reset, int zoom, int state, int quiet);

PyMOLreturn_float PyMOL_CmdGetAngle(CPyMOL * I,
                                    char *selection1,
                                    char *selection2,
                                    char *selection3, int state, int quiet);

PyMOLreturn_float PyMOL_CmdAngle(CPyMOL * I,
                                 char *name,
                                 char *selection1,
                                 char *selection2,
                                 char *selection3,
                                 int mode,
                                 int label, int reset, int zoom, int state, int quiet);

PyMOLreturn_float PyMOL_CmdGetDihedral(CPyMOL * I,
                                       char *selection1,
                                       char *selection2,
                                       char *selection3,
                                       char *selection4, int state, int quiet);

PyMOLreturn_float PyMOL_CmdDihedral(CPyMOL * I,
                                    char *name,
                                    char *selection1,
                                    char *selection2,
                                    char *selection3,
                                    char *selection4,
                                    int mode,
                                    int label, int reset, int zoom, int state, int quiet);

PyMOLreturn_float_array PyMOL_CmdAlign(CPyMOL * I, char *source, char *target,
                                       float cutoff, int cycles, float gap, float extend,
                                       int max_gap, char *object, char *matrix,
                                       int source_state, int target_state, int quiet,
                                       int max_skip, int transform, int reset);

PyMOLreturn_status PyMOL_CmdSetView(CPyMOL * I, float *view, int view_len, float animate,
                                    int quiet);
PyMOLreturn_float_array PyMOL_CmdGetView(CPyMOL * I, int quiet);

PyMOLreturn_status PyMOL_CmdDraw(CPyMOL * I, int width, int height,
                                 int antialias, int quiet);

PyMOLreturn_status PyMOL_CmdCapture(CPyMOL * I, int quiet);

PyMOLreturn_status PyMOL_CmdRay(CPyMOL * I, int width, int height, int antialias,
                                float angle, float shift, int renderer, int defer,
                                int quiet);

PyMOLreturn_status PyMOL_CmdIsodot(CPyMOL * I, char *name, char *map_name, float level,
                                   char *selection, float buffer, int state, float carve,
                                   int source_state, int quiet);

PyMOLreturn_status PyMOL_CmdIsomesh(CPyMOL * I, char *name, char *map_name, float level,
                                    char *selection, float buffer, int state, float carve,
                                    int source_state, int quiet);

PyMOLreturn_status PyMOL_CmdIsosurface(CPyMOL * I, char *name, char *map_name,
                                       float level, char *selection, float buffer,
                                       int state, float carve, int source_state, int side,
                                       int mode, int quiet);

PyMOLreturn_status PyMOL_CmdGradient(CPyMOL * I, char *name, char *map_name,
                                     float minimum, float maximum, char *selection,
                                     float buffer, int state, float carve,
                                     int source_state, int quiet);

PyMOLreturn_float PyMOL_CmdIsolevel(CPyMOL * I, char *name, float level, int state,
                                    int query, int quiet);

PyMOLreturn_status PyMOL_CmdRampNew(CPyMOL * I, char *name, char *map, float *range,
                                    int n_range, char *color, int state, char *selection,
                                    float beyond, float within, float sigma,
                                    int zero, int calc_mode, int quiet);

PyMOLreturn_status PyMOL_CmdPseudoatom(CPyMOL * I, char *object_name, char *sele,
				       char *name, char *resn, char *resi, char *chain,
				       char *segi, char *elem, float vdw, int hetatm,
				       float b, float q, char *color, char *label, 
				       int set_xyz, float x, float y, float z,
				       int state, int mode, int quiet);

PyMOLreturn_status PyMOL_CmdTurn(CPyMOL * I, char axis, float angle);

PyMOLreturn_status PyMOL_CmdMPlay(CPyMOL * I, int cmd);

PyMOLreturn_status PyMOL_CmdSetFeedbackMask(CPyMOL * I, int action, int module, int mask);

/* releasing returned values */

int PyMOL_FreeResultArray(CPyMOL * I, void *array);

PyMOLreturn_status PyMOL_CmdRock(CPyMOL * I, int mode);

PyMOLreturn_string_array PyMOL_CmdGetNames(CPyMOL * I, int mode, char *s0, int enabled_only);

PyMOLreturn_status PyMOL_CmdMapNew(CPyMOL * I, char *name, int type, float grid_spacing, 
				   char *selection, int state, int normalize,
				   int zoom, int quiet);

#ifdef _PYMOL_LIB
PyMOLreturn_status PyMOL_SetIsEnabledCallback(CPyMOL * I, void *CallbackObject, void (*enabledCallback)(void *, const char *, int ));
PyMOLreturn_int_array PyMOL_GetRepsInSceneForObject(CPyMOL * I, const char *name);
PyMOLreturn_int_array PyMOL_GetRepsForObject(CPyMOL * I, const char *name);
PyMOLreturn_status PyMOL_SetButton(CPyMOL * I, char *button, char *modifier, char *action);
PyMOLreturn_status PyMOL_SetMouseButtonMode(CPyMOL * I, char *modename);
PyMOLreturn_float_array PyMOL_Spectrum(CPyMOL * I, char *expression, char *palette, char *selection, float minimum, float maximum, int byres, int quiet);
#endif

PyMOLreturn_status PyMOL_ZoomScene(CPyMOL * I, float scale);
PyMOLreturn_status PyMOL_TranslateScene(CPyMOL * I, float x, float y, float z);

PyMOLreturn_value PyMOL_GetVersion(CPyMOL * I);

PyMOLreturn_status PyMOL_GetSettingString(CPyMOL * I, int settingid, char *deststr);

#endif