Coverage Summary for Class: OrthogonaliseAtomCoordinates (net.crystallography.helpers.cdk)

Class Class, % Method, % Line, %
OrthogonaliseAtomCoordinates 100% (1/ 1) 100% (2/ 2) 100% (11/ 11)


1 /*---------------------------------------------------------------------------*\ 2 **$Author: saulius $ 3 **$Date: 2017-11-19 10:57:14 +0200 (Sun, 19 Nov 2017) $ 4 **$Revision: 72 $ 5 **$URL: svn://www.crystallography.net/smiles-scripts/trunk/src/net/crystallography/vector/space/ChangeOfBasis.java $ 6 \*---------------------------------------------------------------------------*/ 7  8 // Compute Cartesian (orthogonal) coordinates in a CDK ICrystal 9 // object. 10  11 package net.crystallography.helpers.cdk; 12  13 import javax.vecmath.Matrix3d; 14 import javax.vecmath.Point3d; 15 import org.openscience.cdk.interfaces.IAtom; 16 import org.openscience.cdk.interfaces.ICrystal; 17  18 import net.crystallography.vector.space.ChangeOfBasis; 19  20 public class OrthogonaliseAtomCoordinates { 21  22  public static void computeOrthogonalCoordinates( ICrystal crystal ) { 23  assert crystal != null; 24  25  Matrix3d m = ChangeOfBasis.changeOfBaseMatrix( crystal.getA(), 26  crystal.getB(), 27  crystal.getC() ); 28  29  for( IAtom atom : crystal.atoms() ) { 30  Point3d f = atom.getFractionalPoint3d(); 31  Point3d xyz = ChangeOfBasis.mpMultiply( m, f ); 32  atom.setPoint3d( xyz ); 33  } 34  } 35  36 }