diff --git a/src/AngleCmd.h b/src/AngleCmd.h index 3b176fa..61afdc2 100644 --- a/src/AngleCmd.h +++ b/src/AngleCmd.h @@ -15,7 +15,6 @@ // AngleCmd.h: // //////////////////////////////////////////////////////////////////////////////// -// \$Id: AngleCmd.h,v 1.5 2008-09-08 15:56:17 fgygi Exp \$ #ifndef ANGLECMD_H #define ANGLECMD_H @@ -85,7 +84,7 @@ class AngleCmd : public Cmd D3vector r12(a1->position()-a2->position()); D3vector r32(a3->position()-a2->position()); - if ( norm(r12) == 0.0 || norm(r32) == 0.0 ) + if ( norm2(r12) == 0.0 || norm2(r32) == 0.0 ) { if ( ui->onpe0() ) { diff --git a/src/AngleConstraint.C b/src/AngleConstraint.C index 325649a..3c9ad0a 100644 --- a/src/AngleConstraint.C +++ b/src/AngleConstraint.C @@ -323,8 +323,8 @@ void AngleConstraint::grad_sigma(const D3vector &r1, const D3vector &r2, { D3vector r12(r1-r2); D3vector r32(r3-r2); - assert(norm(r12) > 0.0); - assert(norm(r32) > 0.0); + assert(norm2(r12) > 0.0); + assert(norm2(r32) > 0.0); D3vector e12(normalized(r12)); D3vector e32(normalized(r32)); const double ss = length(e12^e32); @@ -344,7 +344,7 @@ void AngleConstraint::grad_sigma(const D3vector &r1, const D3vector &r2, { // choose direction e as e12+e32 D3vector e(e12+e32); - assert(norm(e)>0.0); + assert(norm2(e)>0.0); e = normalized(e); const double r12_inv = 1.0/length(r12); const double r32_inv = 1.0/length(r32); diff --git a/src/Basis.C b/src/Basis.C index 0c0e2dc..cc8d837 100644 --- a/src/Basis.C +++ b/src/Basis.C @@ -309,7 +309,7 @@ bool Basis::resize(const UnitCell& cell, const UnitCell& refcell, // defcell: cell used to define which vectors are contained in the Basis // if refcell is defined, defcell = refcell // otherwise, defcell = cell - if ( norm(refcell.b(0)) + norm(refcell.b(1)) + norm(refcell.b(2)) == 0.0 ) + if ( norm2(refcell.b(0)) + norm2(refcell.b(1)) + norm2(refcell.b(2)) == 0.0 ) { defcell = cell; } @@ -322,7 +322,7 @@ bool Basis::resize(const UnitCell& cell, const UnitCell& refcell, const D3vector b1 = defcell.b(1); const D3vector b2 = defcell.b(2); - const double normb2 = norm(b2); + const double normb2 = norm2(b2); const double b2inv2 = 1.0 / normb2; const D3vector kp = kpx*b0 + kpy*b1 + kpz*b2; @@ -382,7 +382,7 @@ bool Basis::resize(const UnitCell& cell, const UnitCell& refcell, bool found = false; for ( int l = lmin; l <= lmax; l++ ) { - const double two_e = norm(k*b1+l*b2); + const double two_e = norm2(k*b1+l*b2); if ( two_e < two_ecut ) { lstart = min(l,lstart); @@ -412,7 +412,7 @@ bool Basis::resize(const UnitCell& cell, const UnitCell& refcell, bool found = false; for ( int l = lmin; l <= lmax; l++ ) { - const double two_e = norm(h*b0+k*b1+l*b2); + const double two_e = norm2(h*b0+k*b1+l*b2); if ( two_e < two_ecut ) { lstart = min(l,lstart); @@ -452,7 +452,7 @@ bool Basis::resize(const UnitCell& cell, const UnitCell& refcell, bool found = false; for ( int l = lmin; l <= lmax; l++ ) { - const double two_e = norm((kpx+h)*b0 + (kpy+k)*b1 + (kpz+l)*b2); + const double two_e = norm2((kpx+h)*b0 + (kpy+k)*b1 + (kpz+l)*b2); if ( two_e < two_ecut ) { lstart = min(l,lstart); @@ -660,10 +660,10 @@ void Basis::update_g(void) kpgx_[locsize+i] = kpgt.y; kpgx_[locsize+locsize+i] = kpgt.z; - g2_[i] = norm(gt); + g2_[i] = norm2(gt); g_[i] = sqrt( g2_[i] ); - kpg2_[i] = norm(kpgt); + kpg2_[i] = norm2(kpgt); kpg_[i] = sqrt( kpg2_[i] ); gi_[i] = g_[i] > 0.0 ? 1.0 / g_[i] : 0.0; diff --git a/src/D3vector.h b/src/D3vector.h index 1b43c48..42c5eba 100644 --- a/src/D3vector.h +++ b/src/D3vector.h @@ -149,7 +149,7 @@ class D3vector return sqrt( a.x * a.x + a.y * a.y + a.z * a.z ); } - friend double norm( const D3vector& a ) + friend double norm2( const D3vector& a ) { return a.x * a.x + a.y * a.y + a.z * a.z; } diff --git a/src/EnergyFunctional.C b/src/EnergyFunctional.C index 01203c3..cd95804 100644 --- a/src/EnergyFunctional.C +++ b/src/EnergyFunctional.C @@ -162,7 +162,7 @@ EnergyFunctional::EnergyFunctional( Sample& s, const ChargeDensity& cd) // Electric enthalpy el_enth_ = 0; - if ( norm(s_.ctrl.e_field) != 0.0 ) + if ( norm2(s_.ctrl.e_field) != 0.0 ) el_enth_ = new ElectricEnthalpy(s_); sf.init(tau0,*vbasis_); diff --git a/src/TorsionCmd.h b/src/TorsionCmd.h index 8b49a36..21afda3 100644 --- a/src/TorsionCmd.h +++ b/src/TorsionCmd.h @@ -15,7 +15,6 @@ // TorsionCmd.h: // //////////////////////////////////////////////////////////////////////////////// -// \$Id: TorsionCmd.h,v 1.6 2008-09-08 15:56:19 fgygi Exp \$ #ifndef TORSIONCMD_H #define TORSIONCMD_H @@ -92,7 +91,7 @@ class TorsionCmd : public Cmd D3vector r12(a1->position()-a2->position()); D3vector r32(a3->position()-a2->position()); D3vector r43(a4->position()-a3->position()); - if ( norm(r12) == 0.0 || norm(r32) == 0.0 || norm(r43) == 0.0 ) + if ( norm2(r12) == 0.0 || norm2(r32) == 0.0 || norm2(r43) == 0.0 ) { if ( ui->onpe0() ) { diff --git a/src/UnitCell.C b/src/UnitCell.C index 0873c14..9d70ad9 100644 --- a/src/UnitCell.C +++ b/src/UnitCell.C @@ -124,8 +124,8 @@ void UnitCell::set(const D3vector& a0, const D3vector& a1, const D3vector& a2) for ( int i = 0; i < 13; i++ ) { - an2h_[i] = 0.5 * norm(an_[i]); - bn2h_[i] = 0.5 * norm(bn_[i]); + an2h_[i] = 0.5 * norm2(an_[i]); + bn2h_[i] = 0.5 * norm2(bn_[i]); } for ( int i = 0; i < 3; i++ )