[Kalzium] OBUnitCell, some question, code contribution

Carsten Niehaus cniehaus at gmx.de
Sun Jun 18 10:08:57 CEST 2006


Guten Morgen

I am starting to write a crystal-cell viewer for Kalzium. For that I need some 
information about the cell:

- The x/y/z-pos of all atoms in it
- The type of the Atoms (for example in NaCl if a certain atom is Na or Cl)
- The position of all Tetraederlücken (sorry, I couldn't find the english word 
for it, not even in Wikepedia. The german article is in [1])
- The position of all Oktaederlücken. (again, no translation found. The german 
article is in [2], a nice picture which says it all is in [3])
- The crystalsystem or (even better) the Bravis-lattice of the unitcell.
- the length of the vectors a,b,c
- the angles alpha, beta, gamma

Ok, some of this is in OBUnitCell, some is not. Of course, the position of 
the "holes" (Tetraeder- and Oktaderlücken) can be calculated, if I know the 
Bravis-lattice I can calculate the xyz of all atoms and so on.

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 ;-)

What I am missing:

== 1 ==
 - an enum of the crystalsystem. Currently I am working around this like this 
in my own code:

        enum LATTICE
        {
            TRICLINIC,
            MONOCLINIC,
            ORTHORHOMBIC,
            TETRAGONAL,
            RHOMBOHEDRAL,
            HEXAGONAL,
            CUBIC
        };

  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
            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?

== 2 ==
 - 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?

== 3 ==
- I still have not figured out how to use OBUnitCell. Of course I can store 
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.
For example, if I want to draw Lithium niobate (Spacegroup R3m, pointgroup 3m, 
crystalsystem trigonal) I have three atomtypes (Li, Nb, O). (Picture in [4]). 
I cannot put all that information into OBUnitCell. Same for NaCl (picture in 
[5]).
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...

Gruß, 
  Carsten

[1] http://de.wikipedia.org/wiki/Tetraederlücke
[2] http://de.wikipedia.org/wiki/Oktaederlücke
[3] http://de.wikipedia.org/wiki/Bild:Kfz_oktaederluecke.png
[4] 
http://upload.wikimedia.org/wikipedia/commons/thumb/f/f5/Linbo3_Unit_Cell.png/300px-Linbo3_Unit_Cell.png
[5] 
http://upload.wikimedia.org/wikipedia/commons/d/db/NaCl-estructura_cristalina.svg

-- 
Gruß,
  Carsten Niehaus
-------------- next part --------------
double ObUnitCell::volume()
{
	double result = 0.0;
	
	switch ( m_lattice )//this has to implemented ;-)
	{
		case 0://triclinic
			result = _a * _b * _c * sqrt(1
						- pow(cos( _alpha ), 2)
						- pow(cos( _beta ), 2)
						- pow(cos( _gamma ), 2)
						+ 2 * cos( _alpha ) * cos( _beta ) * cos( _gamma )
					);
			break;
		case 1://monooclinic
			result = _a * _b * _c * sin( _beta );
			break;
		case 2://Orthorhombic
			result = _a * _b * _c;
			break;
		case 3://Tetragonal
			result = _a * _a * _c;
			break;
		case 4://Rhombohedral
			result = pow( _a, 3 ) * sqrt(1
						- pow(cos( _alpha ), 2)
						- pow(cos( _beta ), 2)
						- pow(cos( _gamma ), 2)
						+ 2 * cos( _alpha ) * cos( _beta ) * cos( _gamma )
					);
			break;
		case 5://Hexagonal
			result = pow( 3, 1/3 ) * _a * _a * _c / 2;
			break;
		case 6://Cubic
			result = pow( _a, 3 );
			break;
	}

	return result;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kalzium/attachments/20060618/f840580a/attachment.pgp 


More information about the Kalzium mailing list