[gmx-developers] Using C++ with Gromacs

Axel Kohlmeyer akohlmey at cmm.chem.upenn.edu
Thu May 8 22:29:40 CEST 2008

On Thu, 8 May 2008, Peter Eastman wrote:

PE> Success!  After far too many hours, I finally came up with the following
PE> mystical incantation which convinces automake to compile my file to its own
PE> library, then link it with mdrun:
PE> noinst_LTLIBRARIES += libopenmminterface.la
PE> libopenmminterface_la_SOURCES = md_openmm.cpp
PE> mdrun_LINK = $(CXXLINK)
PE> I know, written out that way it looks so innocuous.  How difficult could
PE> that possibly be? :)  You don't want to know how many hours when into that
PE> last line.  I still haven't managed to get it to produce a dynamic library,
PE> but I'll worry about that later.

since we were swapping "wartime" stories about c++ and related stuff,
i'd like to add two URLs to some interesting stories that everybody
should have seen when starting to work with DSOs and c++. i've been
through some similar pains when working on c++ DSOs for VMD.


PE> C++ and later got added to C (like the const keyword).  My impression is
PE> that if you even just stay away from templates and multiple inheritance,
PE> that alone will do a lot to reduce the compatibility issues.

nod. the LAMMPS MD code is a good example for that. it is mainly c 
with classes. but that one has the advantage of (normally) using 
only C++ for the main code and then linkes to c libraries. as soon 
as you add some fortran stuff (which is supported as optional package)
it starts to get nasty, too.

PE> Anyway, many thanks to everyone for your time and assistance.  I really
PE> appreciate it!  Hopefully we'll have something good to show in the not too
PE> distant future.

good luck!


PE> Peter
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.

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