Avogadro Editor and Libraries

Hi Donald,

I’m still not sure about the UI toolkit, but in some ways, I think
that’s the least interesting question in the design of this project.
I think GTK, wxWidgets and Qt would all work – I may not like GTK,
but certainly both of us are used to it, and Ghemical certainly works
fine with it.

Yesterday I did a little survey to see if there were other sorts of
libraries which might help with other tasks. I came up with an
interesting little list:

  • GNU Triangulated Surface Library http://sourceforge.net/projects/
    gts
    • Based on GLib, features multi-resolution models, isosurfaces,
      Delaunay triangulations and set operations
    • Existing calls for surface volume and surface area (common
      requests for molecules)
  • VCG Lib http://sourceforge.net/projects/vcg/
    • A portable C++ templated library for manipulation, displaying,
      and processing of triangle and tetrahedral meshes.
  • GNU Scientific Library http://www.gnu.org/software/gsl/manual/
    html_node/
    • is a numerical library for C and C++ programmers.
      The library provides a wide range of mathematical routines such as
      random number generators, special functions and
      least-squares fitting. There are over 1000 functions in total with
      an extensive test suite.
  • FreePOOMA http://www.nongnu.org/freepooma/
    • FreePOOMA is a C++ library supporting element-wise, data-
      parallel, and stencil-based physics computations using one
      or more processors. The library supports high-level syntax close
      to mathematical or algorithmic syntax (like Fortran
      95), easing the conversion from algorithms to code.

I’m particular interested in the GTS library – it looks to handle
surfaces really easily, and the ability to handle multi-resolution
and level of detail depending on the view is very nice for chemistry.

Cheers,
-Geoff

Hello Again,

So yeah, it is a somewhat uninteresting question, but yet it’s very
important. For example; using the GTS library suggests a building
against GLib in which case GTK seems like a more logical choice.
Choosing QT4 and using GST would mean; not only do you rely on QT but
you also rely on GTS. Portability is a big issue too. It doesn’t look
like GTS has a native Windows or OSX port, just through Cygwin / Apple X11.

I did a lot of compiling today so i read up on the various toolkits;
For me it’s a very rough call. All toolkits have their ups and downs.

GTK2 : Very popular, lots of apps use it. That doesn’t always make it
the best choice. Things in GTK are very modular which means using a lot
of different libraries that do specific things really well. But thats
also added overhead. Plus, you have the problem that GTK isn’t as
cross-platform as some of the other libraries. The other added benefit
is that since GTK2 is in C, the cross-language support is great as it’s
easy to write bindings for it. This might be a big consideration when
dealing with plugins, however, i’d assume most plugins would go through
avogadro to do any gui operations rather than generating their own.
(PS: I don’t like glade. I think its a bad hack and glade should be
used to generate code to generate the widgets but thats just my opinion;
I’ve definatly used it.)

wxWidgets : Seems really nice since it uses “native” widgets for drawing
but it seems like it incurs a lot of overhead. Although i haven’t
played with it much or done any development with it. To be honest it’s
a toolkit i don’t “trust”. Does that make any sense? It seems like
something in a year people will just drop or won’t get maintained. I
think maybe it’s the literature; rather than boasting it’s features it
tends to point out what it does better than other toolkits. I’ve used
audacity a lot and I don’t quite like the feel of the gui. Response and
all.

QT4 : To be honest it looks pretty good. The only thing that i don’t
like about it is it’s macro extensions to C++ (eg. it uses some special
class entities (public slots: / signals:) as preprocessing commands
designating various expansions of your class to conform to their base
QObject class. Which now that I think about it isn’t a “huge” deal.
Basically just adding some extra functions for callbacks and such.
(part of it is my lack of understanding of what it’s doing and i just
skimmed the docs). QT4 also does native widget simulations (not
actually using the native widgets) which wxWidgets thinks slows it but
it doesn’t seem to be that big of an issue.

I read a long post from the guy that does Rosegarden
(http://www.rosegardenmusic.com/) who used to work on gtkmm (C++ gtk
wrapper) and while it was from 2004, it made the point that QT tends to
allow more work on features and less time screwing with the GUI things.

So for reference, Ghemical relies (dependancies of dependancies
included) on around 183MB of libraries. libghemical is 21MB itself and
openbabel is 30MB. libxml2 / libgtk are running around 5MB a piece.
The rest is probably X11 libraries and such. Storage is cheap,
distribution is a factor though. The ghemical binary dynamically linked
is 16MB. Granted; Ghemical is pretty heavy duty and I am always
concerned about size (especially now that i’m building packages for 2.00).

I think it’s key that Avagadro be available as a binary on OSX / Windows
and have a common + good look and feel.

If the decision is made to go with GTK i think there should be a
discussion as to whether or not to make the GUI class-based (as per
ghemical) which i would vote against. Having to instanciate two
functions for each callback (one static and one instance-based) drives
me crazy.

PS: i’m going to make a quick attempt at compiling some of the ghemical
code under windows natively and see how that turns out. If anything
it’ll shed a bit of light on the cross-platform issue and GTK2.

-Donald

Geoffrey Hutchison wrote:

Hi Donald,

I’m still not sure about the UI toolkit, but in some ways, I think
that’s the least interesting question in the design of this project. I
think GTK, wxWidgets and Qt would all work – I may not like GTK, but
certainly both of us are used to it, and Ghemical certainly works fine
with it.

Yesterday I did a little survey to see if there were other sorts of
libraries which might help with other tasks. I came up with an
interesting little list:

  • Based on GLib, features multi-resolution models, isosurfaces,
    Delaunay triangulations and set operations
  • Existing calls for surface volume and surface area (common requests
    for molecules)
  • A portable C++ templated library for manipulation, displaying, and
    processing of triangle and tetrahedral meshes.
  • is a numerical library for C and C++ programmers.
    The library provides a wide range of mathematical routines such as
    random number generators, special functions and
    least-squares fitting. There are over 1000 functions in total with an
    extensive test suite.
  • FreePOOMA is a C++ library supporting element-wise, data- parallel,
    and stencil-based physics computations using one
    or more processors. The library supports high-level syntax close to
    mathematical or algorithmic syntax (like Fortran
    95), easing the conversion from algorithms to code.

I’m particular interested in the GTS library – it looks to handle
surfaces really easily, and the ability to handle multi-resolution and
level of detail depending on the view is very nice for chemistry.

Cheers,
-Geoff