@@ -93,7 +93,8 @@ CrystVector_REAL UnitCell::GetLatticePar() const
9393{
9494 VFN_DEBUG_MESSAGE (" UnitCell::GetLatticePar()" ,0 )
9595
96- if (mClockLatticeParUpdate >mClockLatticePar ) return mCellDim ;
96+ if ( (mClockLatticeParUpdate >mClockLatticePar )
97+ &&(mClockLatticeParUpdate >mSpaceGroup .GetClockSpaceGroup ())) return mCellDim ;
9798 else
9899 {
99100 // :NOTE: cannot use this->UpdateLatticePar() because it is not a const member function
@@ -164,7 +165,8 @@ REAL UnitCell::GetLatticePar(int whichPar)const
164165 if ( (whichPar<0 ) || (whichPar>5 ))
165166 throw ObjCrystException (" UnitCell::LatticePar(int) :trying to access parameter>5!" );
166167
167- if (mClockLatticeParUpdate >mClockLatticePar ) return mCellDim (whichPar);
168+ if ( (mClockLatticeParUpdate >mClockLatticePar )
169+ &&(mClockLatticeParUpdate >mSpaceGroup .GetClockSpaceGroup ())) return mCellDim (whichPar);
168170 else
169171 {
170172 const int num = mSpaceGroup .GetSpaceGroupNumber ();
@@ -320,6 +322,14 @@ void UnitCell::Print(ostream &os)const
320322const SpaceGroup & UnitCell::GetSpaceGroup () const {return mSpaceGroup ;}
321323SpaceGroup & UnitCell::GetSpaceGroup () {return mSpaceGroup ;}
322324
325+ void UnitCell::ChangeSpaceGroup (const string &spgId)
326+ {
327+ this ->GetSpaceGroup ().ChangeSpaceGroup (spgId);
328+ this ->InitRefParList ();
329+ this ->UpdateLatticePar ();
330+ }
331+
332+
323333const RefinableObjClock& UnitCell::GetClockLatticePar ()const {return mClockLatticePar ;}
324334const RefinableObjClock& UnitCell::GetClockMetricMatrix ()const {return mClockMetricMatrix ;}
325335
@@ -344,6 +354,9 @@ void UnitCell::Init(const REAL a, const REAL b, const REAL c, const REAL alpha,
344354 // mSpaceGroup.Print();
345355 mSpaceGroup .ChangeSpaceGroup (SpaceGroupId);
346356 // mSpaceGroup.Print();
357+ if ((alpha<=0 )||(alpha>=M_PI)) throw ObjCrystException (" alpha must be within ]0;pi[" );
358+ if ((beta<=0 ) ||(beta>=M_PI)) throw ObjCrystException (" beta must be within ]0;pi[" );
359+ if ((gamma<=0 )||(gamma>=M_PI)) throw ObjCrystException (" gamma must be within ]0;pi[" );
347360 mCellDim (0 )=a;
348361 mCellDim (1 )=b;
349362 mCellDim (2 )=c;
@@ -390,7 +403,8 @@ void UnitCell::InitMatrices() const
390403{
391404 // :NOTE: The Matrices must remain upper triangular, since this is assumed for
392405 // optimization purposes in some procedures.
393- if (mClockMetricMatrix >mClockLatticePar ) return ;// no need to update
406+ if ( (mClockMetricMatrix >mClockLatticePar )
407+ &&(mClockMetricMatrix >mSpaceGroup .GetClockSpaceGroup ())) return ;// no need to update
394408 // this->UpdateLatticePar(); we should be able to do this...
395409
396410 VFN_DEBUG_MESSAGE (" UnitCell::InitMatrices() for crystal : " +this ->GetName (),5 )
0 commit comments