@@ -96,7 +96,11 @@ double _getc(UnitCell& u)
96
96
97
97
void _setalpha (UnitCell& u, double val)
98
98
{
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");
100
104
}
101
105
102
106
double _getalpha (UnitCell& u)
@@ -106,7 +110,11 @@ double _getalpha(UnitCell& u)
106
110
107
111
void _setbeta (UnitCell& u, double val)
108
112
{
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");
110
118
}
111
119
112
120
double _getbeta (UnitCell& u)
@@ -116,7 +124,11 @@ double _getbeta(UnitCell& u)
116
124
117
125
void _setgamma (UnitCell& u, double val)
118
126
{
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");
120
132
}
121
133
122
134
double _getgamma (UnitCell& u)
0 commit comments