From 3d24b55520ae16c7013e1b7858a702ce780be0b6 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 12 Sep 2007 17:08:11 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@849 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/lattice.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/lattice.cpp b/src/lattice.cpp index 1a6c399f14..1ce74edfc5 100644 --- a/src/lattice.cpp +++ b/src/lattice.cpp @@ -390,24 +390,27 @@ void Lattice::setup_transform() // rotaterow = 3x3 matrix with normalized orient vectors as rows - length = sqrt(orientx[0]*orientx[0] + orientx[1]*orientx[1] + - orientx[2]*orientx[2]); + int lensq = orientx[0]*orientx[0] + orientx[1]*orientx[1] + + orientx[2]*orientx[2]; + length = sqrt((double) lensq); if (length == 0.0) error->all("Zero-length lattice orient vector"); rotaterow[0][0] = orientx[0] / length; rotaterow[0][1] = orientx[1] / length; rotaterow[0][2] = orientx[2] / length; - length = sqrt(orienty[0]*orienty[0] + orienty[1]*orienty[1] + - orienty[2]*orienty[2]); + lensq = orienty[0]*orienty[0] + orienty[1]*orienty[1] + + orienty[2]*orienty[2]; + length = sqrt((double) lensq); if (length == 0.0) error->all("Zero-length lattice orient vector"); - + rotaterow[1][0] = orienty[0] / length; rotaterow[1][1] = orienty[1] / length; rotaterow[1][2] = orienty[2] / length; - - length = sqrt(orientz[0]*orientz[0] + orientz[1]*orientz[1] + - orientz[2]*orientz[2]); + + lensq = orientz[0]*orientz[0] + orientz[1]*orientz[1] + + orientz[2]*orientz[2]; + length = sqrt((double) lensq); if (length == 0.0) error->all("Zero-length lattice orient vector"); rotaterow[2][0] = orientz[0] / length;