[chimera-dev] C/C++ libraries in Chimera

Greg Couch gregc at cgl.ucsf.edu
Wed Dec 6 15:09:25 PST 2006


I'd second the recommendation for swig, it's an excellent package that 
takes care of these issues.  However, since you are limited to 
integer/float variables (I assume those don't crash) and arrays, you 
should investigate using numpy, <http://scipy.org>, formerly known as 
Numeric Python.  Some people even combine swig and numpy effectively. And 
if you're comfortable using C++ and smart pointers, then the 
recommendation would be to use the Boost Python package.

 	Good luck,

 	Greg Couch
 	UCSF Computer Graphics Lab

On Wed, 6 Dec 2006, Elaine Meng wrote:

> Date: Wed, 6 Dec 2006 09:46:37 -0800
> From: Elaine Meng <meng at cgl.ucsf.edu>
> To: Viktor Hornak <hornak at csb.sunysb.edu>
> Cc: chimera-dev at cgl.ucsf.edu
> Subject: Re: [chimera-dev] C/C++ libraries in Chimera
> 
> Hi Viktor,
> Actually, I'm the one person on the Chimera team that doesn't do
> programming!  I'll share your  mail with the chimera-dev at cgl.ucsf.edu
> list (for programmer/developer issues) - I believe it has a handful
> of subscribers in addition to the Chimera team members, and this set
> of people may have some valuable insights.
> Best,
> Elaine
>
> -----
> Elaine C. Meng, Ph.D.                          meng at cgl.ucsf.edu
> UCSF Computer Graphics Lab and Babbitt Lab
> Department of Pharmaceutical Chemistry
> University of California, San Francisco
>                      http://www.cgl.ucsf.edu/home/meng/index.html
>
>
> On Dec 6, 2006, at 9:28 AM, Viktor Hornak wrote:
>
>> Dear Elaine,
>>
>> sorry to write directly to you and not to chimera list but I have a
>> question which is rather off-topic. It concerns developing C
>> extensions in Python, and I don't even mean specifically for
>> chimera (at this time), but in general. I know that you guys (I am
>> not sure who specifically on chimera team does this sort of a "hard
>> core" programming work) develop a lot of extensions (.so libraries)
>> that can be called from Python and thus you must have a lot of
>> experience doing it. I attempted a couple times to write C
>> extensions in Python as described in Python extension guide but
>> always got burned by reference counting, programs crashing at
>> allocating memory or releasing pointers, etc. In other words, there
>> must be a better/easier way to write extensions. All I need is to
>> transfer integer/float variables and arrays to or from Python to my
>> C subroutine, e.g. I just need to wrap my existing C subroutines
>> and pass arrays back and forth between C and Python (I guess Python
>> lists versus C arrays). I was hoping someone on your team could
>> point me to the right direction. I saw people use SWIG (that looked
>> rather complex though and an overkill for what I need), or Pyrex,
>> etc but I wasn't sure which solution was worth picking up in terms
>> of time I have to spend to learn it and future support (so that the
>> project doesn't disappear in a year).
>> I would really appreciate if you could provide any hints or point
>> me to some resources.
>>
>> Many thanks for your help and sorry for such an unrelated question!!!
>>
>> Cheers,
>> -Viktor
>>
>> --
>> ===================================================================
>> Viktor Hornak
>> Center for Structural Biology   Phone: (631)632-1439
>> SUNY at Stony Brook             Fax:   (631)632-1555
>> Stony Brook, NY 11794-5115      E-mail: viktor.hornak at sunysb.edu
>> ===================================================================
>
> _______________________________________________
> Chimera-dev mailing list
> Chimera-dev at cgl.ucsf.edu
> http://www.cgl.ucsf.edu/mailman/listinfo/chimera-dev
>



More information about the Chimera-dev mailing list