- Added support for accessing the exe file management functions from scripts
- Fixed a bug in hmdata.c - Fixed an issue with tempoerature writing through RemObjects in mesure - Added auxiliary reflections to tasub - Make maximize use soft motor positions
This commit is contained in:
80
tasub.c
80
tasub.c
@ -875,6 +875,80 @@ static void listDiagnostik(ptasUB self, SConnection *pCon){
|
||||
status = LLDnodePtr2Next(self->reflectionList);
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------*/
|
||||
static int addAuxReflection(ptasUB self, SConnection *pCon,
|
||||
SicsInterp *pSics, int argc, char *argv[]){
|
||||
int status;
|
||||
tasReflection r1, r2;
|
||||
float value = -999.99;
|
||||
char pBueffel[256];
|
||||
MATRIX UB = NULL, B = NULL;
|
||||
|
||||
if(argc < 5){
|
||||
SCWrite(pCon,
|
||||
"ERROR: not enough arguments auxiliary reflection, need HKL",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!SCMatchRights(pCon,usUser)){
|
||||
return 0;
|
||||
}
|
||||
|
||||
status = Tcl_GetDouble(InterpGetTcl(pSics),argv[2],&r2.qe.qh);
|
||||
if(status != TCL_OK){
|
||||
snprintf(pBueffel,255,"ERROR: failed to convert %s to number",argv[2]);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
}
|
||||
status = Tcl_GetDouble(InterpGetTcl(pSics),argv[3],&r2.qe.qk);
|
||||
if(status != TCL_OK){
|
||||
snprintf(pBueffel,255,"ERROR: failed to convert %s to number",argv[3]);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
}
|
||||
status = Tcl_GetDouble(InterpGetTcl(pSics),argv[4],&r2.qe.ql);
|
||||
if(status != TCL_OK){
|
||||
snprintf(pBueffel,255,"ERROR: failed to convert %s to number",argv[4]);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
B = mat_creat(3,3,ZERO_MATRIX);
|
||||
if(B == NULL){
|
||||
SCWrite(pCon,"ERROR: out of memory creating B matrix",eError);
|
||||
return 0;
|
||||
}
|
||||
status = calculateBMatrix(self->cell,B);
|
||||
if(status < 0){
|
||||
SCWrite(pCon,"ERROR: bad cell constants, no volume",eError);
|
||||
mat_free(B);
|
||||
return 0;
|
||||
}
|
||||
|
||||
status = findReflection(self->reflectionList, 0,&r1);
|
||||
if(status != 1){
|
||||
r2.qe.kf = self->current.kf;
|
||||
r2.qe.ki = self->current.ki;
|
||||
MotorGetSoftPosition(self->motors[A3],pCon,&value);
|
||||
r2.angles.a3 = value + 180.;
|
||||
r2.angles.sgu = .0;
|
||||
r2.angles.sgl = .0;
|
||||
calcTwoTheta(B,r2.qe,self->machine.ss_sample,&r2.angles.sample_two_theta);
|
||||
r1 = r2;
|
||||
}
|
||||
|
||||
status = makeAuxReflection(B, r1, &r2,self->machine.ss_sample);
|
||||
mat_free(B);
|
||||
if(status < 0){
|
||||
SCWrite(pCon,"ERROR: out of memory in makeAuxUB or scattering angle not closed",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
LLDnodeAppend(self->reflectionList,&r2);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
/*------------------------------------------------------------------*/
|
||||
static int calcAuxUB(ptasUB self, SConnection *pCon, SicsInterp *pSics,
|
||||
int argc, char *argv[]){
|
||||
@ -885,8 +959,8 @@ static int calcAuxUB(ptasUB self, SConnection *pCon, SicsInterp *pSics,
|
||||
|
||||
if(argc < 5){
|
||||
SCWrite(pCon,
|
||||
"ERROR: not enough arguments for UB calculation, need HKJL of second plane vector",
|
||||
eError);
|
||||
"ERROR: not enough arguments for UB calculation, need HKL of second plane vector",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1564,6 +1638,8 @@ int TasUBWrapper(SConnection *pCon,SicsInterp *pSics, void *pData,
|
||||
return calcUB(self,pCon,pSics,argc,argv);
|
||||
} else if(strcmp(argv[1],"makeauxub") == 0){
|
||||
return calcAuxUB(self,pCon,pSics,argc,argv);
|
||||
} else if(strcmp(argv[1],"addauxref") == 0){
|
||||
return addAuxReflection(self,pCon,pSics,argc,argv);
|
||||
} else if(strcmp(argv[1],"makeubfromcell") == 0){
|
||||
return calcUBFromCell(self,pCon);
|
||||
} else if(strcmp(argv[1],"calcang") == 0){
|
||||
|
Reference in New Issue
Block a user