Cleaned up ANSTO code to merge with sinqdev.sics

This is our new RELEASE-4_0 branch which was taken from ansto/93d9a7c
Conflicts:
	.gitignore
	SICSmain.c
	asynnet.c
	confvirtualmot.c
	counter.c
	devexec.c
	drive.c
	event.h
	exebuf.c
	exeman.c
	histmem.c
	interface.h
	motor.c
	motorlist.c
	motorsec.c
	multicounter.c
	napi.c
	napi.h
	napi4.c
	network.c
	nwatch.c
	nxscript.c
	nxxml.c
	nxxml.h
	ofac.c
	reflist.c
	scan.c
	sicshipadaba.c
	sicsobj.c
	site_ansto/docs/Copyright.txt
	site_ansto/instrument/lyrebird/config/tasmad/sicscommon/nxsupport.tcl
	site_ansto/instrument/lyrebird/config/tasmad/taspub_sics/tasscript.tcl
	statusfile.c
	tasdrive.c
	tasub.c
	tasub.h
	tasublib.c
	tasublib.h
This commit is contained in:
Ferdi Franceschini
2015-04-23 20:49:26 +10:00
parent c650788a2c
commit 10d29d597c
1336 changed files with 9430 additions and 226646 deletions

49
hkl.c
View File

@@ -26,6 +26,10 @@
Heavily reworked to fit into the new four circle setup
Mark Koennecke, July 2008
Added calculation of angles between reflection
Mark Koennecke, March 2013
-----------------------------------------------------------------------------*/
#include <math.h>
#include <ctype.h>
@@ -687,6 +691,47 @@ static int HKLCalculateTheta(pHKL self, float fHKL[3], double *stt)
*stt = 2. * theta;
return status;
}
/*-------------------------------------------------------------------------*/
static int HKLAngle(SConnection *pCon, int argc, char *argv[])
{
reflection r1, r2;
lattice direct;
const double *cell;
MATRIX B;
double ang;
if(argc < 8){
SCWrite(pCon,"ERROR: insufficient no of arguments to hkl angle",eError);
return 0;
}
r1.h = atof(argv[2]);
r1.k = atof(argv[3]);
r1.l = atof(argv[4]);
r2.h = atof(argv[5]);
r2.k = atof(argv[6]);
r2.l = atof(argv[7]);
cell = SXGetCell();
direct.a = cell[0];
direct.b = cell[1];
direct.c = cell[2];
direct.alpha = cell[3];
direct.beta = cell[4];
direct.gamma = cell[5];
B = mat_creat(3,3,ZERO_MATRIX);
if(B == NULL){
SCWrite(pCon,"ERROR: out of memory in HKL angle",eError);
return 0;
}
calculateBMatrix(direct,B);
ang = angleBetweenReflections(B,r1,r2);
SCPrintf(pCon,eValue,"angle = %f", ang);
mat_free(B);
return 1;
}
/*--------------------------------------------------------------------------*/
static int HandleBiToNB(SConnection *pCon, int argc, char *argv[])
{
@@ -993,6 +1038,10 @@ int HKLAction(SConnection * pCon, SicsInterp * pSics, void *pData,
SCPrintf(pCon, eValue, "two-theta = %lf", stt);
return 1;
}
/*--------------- calculate angle */
else if (strcmp(argv[1], "angle") == 0) {
return HKLAngle(pCon,argc,argv);
}
/*------------------ run */
else if (strcmp(argv[1], "run") == 0) {
if (!SCMatchRights(pCon, usUser)) {