Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

py_commands.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr
00003  *cr            (C) Copyright 1995-2019 The Board of Trustees of the
00004  *cr                        University of Illinois
00005  *cr                         All Rights Reserved
00006  *cr
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: py_commands.h,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.49 $       $Date: 2019/06/05 14:47:53 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  *  Core VMD Python interface.
00019  ***************************************************************************/
00020 
00021 #ifndef PY_COMMANDS_H
00022 #define PY_COMMANDS_H
00023 
00024 #include "Python.h"
00025 
00026 #if (PY_MAJOR_VERSION == 2) && (PY_MINOR_VERSION < 5)
00027 #define CAST_HACK (char *)
00028 #else
00029 #define CAST_HACK
00030 #endif
00031 
00032 class VMDApp;
00033 class Timestep;
00034 class AtomSel;
00035 
00036 // store/retrieve the VMDApp instance from the __builtins__ module. 
00037 extern VMDApp *get_vmdapp();
00038 void set_vmdapp(VMDApp *);
00039 
00040 // turn a PyObject into an array of three floats, if possible
00041 // The object must be a tuple of size 3
00042 // return 1 on success, 0 on error
00043 extern int py_array_from_obj(PyObject *obj, float *arr);
00044 
00045 // Turn PyObject to and from strings or ints, with ifdefs for python 2/3
00046 const char *as_constcharptr(PyObject *target);
00047 PyObject* as_pystring(const char *target);
00048 int is_pystring(const PyObject *target);
00049 PyObject* as_pyint(int target);
00050 int as_int(PyObject *target);
00051 int is_pyint(PyObject *target);
00052 int valid_molid(int molid, VMDApp *app);
00053 int py_get_vector(PyObject *matobj, int n, float *vec);
00054 int convert_bool(PyObject *obj, void *boolval);
00055 
00056 // Get the timestep corresponding to the given molid and frame.
00057 // If molid is -1, the top molecule will be used.
00058 // If frame is -1, the current timestep is used.
00059 // if frame is -2, the last timestep is used.
00060 // Otherwise, if the molid or frame are not valid, an exception is set
00061 // and NULL is returned.
00062 Timestep *parse_timestep(VMDApp *app, int molid, int frame);
00063 
00064 // Return the underlying AtomSel object.  Raise PyError and return
00065 // NULL on failure if the object is not an instance of atomsel.
00066 // Does not check if the molid referenced by the underlying AtomSel 
00067 // is still valid.
00068 AtomSel * atomsel_AsAtomSel( PyObject *obj );
00069 
00070 // Atomsel type
00071 extern PyTypeObject Atomsel_Type;
00072 
00073 // VMD main initialization function, with no name mangling
00074 #if PY_MAJOR_VERSION >= 3
00075 extern "C" PyObject* PyInit_vmd();
00076 #else
00077 extern "C" void initvmd();
00078 #endif
00079 
00080 extern PyObject* initanimate();
00081 extern PyObject* initatomsel();
00082 extern PyObject* initselection();
00083 extern PyObject* initaxes();
00084 extern PyObject* initcolor();
00085 extern PyObject* initdisplay();
00086 extern PyObject* initgraphics();
00087 extern PyObject* initimd();
00088 extern PyObject* initlabel();
00089 extern PyObject* initmaterial();
00090 extern PyObject* initmolecule();
00091 extern PyObject* initmolrep();
00092 extern PyObject* initmouse();
00093 extern PyObject* initrender();
00094 extern PyObject* inittrans();
00095 extern PyObject* initvmdmenu();
00096 extern PyObject* initvmdcallbacks();
00097 extern PyObject* initmeasure();
00098 extern PyObject* inittopology();
00099 
00100 #ifdef VMDNUMPY
00101 extern PyObject* initvmdnumpy();
00102 #endif
00103 
00104 // Contains submodule initialization functions with submodule names
00105 // Each initialization function returns a PyObject*
00106 struct _py3_inittab {
00107   const char *name;
00108   PyObject* (*initfunc)(void);
00109 };
00110 
00111 extern _py3_inittab py_initializers[];
00112 
00113 #endif
00114 

Generated on Fri Apr 19 02:45:14 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002