00001 /*************************************************************************** 00002 *cr 00003 *cr (C) Copyright 1995-2008 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.37 $ $Date: 2008/03/27 19:36:52 $ 00015 * 00016 *************************************************************************** 00017 * DESCRIPTION: 00018 * Core VMD Python interface. 00019 ***************************************************************************/ 00020 00021 #ifndef PY_COMMANDS_H 00022 #define PY_COMMANDS_H 00023 00024 #if defined(__APPLE__) 00025 // use the Apple-provided Python framework 00026 #include "Python/Python.h" 00027 #else 00028 #include "Python.h" 00029 #endif 00030 00031 class VMDApp; 00032 class Timestep; 00033 class AtomSel; 00034 00035 // store/retrieve the VMDApp instance from the __builtins__ module. 00036 extern VMDApp *get_vmdapp(); 00037 void set_vmdapp(VMDApp *); 00038 00039 // turn a PyObject into an array of three floats, if possible 00040 // The object must be a tuple of size 3 00041 // return 1 on success, 0 on error 00042 extern int py_array_from_obj(PyObject *obj, float *arr); 00043 00044 00045 // Get the timestep corresponding to the given molid and frame. 00046 // If molid is -1, the top molecule will be used. 00047 // If frame is -1, the current timestep is used. 00048 // if frame is -2, the last timestep is used. 00049 // Otherwise, if the molid or frame are not valid, an exception is set 00050 // and NULL is returned. 00051 Timestep *parse_timestep(VMDApp *app, int molid, int frame); 00052 00053 // Return the underlying AtomSel object. Raise PyError and return 00054 // NULL on failure if the object is not an instance of atomsel. 00055 // Does not check if the molid referenced by the underlying AtomSel 00056 // is still valid. 00057 AtomSel * atomsel_AsAtomSel( PyObject *obj ); 00058 00059 extern void initanimate(); 00060 extern void initatomselection(); 00061 extern void initatomsel(); 00062 extern void initaxes(); 00063 extern void initcolor(); 00064 extern void initdisplay(); 00065 extern void initgraphics(); 00066 extern void initimd(); 00067 extern void initlabel(); 00068 extern void initmaterial(); 00069 extern void initmolecule(); 00070 extern void initmolrep(); 00071 extern void initmouse(); 00072 extern void initrender(); 00073 extern void inittrans(); 00074 extern void initvmdmenu(); 00075 00076 #ifdef VMDNUMPY 00077 extern void initvmdnumpy(); 00078 #endif 00079 00080 // use this typedef so that we can define our Python methods as static 00081 // functions, then cast them to the proper type, rather than declaring the 00082 // functions extern "C", which can lead to namespace collision. 00083 00084 extern "C" { 00085 typedef PyObject *(*vmdPyMethod)(PyObject *, PyObject *); 00086 } 00087 00088 #endif 00089
1.2.14 written by Dimitri van Heesch,
© 1997-2002