On Wed, Mar 3, 2010 at 4:33 AM, Vincent Favre-Nicolin <vinc...@users.sourceforge.net> wrote: >> See the attached POSCAR and POTCAR. When opened in Avogadro, the cell >> is displayed as shown in the screenshot. The atoms are given in >> fractional coordinates -- there should not be any outside the cell! At >> a glance, it seems Avogadro is calling GetCellVectors, which >> constructs the vectors from GetOrthoMatrix, which ignores the "real" >> vectors, instead rebuilding them from a,b,c, etc. > > Why is it that the lattice parameters are not equivalent to the > orthonormalization matrix in the first place ??
DISCLAIMER: I am by no means a crystallography expert, so feel free to disagree with / correct anything I propose below :-) There is a lot of inconsistency in how data is handled there. Since the class holds both vectors and parameters, it was a crapshoot knowing which would be used in a member function without reading the source. I fixed that a few months ago to make sure that everything stayed up-to-date, but I think it's time to only store one representation of the cell, and I'll have that in today. > Does that mean that the matrix is not a true orthonormalization matrix (B, > with a standard convention of a parellel to Ox, b in the OxOy plane and c > deduced to make a direct reference frame), but rather a UB matrix, where U is > an orientation matrix ? My working copy at the moment is orthogonalizing the vectors in all of the SetData methods, so the matrix that is stored is always equivalent to the transpose of matrix3x3::FillOrth(). No orientation matrix at the moment, although it could be added? There is an offset vector in the class, I suppose an orientation matrix could be added. > Removing the a,b,c in favor of a matrix seems somewhat strange to me - in > crystallography the reference values always are the lattice parameters - the > rest should be derived. If the atoms are rotated, there should be an > orientation matrix, so that the orthonormal coordinates are given by: > (xyz)_ortho = U B (xyz)_frac a,b,c can still be used to set the cell and can be accessed through member functions. I think I'll add the orientation matrix too, so that: vector3 ortho = cell.GetOrientationMatrix() * cell.GetOrthoMatrix() * frac + cell.GetOffset() likewise, vector3 frac = cell.GetFractionalMatrix() * cell.GetOrientationMatrix().inverse() * (ortho - cell.GetOffset()) (someone may want to check my math wrt the orientation matrix above...) I'd also like to add a couple convenience functions, namely: vector3 OBUnitCell::fractionalToCartesian(vector3 frac) and vector3 OBUnitCell::cartesianToFractional(vector3 cart) to simplify such conversions. Dave ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ OpenBabel-Devel mailing list OpenBabel-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-devel