[gmx-developers] Using C++ with Gromacs

Axel Kohlmeyer akohlmey at cmm.chem.upenn.edu
Thu May 8 00:10:48 CEST 2008


On Wed, 7 May 2008, Peter Eastman wrote:

PE> On May 7, 2008, at 1:55 PM, Axel Kohlmeyer wrote:
PE> 
PE> >why don't you just add a C API to your library _within_
PE> >your library and then just link with it?
PE> 
PE> It uses a modular, object oriented, dynamically extensible architecture.
PE> Expressing that through a C API would be very difficult.

who said that you have to map _all_ of your library?
but if you are writing an alternate version of do_md() 
you _are_ essentially writing a C API.

of course it is quite possible (although a bit of a pain) 
to express a modular, object oriented and dynamically 
extensible architecture through a C API. i have even 
seen it done in fortran (which is extremely painful).

just write put all the interface calls that you need 
to do from within your do_md() into an 'extern "C"'
and then you only need minimal modifications in 
gromacs to add your functionality.

also, you didn't specify which functionality of gromacs
you would like to preserve, since by replacing do_md() 
you are already taking its "heart" away. i suspect,
that in general it may actually be simpler and more 
straightforward to do the interfacing in the opposite
direction. 

cheers,
   axel.

PE> 
PE> Peter
PE> 
PE> _______________________________________________
PE> gmx-developers mailing list
PE> gmx-developers at gromacs.org
PE> http://www.gromacs.org/mailman/listinfo/gmx-developers
PE> Please don't post (un)subscribe requests to the list. Use thewww interface
PE> or send it to gmx-developers-request at gromacs.org.
PE> 

-- 
=======================================================================
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.



More information about the gromacs.org_gmx-developers mailing list