@@ -96,7 +96,11 @@ double _getc(UnitCell& u)
9696
9797void _setalpha (UnitCell& u, double val)
9898{
99- u.GetPar (" alpha" ).SetValue (val);
99+ if ((val<=0 )||(val>=M_PI)) throw ObjCrystException (" alpha must be within ]0;pi[" );
100+ RefinablePar &p = u.GetPar (" alpha" );
101+ if (p.IsUsed ()) p.SetValue (val);
102+ // Throwing an exception here would be risky - a warning would be more adequate
103+ // else throw ObjCrystException("alpha is fixed and cannot be changed");
100104}
101105
102106double _getalpha (UnitCell& u)
@@ -106,7 +110,11 @@ double _getalpha(UnitCell& u)
106110
107111void _setbeta (UnitCell& u, double val)
108112{
109- u.GetPar (" beta" ).SetValue (val);
113+ if ((val<=0 )||(val>=M_PI)) throw ObjCrystException (" beta must be within ]0;pi[" );
114+ RefinablePar &p = u.GetPar (" beta" );
115+ if (p.IsUsed ()) p.SetValue (val);
116+ // Throwing an exception here would be risky - a warning would be more adequate
117+ // else throw ObjCrystException("beta is fixed and cannot be changed");
110118}
111119
112120double _getbeta (UnitCell& u)
@@ -116,7 +124,11 @@ double _getbeta(UnitCell& u)
116124
117125void _setgamma (UnitCell& u, double val)
118126{
119- u.GetPar (" gamma" ).SetValue (val);
127+ if ((val<=0 )||(val>=M_PI)) throw ObjCrystException (" gamma must be within ]0;pi[" );
128+ RefinablePar &p = u.GetPar (" gamma" );
129+ if (p.IsUsed ()) p.SetValue (val);
130+ // Throwing an exception here would be risky - a warning would be more adequate
131+ // else throw ObjCrystException("gamma is fixed and cannot be changed");
120132}
121133
122134double _getgamma (UnitCell& u)
0 commit comments