Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help
Special pages
SBGrid Resources
SBGrid Consortium
SBGrid Data Bank
Software Webinars
PyMOL Webinar
PyMOL Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
User:Speleo3/VMD plugins
(section)
User page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
User contributions
Logs
View user groups
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Required Files == === setup.patch === <syntaxhighlight lang="diff"> --- setup.py (revision 3998) +++ setup.py (working copy) @@ -265,6 +265,16 @@ "-g" ] ext_link_args = [] +with_vmd_plugins = 1 +if with_vmd_plugins: + try: + from setup_vmd_plugins import vmd_plugins_dirs, vmd_plugins_files + except ImportError: + raise SystemExit('please run vmd_plugins_update.py first') + inc_dirs += vmd_plugins_dirs + def_macros += [ ("_PYMOL_VMD_PLUGINS", None) ] +else: + vmd_plugins_files = [] distribution = setup ( # Distribution meta-data name = "pymol", @@ -420,6 +430,7 @@ "layer5/TestPyMOL.c", "layer5/main.c" # VMD plugin support + ] + vmd_plugins_files + [ # switch the 0 to 1 to activate the additional source code ] + 0 * [ # (incomplete support -- only TRJ, TRR, XTC, DCD so far...) </syntaxhighlight> === vmd_plugins_update.py === <syntaxhighlight lang="python"> ''' Convert VMD plugin source files for PyMOL. (Modified version of "contrib/uiuc/plugins/molfile_plugin/update.py") Please download and unpack the VMD source code from: http://www.ks.uiuc.edu/Development/Download/download.cgi?PackageName=VMD Then run this script from the PyMOL source root and point it to the "plugins" directory from the VMD source tree. Example: cd /tmp tar xzf vmd-1.9.1.src.tar.gz cd /tmp/pymol python vmd_plugins_update.py /tmp/plugins You can enable/disable particular plugins from the "src_list" variable in this file. ''' import os import sys from glob import glob from distutils import file_util, dir_util src_list = [ # 'avsplugin', # 'babelplugin', # requires openbabel # 'basissetplugin', # # 'bgfplugin', # 'binposplugin', # 'biomoccaplugin', # 'brixplugin', # 'carplugin', # 'ccp4plugin', # 'cdfplugin', # requires netcdf # 'corplugin', # 'cpmdlogplugin', # # 'cpmdplugin', 'crdplugin', # 'cubeplugin', 'dcdplugin', # 'dlpolyplugin', # 'dsn6plugin', # 'dtrplugin', # # 'dxplugin', # 'edmplugin', # 'fs4plugin', # 'gamessplugin', # 'gaussianplugin', # # 'graspplugin', # 'grdplugin', # 'gridplugin', 'gromacsplugin', # 'hoomdplugin', # requires expat # 'jsplugin', # # 'lammpsplugin', # requires gz # 'maeffplugin', # # 'mapplugin', # 'mdfplugin', # 'mmcif', # # 'mol2plugin', # 'moldenplugin', # 'mrcplugin', # gone? # 'msmsplugin', # 'namdbinplugin', # 'netcdfplugin', # requires netcdf # 'parm7plugin', # 'parmplugin', # 'pbeqplugin', # # 'pdbplugin', # 'phiplugin', # 'pltplugin', # 'pqrplugin', # 'psfplugin', # 'raster3dplugin', # 'rst7plugin', # 'situsplugin', # 'spiderplugin', # 'stlplugin', # 'tinkerplugin', # 'uhbdplugin', # 'vaspchgcarplugin', # # 'vaspoutcarplugin', # # 'vaspparchgplugin', # # 'vaspposcarplugin', # # 'vaspxdatcarplugin', # # 'vaspxmlplugin', # # 'vtfplugin', # # 'webpdbplugin', # tcl dependent # 'xbgfplugin', # 'xsfplugin', # 'xyzplugin', ] # check command line argument if len(sys.argv) < 2 or sys.argv[1] in ('-h', '--help'): print __doc__.strip() sys.exit(1) # paths vmd_plugins_path = sys.argv[1] molfile_src_path = os.path.join(vmd_plugins_path, 'molfile_plugin', 'src') molfile_dst_path = os.path.join('contrib', 'uiuc_molfile_plugin') # copy required files dir_util.mkpath(molfile_dst_path) for f in [os.path.join(molfile_src_path, 'hash.c')] + \ glob(os.path.join(molfile_src_path, '*.h*')) + \ glob(os.path.join(vmd_plugins_path, 'include', '*.h')): file_util.copy_file(f, molfile_dst_path) # prepare setup_vmd_plugins.py setup_out = open('setup_vmd_plugins.py', 'w') setup_out.write('vmd_plugins_dirs = [ %s ]\n' % repr(molfile_dst_path)) setup_out.write('vmd_plugins_files = [\n') for f in ['PlugIOManagerInit.c', 'hash.c']: out_file = os.path.join(molfile_dst_path, f) setup_out.write(repr(out_file) + ',\n') # patch and copy desired plugin source files for pref in src_list: try: in_file = glob(molfile_src_path + "/" + pref + ".[cC]*")[0] except KeyError: print 'MISSING:', pref continue out_file = os.path.join(molfile_dst_path, pref + '.c') content = open(in_file).read() content.replace('(vmdplugin_t *)', '(vmdplugin_t *)(void*)') # c++ if in_file[-2:] == '.C' or in_file[-4:] == '.cxx': out_file += 'pp' content = content.replace('VMDPLUGIN_API', 'VMDPLUGIN_EXTERN') print in_file, '->', out_file setup_out.write(repr(out_file) + ',\n') with open(out_file, 'w') as g: g.write("/* MACHINE GENERATED FILE, DO NOT EDIT! */\n\n") g.write("#define VMDPLUGIN molfile_%s\n" % pref) g.write("#define STATIC_PLUGIN 1\n\n") g.write(content) setup_out.write(']\n') setup_out.close() # PlugIO init file with open(os.path.join(molfile_dst_path, 'PlugIOManagerInit.c'), 'w') as g: g.write(''' /* MACHINE GENERATED FILE, DO NOT EDIT! */ #include "vmdplugin.h" typedef struct _PyMOLGlobals PyMOLGlobals; int PlugIOManagerRegister(PyMOLGlobals *G, vmdplugin_t *); ''') # prototypes for pref in src_list: g.write(''' int molfile_%s_init(void); int molfile_%s_register(void *, vmdplugin_register_cb); int molfile_%s_fini(void); ''' % (pref, pref, pref)) g.write(''' int PlugIOManagerInitAll(PyMOLGlobals *G) { int ok = 1 \\ ''') # init for pref in src_list: g.write(''' && (molfile_%s_init() == VMDPLUGIN_SUCCESS)''' % pref) # register for pref in src_list: g.write(''' && (molfile_%s_register(G, (vmdplugin_register_cb)PlugIOManagerRegister) == VMDPLUGIN_SUCCESS)''' % pref) g.write('''; return ok; } int PlugIOManagerFreeAll(void) { int ok = 1 \\ ''') # fini for pref in src_list: g.write(''' && (molfile_%s_fini() == VMDPLUGIN_SUCCESS)''' % pref) g.write('''; return ok; } ''') </syntaxhighlight>
Summary:
Please note that all contributions to PyMOL Wiki are considered to be released under the GNU Free Documentation License 1.2 (see
PyMOL Wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
User:Speleo3/VMD plugins
(section)
Add topic