QTAIM Review

Hi Marcus,

There’s a backlog in the review queue right now (two pages worth). Some of these are my GAMESS-US patches, and a lot of them are Eric’s QTAIM patches.

I don’t quite know where to start with his patches. I grabbed his latest “main” from Git and saw that he introduced a pile of QTAIM headers and code into the main libavogadro directory, and worse added a bunch of accessors to the Molecule class. I think the feature is great (AIM analysis has been somewhat obscure before this), but it seems to break the compartmentalization we’ve built up with extensions.

I think the main problem is that there’s no obvious way to add custom properties and objects to the Molecule object. My suggestion is to use the built-in QObject property system, which uses QVariants. So accessing the set of QTAIM bond critical points would be something like:

Molecule mol;
QVariant property = mol.property(“QTAIM_BOND_CRITICAL_POINTS”);
if (!property.isValid())
return; // no points determined
QList bondCriticalPointsList = property.toList();

Now QVariant has support for handling all sorts of custom types:
http://doc.qt.nokia.com/4.7/qvariant.html#fromValue
http://doc.qt.nokia.com/4.7/qvariant.html#value

Does this seem like a good scheme to suggest to Eric for QTAIM? Other thoughts?

-Geoff

On 22 September 2010 16:51, Geoffrey Hutchison geoff.hutchison@gmail.com wrote:

I don’t quite know where to start with his patches. I grabbed his latest “main” from Git and saw that he introduced a pile of QTAIM headers and code into the main libavogadro directory, and worse added a bunch of accessors to the Molecule class. I think the feature is great (AIM analysis has been somewhat obscure before this), but it seems to break the compartmentalization we’ve built up with extensions.

The contents of this email might be totally obvious already, but while
I’m pretty new to the Avogadro source code (I’ve mostly only been
looking at Python scripting and altering the POV painter) one thing I
do do is AIM analysis.

I think the main problem is that there’s no obvious way to add custom properties and objects to the Molecule object. My suggestion is to use the built-in QObject property system, which uses QVariants. So accessing the set of QTAIM bond critical points would be something like:

Does this seem like a good scheme to suggest to Eric for QTAIM? Other thoughts?

So, if I understand what you’re saying correctly, to implement things
like this, you’d have:

  • an extension which sets a custom property on a molecule or a
    subgroup of the atoms
  • an engine and/or extension and/or tool that reads these properties

So for AIM, some sort of solution would have:

  • an extension which reads some AIM program’s output files and adds
    the property to the molecule’s designated generic property storage
  • an engine which reads those properties and renders the list of BCPs,
    RCPs, CCPs, and NACPs provided
  • an engine which reads the same properties and renders bond paths and
    paths to ring and cage points if you have them
  • a tool which can read the same properties and measure the distances
    between CPs if you like that sort of thing

Adding a demonstrated and intended way to implement these sorts of
custom data sets seems like a good idea to me. Apart from this, it’d
also have applications for visualising PCM charges, just off the top
of my head.

(Apologies if this comes across as somewhat newbie-ish.)
-Ian

On Sep 22, 2010, at 8:06 PM, Ian Kirker wrote:

I’m pretty new to the Avogadro source code (I’ve mostly only been
looking at Python scripting and altering the POV painter) one thing I
do do is AIM analysis.

Ian, meet Eric. Eric, Ian.

So, if I understand what you’re saying correctly, to implement things
like this, you’d have:

  • an extension which sets a custom property on a molecule or a
    subgroup of the atoms
  • an engine and/or extension and/or tool that reads these properties

Yes, exactly.

  • an extension which reads some AIM program’s output files and adds
    the property to the molecule’s designated generic property storage

Yes. Actually, the advantage of Avogadro is that we also read other types of output files which can supply the wavefunction on arbitrary grids (e.g., for MO or ESP surfaces). So we’re not limited to AIM files, in theory, you could also hook into handling Gaussian fchk files and the like.

Right now, Eric has stuck to reading WFN files.

  • an engine which reads those properties and renders the list of BCPs,
    RCPs, CCPs, and NACPs provided
  • an engine which reads the same properties and renders bond paths and
    paths to ring and cage points if you have them

I believe Eric has done the extension and the rendering engines you describe. It’s on his GitHub repository:
http://github.com/ecbrown/avogadro

  • a tool which can read the same properties and measure the distances
    between CPs if you like that sort of thing

Not a bad idea.

Adding a demonstrated and intended way to implement these sorts of
custom data sets seems like a good idea to me.

Right, that’s my point – there’s no example code, so Eric has done it kinda by brute force. (No offense intended.) My idea is to set up some example code for how to handle custom data without needing to add more interfaces to the Molecule class.

None of this was really “newbie” in any way. :slight_smile:

Hope that helps,
-Geoff

P.S. I suspect anyone else interested in AIM analysis in Avogadro might want to contact Eric (cc’ed) and offer some help testing and/or reviewing the code. :slight_smile:

Hi Geoff,

On Sep 22, 2010, at 11:51 AM, Geoffrey Hutchison wrote:

Hi Marcus,

There’s a backlog in the review queue right now (two pages worth). Some of these are my GAMESS-US patches, and a lot of them are Eric’s QTAIM patches.

Yes, I saw those. I just got back from England (gone 2am Tuesday morning), and had very sketchy Internet connectivity for the last week or so, but was pleased to see both the GAMESS-US patches and the QTAIM patches. I was planning on upgrading Gerrit again, but larger topic branches are easier to handle if we start using the topic branch tagging feature introduced with Gerrit 2.1.4.

I don’t quite know where to start with his patches. I grabbed his latest “main” from Git and saw that he introduced a pile of QTAIM headers and code into the main libavogadro directory, and worse added a bunch of accessors to the Molecule class. I think the feature is great (AIM analysis has been somewhat obscure before this), but it seems to break the compartmentalization we’ve built up with extensions.

You can check out the tip of the topic branch, and that will pull in all of the commits. I will have time this weekend, and plan on spending some time on this patch series, and yours, as they are both of great interest to me. If someone pushes a topic branch then you can fetch the final patch in a series, review that (git log --stat origin/master…), or adding a -p to log to see the diffs for each commit.

Gerrit has improved quite a bit recently when handling multiple commits. This will be a great chance to document some of those changes on our wiki, and integrate these two series. I see the stuff from Jens and DL-POLY too. I need to get over jet-lag a little, but will certainly spend some time working through the backlog.

I think the main problem is that there’s no obvious way to add custom properties and objects to the Molecule object. My suggestion is to use the built-in QObject property system, which uses QVariants. So accessing the set of QTAIM bond critical points would be something like:

Molecule mol;
QVariant property = mol.property(“QTAIM_BOND_CRITICAL_POINTS”);
if (!property.isValid())
return; // no points determined
QList bondCriticalPointsList = property.toList();

Now QVariant has support for handling all sorts of custom types:
http://doc.qt.nokia.com/4.7/qvariant.html#fromValue
http://doc.qt.nokia.com/4.7/qvariant.html#value

Does this seem like a good scheme to suggest to Eric for QTAIM? Other thoughts?

I think that this is a good way of adding this kind of data. I would rather we restricted it to the Molecule class, and avoid adding stuff like this to Atom, Bond, etc. QVariant is a great data structure to use in order to put many custom types into a Molecule that we didn’t initially consider, and I have used this approach in other situations.

Thanks,

Marcus

  • an extension which reads some AIM program’s output files and adds the
    property to the molecule’s designated generic property storage

Yes. Actually, the advantage of Avogadro is that we also read other
types of output files which can supply the wavefunction on arbitrary
grids (e.g., for MO or ESP surfaces). So we’re not limited to AIM files,
in theory, you could also hook into handling Gaussian fchk files and the
like.

Right now, Eric has stuck to reading WFN files.

Does Open Babel have a wave function format? It seems that the prefered
path for reading files is through Open Babel routines. I think that the
fchk files get read first by OB and then re-read before it generates the
orbitals?

I thought I saw a thread where Marcus and Konstantin were interested in
adding MOs to Open Babel.

The WFN format is the old POLYATOM format. It’s kind of a pain to work
with unless you are using Fortran. You also have to remember to generate
it with the right keyword, and hope that the quantum chemistry program has
the capability.

We’re a stone’s throw away from reading fchk, MOLDEN, etc. It also looks
like Geoff has GAMESS-US almost finished (though GAMESS generates WFN
files, too). For my code, the shells should be unrolled into normalized
Cartesian Gaussian primitives, that is 6D instead of 5D, etc.

  • an engine which reads those properties and renders the list of BCPs,
    RCPs, CCPs, and NACPs provided * an engine which reads the same
    properties and renders bond paths and paths to ring and cage points if
    you have them

I believe Eric has done the extension and the rendering engines you
describe. It’s on his GitHub repository:
http://github.com/ecbrown/avogadro

The code definitely generates molecular graphs with Nuclear Critical
Points (NCPS), Bond Critical Points (BCPs) and Bond Paths. It uses the
LSODA integrator, which is capable of switching between non-stiff and
stiff methods automatically.

I’m a big proponent of doing things correctly and with as little user
interaction as possible even if they happen to be more expensive. The
methods now need to be tuned, but they do work and there is no “fiddling”
with parameters.

As for Ring and Cage Critical Points (RCPs and CCPs), they are more
difficult to locate than NCPs and BCPs because the heuristics for locating
them are not as well defined. That is, NCPs are (usually) near nuclear
centers, BCPs are (roughly) between NCPs. If you have a ring of BCPs, then
there must be an RCP somewhere, but it is not necessarily anywhere close
to the geometric center of the three or more BCPs. For CCPs, it seems to
be worse.

Just as an FYI, I am going to get the Charge Integration (Quadrature)
going before I work on RCPs and CCPs. My plan is to use CUBPACK and do
adaptive quadrature.

(Also I should point out that all of the routines run across all
processors using QtConcurrent.)

  • a tool which can read the same properties and measure the distances
    between CPs if you like that sort of thing

Not a bad idea.

Right, there is tons of stuff to do! :-))))

Adding a demonstrated and intended way to implement these sorts of
custom data sets seems like a good idea to me.

Right, that’s my point – there’s no example code, so Eric has done it
kinda by brute force. (No offense intended.) My idea is to set up some
example code for how to handle custom data without needing to add more
interfaces to the Molecule class.

Adding to the Molecule class just about killed me. I think that I
understand–add “attributes” or something similar to the Molecule object.
I will have to read more about this in the documentation.

It’s true that what I have there now probably can’t stay there. :frowning:

P.S. I suspect anyone else interested in AIM analysis in Avogadro might
want to contact Eric (cc’ed) and offer some help testing and/or
reviewing the code. :slight_smile:

Yes, please write me if you would like to help or if you have
comments/criticisms! Thanks especially to Geoff and Marcus for their help
and encouragement getting this subproject started!!!

All the best,
Eric