[Kalzium] [Open Babel] OBUnitCell, some question, code contribution

Geoffrey Hutchison geoff at geoffhutchison.net
Mon Jun 19 16:46:26 CEST 2006


On Jun 18, 2006, at 4:08 AM, Carsten Niehaus wrote:

> Still, I am missing some things and would like to discuss this.  
> Perhaps it is
> already somewhere and I just didn't find it our perhaps I am  
> stupid ;-)

No, you're not stupid at all. ;-) And it's not really missing, as  
Jean mentioned, it's just currently in development since other tools  
exist for crystal cell transformations. I'd be quite happy to help  
see some of this introduced into the development effort for 2.1.

>  - an enum of the crystalsystem. Currently I am working around this  
> like this
> in my own code:
...
>   I think this could find a nice place in OpenBabel as well as  
> those seven
> types won't ever change. Currently there is
> 	std::string GetSpaceGroup( )
>   As there is no API-documentation at all about it I guess these  
> represent the
> 230 spacegroups we all know? If so there should/could be something  
> like

Well, there's little API documentation because it's just Get/Set.  
There's currently no code yet for crystal group symmetry transforms  
or space group perception. But yes, the GetSpaceGroup is designed for  
the 230 standard space groups.

>             LATTICE bravisLattice( std::string spacegroup )
>   as each spacegroup is in one of the 14 bravislattice... Same for the
> pointgroups. Why not adding a pointgroup2crystalgroup method?

Good suggestions for both. You probably also want a Get/ 
SetBravaisLattice() method independent of a space group.

>  - An algo which computes the volume of a OBUnitCell. Well, do not  
> longer
> care, just commit the attached code ;-) I ported from my own code.  
> Any free
> licences (GPL, FreeBSD ...) is fine with me. Any chance to get this  
> in OB2.1?

I'll add it to the development tree shortly. Obviously, I'd be happy  
to also arrange for you to have development access to the SVN tree too.

> the vectors and angles. Fine. But that give me the information  
> which atoms
> are where. I googled for codeuses of this class but found no matches.

There are quite a few examples in the src/formats directory. Remember  
that most of the Open Babel library code is used directly by file  
translation formats. :-)

For example, src/formats/freefractformat.cpp

> So what am I supposed to do? Do I create an OBMol from the  
> information in the
> OBUnitCell to store the information of the atoms? That doesn't make  
> real
> sense, neither code-wise nor chemically...

I think it makes lots of sense both code-wise and chemically, so  
perhaps we should discuss this. The OBGenericData types which include  
OBUnitCell are designed to support a range of custom data for  
molecules, bonds, atoms, reactions... So OBUnitCell is targeted to  
store and handle unit cell transformations, different  
representations, etc. but not the actual atomic coordinates.

An OBMol object can contain OBUnitCell as a way to store such  
information with a molecule. Chemically, it makes lots of sense to me  
-- the most abundant crystal cells are for molecular solids, and even  
systems like diamond or silicon can be imagined as an "extended  
molecule." Moreover, if you're implementing a viewer, you can support  
an OBMol viewer and check if it contains unit cell information -- the  
same viewer code can be used for either an isolated molecule or an  
extended crystal. (Ghemical does this, for example.)

Code-wise, it would be great to have an OBFractionalMol which is  
specifically targeted to fractional coordinates and only handles  
coordinate transforms on conversion to a generic OBMol. But coding  
that didn't happen in the time-frame for 2.0, although it's on the  
general roadmap -- making more speciality-purpose targeted OBMol  
subclasses to further push the concept of lazy evaluation.

Hope that helps -- please continue to ask questions. :-)

Cheers,
-Geoff


More information about the Kalzium mailing list