From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Wed May 23 2007 - 16:19:17 CDT

On Wed, 23 May 2007, Yinglong Miao wrote:

YM> Dear VMD developers/users,

dear long,

YM> I have been reading online VMD Plugin Programmer's Guide, but still
YM> have not find answers for my specific problem. I want to write a TCL
YM> package as a plugin to VMD, while in the TCL package script, I want to
YM> call Fortran/C subroutines for the core procedures, which are very
YM> computationally intensive. So can I develop an efficient Fortran
YM> program and archive it into a binary library file with those
YM> computation subroutines so that I can them in TCL scripts? If yes, how

the way you do it, is mostly not VMD specific, but more
a generic extension of the TCL interpreter. so it may be
useful to look at how you do this in the general TCL
literature (online or hardcopy).

what you propose is doable, how easy it is depends a lot on
what you want to input into the plugin and how generic it is
and/or whether you need and access to VMD internal data.

there are several plugins in the VMD plugin library, that
use compiled extensions to the VMD interpreter. if you need
a simpler example, i can also send you my first version of the
measure gofr command, which was implemented as a plugin.

if possible, i would recommend to avoid writing plugins in
Fortran or C++ (c++ is usally ok, if you avoid the STL based
parts of the c++ runtime. i.e. write c with classes),
so you don't have to deal with loading the appropriate runtime
library (which may be incompatible to what VMD was compiled with).

YM> to include a binary library in a TCL package? Or can anyone tell me
YM> other ways to call Fortran/C subroutines in TCL to speed up the
YM> calculation?

the alternative would be to hook up your functionality directly
into VMD (e.g. as an additional measure subcommand), but that
requirest that you recompile VMD for your purposes.

another option would be that you write your data to a file and
then call a separate program (SURF, STRIDE, and MSMS for example
are used like this) and read in the resulting output. whether
this is more convenient or efficient depends a lot on the kind
of analysis that you have in mind and how much data you are
shuffling around.

cheers,
   axel.

YM>
YM> Any suggestios will be greatly appreciated.
YM>
YM> Best regards,
YM> Long
YM>
YM> --
YM> Yinglong Miao
YM> Ph.D. Candidate
YM> Center for Cell and Virus Theory
YM> Department of Chemistry, C203A
YM> Indiana University
YM> 800 E. Kirkwood Ave.
YM> Bloomington, Indiana 47405
YM> 1-812-856-0981 (office)
YM> 1-812-857-6205 (home)
YM> http://ylmiao.dict.cn/mypage/
YM>

-- 
=======================================================================
Axel Kohlmeyer   akohlmey_at_cmm.chem.upenn.edu   http://www.cmm.upenn.edu
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
=======================================================================
If you make something idiot-proof, the universe creates a better idiot.