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

py_trans.C

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_trans.C,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.24 $       $Date: 2019/05/31 05:37:30 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  *  Python interface for transforming molecules (scale/trans/rot, etc)
00019  ***************************************************************************/
00020 
00021 #include "py_commands.h"
00022 #include "VMDApp.h"
00023 #include "CommandQueue.h"
00024 #include "MoleculeList.h"
00025 #include "Molecule.h"
00026 
00027 static const char rotate_doc[] =
00028 "Rotate the scene about an axis\n\n"
00029 "Args:\n"
00030 "    axis (str): Axis to rotate around, either 'x', 'y', or 'z'\n"
00031 "    angle (float): Angle to rotate by";
00032 static PyObject *py_rotate(PyObject *self, PyObject *args, PyObject *kwargs) {
00033   const char *kwlist[] = {"axis", "angle", NULL};
00034   float angle;
00035   char *axis;
00036   int len;
00037 
00038   if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#f:trans.rotate_scene",
00039                                    (char**) kwlist, &axis, &len, &angle))
00040     return NULL;
00041 
00042   if (len != 1 || (axis[0] != 'x' && axis[0] != 'y' && axis[0] != 'z')) {
00043     PyErr_Format(PyExc_ValueError, "axis must be 'x', 'y', or 'z', had '%s'",
00044                  axis);
00045     return NULL;
00046   }
00047 
00048   VMDApp *app;
00049   if (!(app = get_vmdapp()))
00050     return NULL;
00051 
00052   app->scene_rotate_by(angle, axis[0]);
00053 
00054   Py_INCREF(Py_None); return Py_None;
00055 }
00056 
00057 
00058 static const char translate_doc[] =
00059 "Translate the scene by a vector\n\n"
00060 "Args:\n"
00061 "    x (float): Amount to move in X direction\n"
00062 "    y (float): Amount to move in Y direction\n"
00063 "    z (float): Amount to move in Z direction";
00064 static PyObject *py_translate(PyObject *self, PyObject *args, PyObject *kwargs) {
00065   const char *kwlist[] = {"x", "y", "z", NULL};
00066   float x = 0.f, y = 0.f, z = 0.f;
00067 
00068   if (!PyArg_ParseTupleAndKeywords(args, kwargs, "fff:trans.translate_scene",
00069                                    (char**) kwlist, &x, &y, &z))
00070     return NULL;
00071 
00072   VMDApp *app;
00073   if (!(app = get_vmdapp()))
00074     return NULL;
00075 
00076   app->scene_translate_by(x,y,z);
00077 
00078   Py_INCREF(Py_None);
00079   return Py_None;
00080 }
00081 
00082 
00083 static const char scale_doc[] =
00084 "Set the scale or zoom level for the scene\n\n"
00085 "Args:\n"
00086 "    scale (float): Scale value";
00087 static PyObject *py_scale(PyObject *self, PyObject *args, PyObject *kwargs) {
00088   const char *kwlist[] = {"scale", NULL};
00089   float factor;
00090 
00091   if (!PyArg_ParseTupleAndKeywords(args, kwargs, "f:trans.scale",
00092                                    (char**) kwlist, &factor))
00093     return NULL;
00094 
00095   VMDApp *app;
00096   if (!(app = get_vmdapp()))
00097     return NULL;
00098 
00099   app->scene_scale_by(factor);
00100 
00101   Py_INCREF(Py_None);
00102   return Py_None;
00103 }
00104 
00105 
00106 static const char center_doc[] =
00107 "Get the coordinates of the displayed center of a molecule\n\n"
00108 "Args:\n"
00109 "    molid (int): Molecule ID to query\n"
00110 "Returns:\n"
00111 "    (3-tuple of float) (x,y,z) coordinates of molecule center";
00112 static PyObject *py_get_center(PyObject *self, PyObject *args, PyObject *kwargs)
00113 {
00114   const char *kwlist[] = {"molid", NULL};
00115   PyObject *newlist = NULL;
00116   Molecule *mol;
00117   int i, molid;
00118 
00119   if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:trans.get_center",
00120                                    (char**) kwlist, &molid))
00121     return NULL;
00122 
00123   VMDApp *app;
00124   if (!(app = get_vmdapp()))
00125     return NULL;
00126 
00127   if (!(mol = app->moleculeList->mol_from_id(molid))) {
00128     PyErr_Format(PyExc_ValueError, "Invalid molecule id '%d'", molid);
00129     return NULL;
00130   }
00131 
00132   if (!(newlist = PyTuple_New(3)))
00133     goto failure;
00134 
00135   for (i = 0; i < 3; i++) {
00136     PyTuple_SET_ITEM(newlist, i, PyFloat_FromDouble(mol->centt[i]));
00137     if (PyErr_Occurred())
00138       goto failure;
00139   }
00140 
00141   return newlist;
00142 
00143 failure:
00144   PyErr_SetString(PyExc_RuntimeError, "Problem getting molecule center");
00145   Py_XDECREF(newlist);
00146   return NULL;
00147 }
00148 
00149 
00150 static const char mol_scale_doc[] =
00151 "Get the scaling factor for a molecule\n\n"
00152 "Args:\n"
00153 "    molid (int): Molecule ID to query\n"
00154 "Returns:\n"
00155 "    (float) Scaling factor for molecule";
00156 static PyObject *py_get_scale(PyObject *self, PyObject *args, PyObject *kwargs) {
00157   const char *kwlist[] = {"molid", NULL};
00158   Molecule *mol;
00159   int molid;
00160 
00161   if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:trans.get_scale",
00162                                    (char**) kwlist, &molid))
00163     return NULL;
00164 
00165   VMDApp *app;
00166   if (!(app = get_vmdapp()))
00167     return NULL;
00168 
00169   if (!(mol = app->moleculeList->mol_from_id(molid))) {
00170     PyErr_Format(PyExc_ValueError, "Invalid molecule id '%d'", molid);
00171     return NULL;
00172   }
00173 
00174   return PyFloat_FromDouble(mol->scale);
00175 }
00176 
00177 
00178 static const char mol_trans_doc[] =
00179 "Get the translation for a molecule relative to scene center\n\n"
00180 "Args:\n"
00181 "    molid (int): Molecule ID to query\n"
00182 "Returns:\n"
00183 "    (3-tuple of float) (x, y, z) translation applied to molecule";
00184 static PyObject *py_get_trans(PyObject *self, PyObject *args, PyObject *kwargs) {
00185   const char *kwlist[] = {"molid", NULL};
00186   PyObject *newlist = NULL;
00187   Molecule *mol;
00188   int i, molid;
00189 
00190   if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:trans.get_translation",
00191                                    (char**) kwlist, &molid))
00192     return NULL;
00193 
00194   VMDApp *app;
00195   if (!(app = get_vmdapp()))
00196     return NULL;
00197 
00198   if (!(mol = app->moleculeList->mol_from_id(molid))) {
00199     PyErr_Format(PyExc_ValueError, "Invalid molecule id '%d'", molid);
00200     return NULL;
00201   }
00202 
00203   if (!(newlist = PyTuple_New(3)))
00204     goto failure;
00205 
00206   for (i = 0; i < 3; i++) {
00207     PyTuple_SET_ITEM(newlist, i, PyFloat_FromDouble(mol->globt[i]));
00208     if (PyErr_Occurred())
00209       goto failure;
00210   }
00211 
00212   return newlist;
00213 
00214 failure:
00215   PyErr_Format(PyExc_RuntimeError, "Problem getting molecule '%d' translation",
00216                molid);
00217   Py_XDECREF(newlist);
00218   return NULL;
00219 }
00220 
00221 
00222 static const char mol_rot_doc[] =
00223 "Gets the rotation of a given molecule\n\n"
00224 "Args:\n"
00225 "    molid (int): Molecule ID to query\n"
00226 "Returns:\n"
00227 "    (16-tuple of float) Rotation matrix for molecule";
00228 static PyObject *py_get_rotation(PyObject *self, PyObject *args,
00229                                  PyObject *kwargs) {
00230   const char *kwlist[] = {"molid", NULL};
00231   PyObject *mat = NULL;
00232   Molecule *mol;
00233   int i, molid;
00234 
00235   if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:trans.get_rotation",
00236                                    (char**) kwlist, &molid))
00237     return NULL;
00238 
00239   VMDApp *app;
00240   if (!(app = get_vmdapp()))
00241     return NULL;
00242 
00243   if (!(mol = app->moleculeList->mol_from_id(molid))) {
00244     PyErr_Format(PyExc_ValueError, "Invalid molecule id '%d'", molid);
00245     return NULL;
00246   }
00247 
00248   if (!(mat = PyTuple_New(16)))
00249     goto failure;
00250 
00251   for (i = 0; i < 16; i++) {
00252     PyTuple_SET_ITEM(mat, i, PyFloat_FromDouble(mol->rotm.mat[i]));
00253     if (PyErr_Occurred())
00254       goto failure;
00255   }
00256   return mat;
00257 
00258 failure:
00259   PyErr_Format(PyExc_RuntimeError, "Problem getting molecule '%d' rotation",
00260                molid);
00261   Py_XDECREF(mat);
00262   return NULL;
00263 }
00264 
00265 
00266 static const char mcenter_doc[] =
00267 "Set the center of an individual molecule\n\n"
00268 "Args:\n"
00269 "    molid (int): Molecule ID to set center in\n"
00270 "    center (list of 3 floats): (x, y, z) coordinates of new center";
00271 static PyObject *py_set_center(PyObject *self, PyObject *args, PyObject *kwargs) {
00272   const char *kwlist[] = {"molid", "center", NULL};
00273   float x, y, z;
00274   Molecule *mol;
00275   int molid;
00276 
00277   if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i(fff):trans.set_center",
00278                                    (char**) kwlist, &molid, &x, &y, &z))
00279     return NULL;
00280 
00281   VMDApp *app;
00282   if (!(app = get_vmdapp()))
00283     return NULL;
00284 
00285   if (!(mol = app->moleculeList->mol_from_id(molid))) {
00286     PyErr_Format(PyExc_ValueError, "Invalid molecule id '%d'", molid);
00287     return NULL;
00288   }
00289 
00290   mol->set_cent_trans(x, y, z);
00291 
00292   Py_INCREF(Py_None);
00293   return Py_None;
00294 }
00295 
00296 
00297 static const char mscale_doc[] =
00298 "Set the scale of an individual molecule\n\n"
00299 "Args:\n"
00300 "    molid (int): Molecule ID to set scale of\n"
00301 "    scale (float): New scale value for molecule";
00302 static PyObject *py_set_scale(PyObject *self, PyObject *args, PyObject *kwargs) {
00303   const char *kwlist[] = {"molid", "scale", NULL};
00304   Molecule *mol;
00305   float scale;
00306   int molid;
00307 
00308   if (!PyArg_ParseTupleAndKeywords(args, kwargs, "if:trans.set_scale",
00309                                    (char**) kwlist, &molid, &scale))
00310     return NULL;
00311 
00312   VMDApp *app;
00313   if (!(app = get_vmdapp()))
00314     return NULL;
00315 
00316   if (!(mol = app->moleculeList->mol_from_id(molid))) {
00317     PyErr_Format(PyExc_ValueError, "Invalid molecule id '%d'", molid);
00318     return NULL;
00319   }
00320   mol->set_scale(scale);
00321 
00322   Py_INCREF(Py_None);
00323   return Py_None;
00324 }
00325 
00326 
00327 static const char mtrans_doc[] =
00328 "Set the translation of an individual molecule\n\n"
00329 "Args:\n"
00330 "    molid (int): Molecule ID to set translation of\n"
00331 "    trans (list of 3 floats): New (x,y,z) translation for molecule";
00332 static PyObject *py_set_trans(PyObject *self, PyObject *args, PyObject *kwargs) {
00333   const char *kwlist[] = {"molid", "trans", NULL};
00334   float x, y, z;
00335   Molecule *mol;
00336   int molid;
00337 
00338   if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i(fff):trans.set_translation",
00339                                    (char**) kwlist, &molid, &x, &y, &z))
00340     return NULL;
00341 
00342   VMDApp *app;
00343   if (!(app = get_vmdapp()))
00344     return NULL;
00345 
00346   if (!(mol = app->moleculeList->mol_from_id(molid))) {
00347     PyErr_Format(PyExc_ValueError, "Invalid molecule id '%d'", molid);
00348     return NULL;
00349   }
00350 
00351   mol->set_glob_trans(x, y, z);
00352 
00353   Py_INCREF(Py_None);
00354   return Py_None;
00355 }
00356 
00357 
00358 static const char mrot_doc[] =
00359 "Set the rotation of an individual molecule\n\n"
00360 "Args:\n"
00361 "    molid (int): Molecule ID to set\n"
00362 "    matrix (list or tuple of 16 floats): Rotation matrix to apply";
00363 static PyObject *py_set_rotation(PyObject *self, PyObject *args,
00364                                  PyObject *kwargs) {
00365   const char *kwlist[] = {"molid", "matrix", NULL};
00366   PyObject *pyseq = NULL;
00367   PyObject *pylist;
00368   Molecule *mol;
00369   int i, molid;
00370   float c[16];
00371 
00372   if (!PyArg_ParseTupleAndKeywords(args, kwargs, "iO:trans.set_rotation",
00373                                    (char**) kwlist, &molid, &pylist))
00374     return NULL;
00375 
00376   VMDApp *app;
00377   if (!(app = get_vmdapp()))
00378     return NULL;
00379 
00380   if (!(mol = app->moleculeList->mol_from_id(molid))) {
00381     PyErr_Format(PyExc_ValueError, "Invalid molecule id '%d'", molid);
00382     return NULL;
00383   }
00384 
00385   // PySequence_Fast does type checking for us and will set an exception
00386   if (!(pyseq = PySequence_Fast(pylist, "matrix must be a list or tuple")))
00387     return NULL;
00388 
00389   if (PySequence_Fast_GET_SIZE(pyseq) != 16) {
00390     PyErr_SetString(PyExc_ValueError, "matrix must have length 16");
00391     goto failure;
00392   }
00393 
00394   for (i = 0; i < 16; i++) {
00395     // Check elements are float first as if they're bools they can get
00396     // implicitly converted to 1.0
00397     PyObject *num = PySequence_Fast_GET_ITEM(pyseq, i);
00398     if (!PyFloat_Check(num)) {
00399       PyErr_SetString(PyExc_TypeError, "matrix must contain floats");
00400       goto failure;
00401     }
00402 
00403     c[i] = PyFloat_AsDouble(num);
00404 
00405     if (PyErr_Occurred())
00406       goto failure;
00407   }
00408   mol->set_rot(c);
00409 
00410   Py_DECREF(pyseq);
00411   Py_INCREF(Py_None);
00412   return Py_None;
00413 
00414 failure:
00415   Py_XDECREF(pyseq);
00416   return NULL;
00417 }
00418 
00419 
00420 static const char reset_doc[] =
00421 "Centers the view around a given molecule\n\n"
00422 "Args:\n"
00423 "    molid (int): Molecule ID to center";
00424 static PyObject *py_resetview(PyObject *self, PyObject *args, PyObject *kwargs) {
00425   const char *kwlist[] = {"molid", NULL};
00426   Molecule *mol, *topmol;
00427   int molid;
00428 
00429   if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:trans.resetview",
00430                                    (char**) kwlist, &molid))
00431     return NULL;
00432 
00433   VMDApp *app;
00434   if (!(app = get_vmdapp()))
00435     return NULL;
00436 
00437   MoleculeList *mlist = app->moleculeList;
00438   if (!(mol = mlist->mol_from_id(molid))) {
00439     PyErr_Format(PyExc_ValueError, "Invalid molecule id '%d'", molid);
00440     return NULL;
00441   }
00442 
00443   topmol = mlist->top();
00444   mlist->make_top(mol);
00445   app->scene_resetview();
00446   mlist->make_top(topmol);
00447 
00448   Py_INCREF(Py_None);
00449   return Py_None;
00450 }
00451 
00452 
00453 static const char fixed_doc[] =
00454 "Query if a molecule is fixed. Fixed molecules do not move when the scene\n"
00455 "or view is changed.\n\n"
00456 "Args:\n"
00457 "    molid (int): Molecule ID to query\n"
00458 "Returns:\n"
00459 "    (bool) True if molecule is fixed";
00460 static PyObject *py_is_fixed(PyObject *self, PyObject *args, PyObject *kwargs) {
00461   const char *kwlist[] = {"molid", NULL};
00462   Molecule *mol;
00463   int molid;
00464 
00465   if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:trans.is_fixed",
00466                                    (char**) kwlist, &molid))
00467     return NULL;
00468 
00469   VMDApp *app;
00470   if (!(app = get_vmdapp()))
00471     return NULL;
00472 
00473   if (!(mol = app->moleculeList->mol_from_id(molid))) {
00474     PyErr_Format(PyExc_ValueError, "Invalid molecule id '%d'", molid);
00475     return NULL;
00476   }
00477 
00478   PyObject *result = mol->fixed() ? Py_True : Py_False;
00479   Py_INCREF(result);
00480   return result;
00481 }
00482 
00483 
00484 static const char setfix_doc[] =
00485 "Set the fixed status of a molecule. Fixed molecules do not move when the\n"
00486 "scene or view is changed.\n\n"
00487 "Args:\n"
00488 "    molid (int): Molecule ID to set fixed status for\n"
00489 "    fixed (bool): If molecule should be fixed";
00490 static PyObject *py_fix(PyObject *self, PyObject *args, PyObject *kwargs) {
00491   const char *kwlist[] = {"molid", "fixed", NULL};
00492   int molid, fixed;
00493   Molecule *mol;
00494 
00495   if (!PyArg_ParseTupleAndKeywords(args, kwargs, "iO&:trans.fix",
00496                                   (char**) kwlist,  &molid, convert_bool,
00497                                   &fixed))
00498     return NULL;
00499 
00500   VMDApp *app;
00501   if (!(app = get_vmdapp()))
00502     return NULL;
00503 
00504   if (!(mol = app->moleculeList->mol_from_id(molid))) {
00505     PyErr_Format(PyExc_ValueError, "Invalid molecule id '%d'", molid);
00506     return NULL;
00507   }
00508   app->molecule_fix(molid, fixed);
00509 
00510   Py_INCREF(Py_None);
00511   return Py_None;
00512 }
00513 
00514 
00515 static const char show_doc[] =
00516 "Query if a molecule is shown\n\n"
00517 "Args:\n"
00518 "    molid (int): Molecule ID to query\n"
00519 "Returns:\n"
00520 "    (bool) True if molecule is shown";
00521 static PyObject *py_is_shown(PyObject *self, PyObject *args, PyObject *kwargs) {
00522   const char *kwlist[] = {"molid", NULL};
00523   Molecule *mol;
00524   int molid;
00525 
00526   if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:trans.is_shown",
00527                                    (char**) kwlist,  &molid))
00528     return NULL;
00529 
00530   VMDApp *app;
00531   if (!(app = get_vmdapp()))
00532     return NULL;
00533 
00534   if (!(mol = app->moleculeList->mol_from_id(molid))) {
00535     PyErr_Format(PyExc_ValueError, "Invalid molecule id '%d'", molid);
00536     return NULL;
00537   }
00538 
00539   PyObject *result = mol->displayed() ? Py_True : Py_False;
00540   Py_INCREF(result);
00541   return result;
00542 }
00543 
00544 
00545 static const char setshow_doc[] =
00546 "Set if a molecule is shown\n\n"
00547 "Args:\n"
00548 "    molid (int): Molecule ID to show or hide\n"
00549 "    shown (bool): True if molecule should be shown";
00550 static PyObject *py_show(PyObject *self, PyObject *args, PyObject *kwargs) {
00551   const char *kwlist[] = {"molid", "shown", NULL};
00552   int molid, shown;
00553   Molecule *mol;
00554 
00555   if (!PyArg_ParseTupleAndKeywords(args, kwargs, "iO&:trans.show",
00556                                    (char**) kwlist, &molid, convert_bool,
00557                                    &shown))
00558     return NULL;
00559 
00560   VMDApp *app;
00561   if (!(app = get_vmdapp()))
00562     return NULL;
00563 
00564   if (!(mol = app->moleculeList->mol_from_id(molid))) {
00565     PyErr_Format(PyExc_ValueError, "Invalid molecule id '%d'", molid);
00566     return NULL;
00567   }
00568 
00569   app->molecule_display(molid, shown);
00570 
00571   Py_INCREF(Py_None);
00572   return Py_None;
00573 }
00574 
00575 
00576 //
00577 // Deprecated methods with old names are retained for backwards compatibility
00578 //
00579 static PyObject *py_drotate(PyObject *self, PyObject *args, PyObject *kwargs) {
00580   PyErr_Warn(PyExc_DeprecationWarning, "the 'rotate' method has been "
00581              "renamed to 'rotate_scene'");
00582   return py_rotate(self, args, kwargs);
00583 }
00584 
00585 
00586 static PyObject *py_dtranslate(PyObject *self, PyObject *args, PyObject *kwargs) {
00587   PyErr_Warn(PyExc_DeprecationWarning, "the 'translate' method has been "
00588              "renamed to 'translate_scene'");
00589   return py_translate(self, args, kwargs);
00590 }
00591 
00592 
00593 static PyObject *py_dscale(PyObject *self, PyObject *args, PyObject *kwargs) {
00594   PyErr_Warn(PyExc_DeprecationWarning, "the 'scale' method has been renamed "
00595              "to 'scale_scene'");
00596   return py_scale(self, args, kwargs);
00597 }
00598 
00599 
00600 static PyObject *py_dstrans(PyObject *self, PyObject *args, PyObject *kwargs) {
00601   PyErr_Warn(PyExc_DeprecationWarning, "the 'set_trans' method has been "
00602              "renamed to 'set_translation'");
00603   return py_set_trans(self, args, kwargs);
00604 }
00605 
00606 
00607 static PyObject *py_dgtrans(PyObject *self, PyObject *args, PyObject *kwargs) {
00608   PyErr_Warn(PyExc_DeprecationWarning, "the 'get_trans' method has been "
00609              "renamed to 'get_translation'");
00610   return py_get_trans(self, args, kwargs);
00611 }
00612 
00613 
00614 static PyMethodDef methods[] = {
00615   {"rotate_scene", (PyCFunction)py_rotate, METH_VARARGS | METH_KEYWORDS, rotate_doc},
00616   {"translate_scene", (PyCFunction)py_translate, METH_VARARGS | METH_KEYWORDS, translate_doc},
00617   {"scale_scene", (PyCFunction)py_scale, METH_VARARGS | METH_KEYWORDS, scale_doc},
00618   {"resetview", (PyCFunction)py_resetview, METH_VARARGS | METH_KEYWORDS, reset_doc},
00619   {"get_center", (PyCFunction)py_get_center, METH_VARARGS | METH_KEYWORDS, center_doc},
00620   {"get_scale", (PyCFunction)py_get_scale, METH_VARARGS | METH_KEYWORDS, mol_scale_doc},
00621   {"get_translation", (PyCFunction)py_get_trans, METH_VARARGS | METH_KEYWORDS, mol_trans_doc},
00622   {"get_rotation", (PyCFunction)py_get_rotation, METH_VARARGS | METH_KEYWORDS, mol_rot_doc},
00623   {"set_center", (PyCFunction)py_set_center, METH_VARARGS | METH_KEYWORDS, mcenter_doc},
00624   {"set_scale", (PyCFunction)py_set_scale, METH_VARARGS | METH_KEYWORDS, mscale_doc},
00625   {"set_translation", (PyCFunction)py_set_trans, METH_VARARGS | METH_KEYWORDS, mtrans_doc},
00626   {"set_rotation", (PyCFunction)py_set_rotation, METH_VARARGS | METH_KEYWORDS, mrot_doc},
00627   {"is_fixed", (PyCFunction)py_is_fixed, METH_VARARGS | METH_KEYWORDS, fixed_doc},
00628   {"fix", (PyCFunction)py_fix, METH_VARARGS | METH_KEYWORDS, setfix_doc},
00629   {"is_shown", (PyCFunction)py_is_shown, METH_VARARGS | METH_KEYWORDS, show_doc},
00630   {"show", (PyCFunction)py_show, METH_VARARGS | METH_KEYWORDS, setshow_doc},
00631 
00632   // The following methods are deprecated as they have been renamed.
00633   // They're still here for backwards compatiblity, but emit DeprecationWarning
00634   {"rotate", (PyCFunction)py_drotate, METH_VARARGS | METH_KEYWORDS, rotate_doc},
00635   {"translate", (PyCFunction)py_dtranslate, METH_VARARGS | METH_KEYWORDS, translate_doc},
00636   {"scale", (PyCFunction)py_dscale, METH_VARARGS | METH_KEYWORDS, scale_doc},
00637   {"set_trans", (PyCFunction)py_dstrans, METH_VARARGS | METH_KEYWORDS, mtrans_doc},
00638   {"get_trans", (PyCFunction)py_dgtrans, METH_VARARGS | METH_KEYWORDS, mol_trans_doc},
00639 
00640   {NULL, NULL}
00641 };
00642 
00643 
00644 static const char trans_moddoc[] =
00645 "Methods for manipulating the transformations applied to a molecule in the "
00646 "render window, including its position, rotation, center, and scale.";
00647 
00648 
00649 #if PY_MAJOR_VERSION >= 3
00650 static struct PyModuleDef transdef = {
00651   PyModuleDef_HEAD_INIT,
00652   "trans",
00653   trans_moddoc,
00654   -1,
00655   methods,
00656 };
00657 #endif
00658 
00659 
00660 PyObject* inittrans(void) {
00661 #if PY_MAJOR_VERSION >= 3
00662   PyObject *m = PyModule_Create(&transdef);
00663 #else
00664   PyObject *m = Py_InitModule3("trans", methods, trans_moddoc);
00665 #endif
00666 
00667   return m;
00668 }
00669 
00670 
00671 

Generated on Fri Oct 11 02:44:35 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002