[mcstas-users] problem of saving file with McStas 3.2

曾智蓉 zengzr at ihep.ac.cn
Fri May 12 11:17:16 CEST 2023


Hi,




I reinstalled the McStas with the version of 3.2. But the instrument file can't be compiled properly. The files was created by saving another old file which was previously run properly.In addition, if I make any change to the old file and save it, the new file was not run properly too. May I ask for some help? Thanks very much!




PS: the information for the error was as following:

"

loading system configuration

INFO: No output directory specified (--dir)

INFO: Using directory: "#beamline82_20230512_165013"

INFO: Regenerating c-file: #beamline82.c




-----------------------------------------------------------




Generating single GPU kernel or single CPU section layout:




-----------------------------------------------------------




Generating GPU/CPU -DFUNNEL layout:




-----------------------------------------------------------

Info: 'Al_window' is a contributed component.

Warning: DECLARE block contains 101 assignments (= sign).

Move them into an INITIALIZE section. May fail at compile.

CFLAGS=

INFO: Recompiling: #beamline82.exe

#beamline82.c: In function 'mcuse_dir':

#beamline82.c:3629:8: warning: implicit declaration of function 'mkdir' [-Wimplicit-function-declaration]

if(mkdir(dirname, 0777)) {

^

#beamline82.c: In function 'sighandler':

#beamline82.c:5535:64: warning: implicit declaration of function 'getpid' [-Wimplicit-function-declaration]

printf("\n# " MCCODE_STRING ": [pid %i] Signal %i detected", getpid(), sig);

^

#beamline82.c: At top level:

#beamline82.c:8215:3: error: expected specifier-qualifier-list before 'return'

return vecy[idx];

^

#beamline82.c: In function 'class_SNS_source2_init':

#beamline82.c:12169:20: error: expected ')' before '->' token

#define fp (_comp->_parameters.fp)

^

#beamline82.c:12185:9: note: in expansion of macro 'fp'

FILE *fp;

^

#beamline82.c:12190:3: error: 'Pvec' undeclared (first use in this function)

Pvec=malloc(500*sizeof(double));

^

#beamline82.c:12190:3: note: each undeclared identifier is reported only once for each function it appears in

#beamline82.c:12191:3: error: 'inxvec' undeclared (first use in this function)

inxvec=malloc(500*sizeof(double));

^

#beamline82.c:12192:3: error: 'inyvec' undeclared (first use in this function)

inyvec=malloc(500*sizeof(double));

^

#beamline82.c:12193:3: error: 'tcol' undeclared (first use in this function)

tcol=malloc(200*sizeof(double));

^

#beamline82.c:12194:3: error: 'Ecol' undeclared (first use in this function)

Ecol=malloc(200*sizeof(double));

^

#beamline82.c:12195:3: error: 'tyval' undeclared (first use in this function)

tyval=malloc(500*sizeof(double));

^

#beamline82.c:12196:3: error: 'txval' undeclared (first use in this function)

txval=malloc(500*sizeof(double));

^

#beamline82.c:12209:45: error: 'filename' undeclared (first use in this function)

printf("%s%s\n","Loading moderator file ",filename);

^

#beamline82.c:12210:4: warning: implicit declaration of function 'SNS_source2_load' [-Wimplicit-function-declaration]

SNS_source2_load(filename,inxvec,inyvec,0,2,&xylength,tcol,Ecol,Imat,&ntvals,&nEvals);

^

#beamline82.c:12210:74: error: 'ntvals' undeclared (first use in this function)

SNS_source2_load(filename,inxvec,inyvec,0,2,&xylength,tcol,Ecol,Imat,&ntvals,&nEvals);

^

#beamline82.c:12210:82: error: 'nEvals' undeclared (first use in this function)

SNS_source2_load(filename,inxvec,inyvec,0,2,&xylength,tcol,Ecol,Imat,&ntvals,&nEvals);

^

#beamline82.c:12216:2: error: 'INorm2' undeclared (first use in this function)

INorm2=integ1(xonly,Emin/1000.0,Emax/1000.0,0.001);

^

#beamline82.c:12216:9: warning: implicit declaration of function 'integ1' [-Wimplicit-function-declaration]

INorm2=integ1(xonly,Emin/1000.0,Emax/1000.0,0.001);

^

#beamline82.c:12216:16: error: 'xonly' undeclared (first use in this function)

INorm2=integ1(xonly,Emin/1000.0,Emax/1000.0,0.001);

^

#beamline82.c:12217:3: warning: implicit declaration of function 'Pcalc' [-Wimplicit-function-declaration]

Pcalc(xonly,llim,hlim,inxvec,Pvec,xylength,&idxstart,&idxstop);

^

#beamline82.c:12217:47: error: 'idxstart' undeclared (first use in this function)

Pcalc(xonly,llim,hlim,inxvec,Pvec,xylength,&idxstart,&idxstop);

^

#beamline82.c:12217:57: error: 'idxstop' undeclared (first use in this function)

Pcalc(xonly,llim,hlim,inxvec,Pvec,xylength,&idxstart,&idxstop);

^

#beamline82.c:12228:7: warning: implicit declaration of function 'tPcalc' [-Wimplicit-function-declaration]

tPcalc(txonly,ltlim,htlim,tcol,tPvec,ntvals,&tidxstart,&tidxstop);

^

#beamline82.c:12228:14: error: 'txonly' undeclared (first use in this function)

tPcalc(txonly,ltlim,htlim,tcol,tPvec,ntvals,&tidxstart,&tidxstop);

^

#beamline82.c:12228:52: error: 'tidxstart' undeclared (first use in this function)

tPcalc(txonly,ltlim,htlim,tcol,tPvec,ntvals,&tidxstart,&tidxstop);

^

#beamline82.c:12228:63: error: 'tidxstop' undeclared (first use in this function)

tPcalc(txonly,ltlim,htlim,tcol,tPvec,ntvals,&tidxstart,&tidxstop);

^

#beamline82.c:12235:4: error: 'EPmax' undeclared (first use in this function)

EPmax=quadfuncint(Emax/1000.0,xylength,inxvec,Pvec);

^

#beamline82.c:12235:10: warning: implicit declaration of function 'quadfuncint' [-Wimplicit-function-declaration]

EPmax=quadfuncint(Emax/1000.0,xylength,inxvec,Pvec);

^

#beamline82.c:12236:4: error: 'EPmin' undeclared (first use in this function)

EPmin=quadfuncint(Emin/1000.0,xylength,inxvec,Pvec);

^

#beamline82.c: In function 'class_SNS_source2_trace':

#beamline82.c:13067:3: error: 'hdiv' undeclared (first use in this function)

hdiv=theta;

^

#beamline82.c:13068:3: error: 'vdiv' undeclared (first use in this function)

vdiv=phi;

^

#beamline82.c:13072:11: error: 'EPmin' undeclared (first use in this function)

randp=EPmin+rand01()*(EPmax-EPmin);

^

#beamline82.c:13072:27: error: 'EPmax' undeclared (first use in this function)

randp=EPmin+rand01()*(EPmax-EPmin);

^

#beamline82.c:13074:10: warning: implicit declaration of function 'zero_find' [-Wimplicit-function-declaration]

Eval=zero_find(Pfunc,randp,inxvec[idxstart],inxvec[idxstop],1e-5);

^

#beamline82.c:13074:20: error: 'Pfunc' undeclared (first use in this function)

Eval=zero_find(Pfunc,randp,inxvec[idxstart],inxvec[idxstop],1e-5);

^

#beamline82.c:13074:32: error: 'inxvec' undeclared (first use in this function)

Eval=zero_find(Pfunc,randp,inxvec[idxstart],inxvec[idxstop],1e-5);

^

#beamline82.c:13074:39: error: 'idxstart' undeclared (first use in this function)

Eval=zero_find(Pfunc,randp,inxvec[idxstart],inxvec[idxstop],1e-5);

^

#beamline82.c:13074:56: error: 'idxstop' undeclared (first use in this function)

Eval=zero_find(Pfunc,randp,inxvec[idxstart],inxvec[idxstop],1e-5);

^

#beamline82.c:13078:16: error: 'nEvals' undeclared (first use in this function)

while((idx1<nEvals)&&(Ecol[idx1]<Eval)){

^

#beamline82.c:13078:26: error: 'Ecol' undeclared (first use in this function)

while((idx1<nEvals)&&(Ecol[idx1]<Eval)){

^

#beamline82.c:13084:21: error: 'ntvals' undeclared (first use in this function)

for (idx3=0;idx3<ntvals;idx3++){

^

#beamline82.c:13085:6: error: 'tyval' undeclared (first use in this function)

tyval[idx3]=linint(Eval,Ecol[Eidxl],Ecol[Eidxh],Ptmat[idx3][Eidxl],Ptmat[idx3][Eidxh]);

^

#beamline82.c:13085:18: warning: implicit declaration of function 'linint' [-Wimplicit-function-declaration]

tyval[idx3]=linint(Eval,Ecol[Eidxl],Ecol[Eidxh],Ptmat[idx3][Eidxl],Ptmat[idx3][Eidxh]);

^

#beamline82.c:13086:6: error: 'txval' undeclared (first use in this function)

txval[idx3]=tcol[idx3];

^

#beamline82.c:13086:18: error: 'tcol' undeclared (first use in this function)

txval[idx3]=tcol[idx3];

^

#beamline82.c:13088:16: error: 'tidxstart' undeclared (first use in this function)

randp=tyval[tidxstart]+rand01()*(tyval[tidxstop-1]-tyval[tidxstart]);

^

#beamline82.c:13088:43: error: 'tidxstop' undeclared (first use in this function)

randp=tyval[tidxstart]+rand01()*(tyval[tidxstop-1]-tyval[tidxstart]);

^

#beamline82.c:13090:22: error: 'tPfunc' undeclared (first use in this function)

tval=zero_find(tPfunc,randp,txval[tidxstart],txval[tidxstop-1],1e-5);}

^

#beamline82.c:13101:33: error: 'INorm2' undeclared (first use in this function)

p*=(xwidth*yheight/(0.1*0.1))*INorm2/mcget_ncount();

^

#beamline82.c: In function 'class_SNS_source2_finally':

#beamline82.c:16207:8: error: 'txval' undeclared (first use in this function)

free(txval);free(tyval);free(tPvec);

^

#beamline82.c:16207:20: error: 'tyval' undeclared (first use in this function)

free(txval);free(tyval);free(tPvec);

^

#beamline82.c:16208:8: error: 'inxvec' undeclared (first use in this function)

free(inxvec);free(inyvec);free(Pvec);free(tcol);free(Ecol);

^

#beamline82.c:16208:21: error: 'inyvec' undeclared (first use in this function)

free(inxvec);free(inyvec);free(Pvec);free(tcol);free(Ecol);

^

#beamline82.c:16208:34: error: 'Pvec' undeclared (first use in this function)

free(inxvec);free(inyvec);free(Pvec);free(tcol);free(Ecol);

^

#beamline82.c:16208:45: error: 'tcol' undeclared (first use in this function)

free(inxvec);free(inyvec);free(Pvec);free(tcol);free(Ecol);

^

#beamline82.c:16208:56: error: 'Ecol' undeclared (first use in this function)

free(inxvec);free(inyvec);free(Pvec);free(tcol);free(Ecol);

^

#beamline82.c: In function 'class_SNS_source2_display':

#beamline82.c:16567:0: warning: "line" redefined

#define line (_comp->_parameters.line)

^

#beamline82.c:16517:0: note: this is the location of the previous definition

#define line mcdis_line

^

#beamline82.c: In function 'class_Arm_display':

#beamline82.c:16618:3: warning: implicit declaration of function 'line' [-Wimplicit-function-declaration]

line(0,0,0,0.2,0,0);

^

start mcrun #beamline82.instr -d C:\mcstas-3.2\source_test\#beamline82_20230512_165017 -n 1000000

Instrument opened: #beamline8.instr

loading system configuration

INFO: No output directory specified (--dir)

INFO: Using directory: "#beamline8_20230512_170946"

INFO: Using existing c-file: #beamline8.c

INFO: Using existing binary: #beamline8.exe

INFO: ===

begin instrument: CSNS_img

Creator: McStas 2.7.1 - Oct. 04, 2021

Source: #beamline8.instr

Parameters: Lmin(double) Lmax(double) source_size(double) dist(double) moderator(string)

Trace_enabled: yes

Default_main: yes

Embedded_runtime: yes

end instrument

begin simulation: .

Format: McCode with text headers

URL: http://www.mccode.org

Creator: McStas 2.7.1 - Oct. 04, 2021

Instrument: #beamline8.instr

Ncount: 1000000

Trace: no

Gravitation: no

Seed: 1683886311

Directory: .

Param: Lmin=0.005

Param: Lmax=40

Param: source_size=0.1

Param: dist=2.32

Param: moderator=MCSTAS-DPHM-BL8.dat

end simulation

start mcrun #beamline8.instr -d C:\mcstas-3.2\source_test\#beamline8_20230512_170948 -n 1000000 Lmin=0.005 Lmax=40 source_size=0.1 dist=2.32 moderator=MCSTAS-DPHM-BL8.dat

loading system configuration

INFO: No output directory specified (--dir)

INFO: Using directory: "#beamline8_20230512_171041"

INFO: Regenerating c-file: #beamline8.c




-----------------------------------------------------------




Generating single GPU kernel or single CPU section layout:




-----------------------------------------------------------




Generating GPU/CPU -DFUNNEL layout:




-----------------------------------------------------------

Info: 'Al_window' is a contributed component.

Warning: DECLARE block contains 101 assignments (= sign).

Move them into an INITIALIZE section. May fail at compile.

CFLAGS=

INFO: Recompiling: #beamline8.exe

#beamline8.c: In function 'mcuse_dir':

#beamline8.c:3629:8: warning: implicit declaration of function 'mkdir' [-Wimplicit-function-declaration]

if(mkdir(dirname, 0777)) {

^

#beamline8.c: In function 'sighandler':

#beamline8.c:5535:64: warning: implicit declaration of function 'getpid' [-Wimplicit-function-declaration]

printf("\n# " MCCODE_STRING ": [pid %i] Signal %i detected", getpid(), sig);

^

#beamline8.c: At top level:

#beamline8.c:7992:3: error: expected specifier-qualifier-list before 'return'

return vecy[idx];

^

#beamline8.c: In function 'class_SNS_source2_init':

#beamline8.c:8582:20: error: expected ')' before '->' token

#define fp (_comp->_parameters.fp)

^

#beamline8.c:8598:9: note: in expansion of macro 'fp'

FILE *fp;

^

#beamline8.c:8603:3: error: 'Pvec' undeclared (first use in this function)

Pvec=malloc(500*sizeof(double));

^

#beamline8.c:8603:3: note: each undeclared identifier is reported only once for each function it appears in

#beamline8.c:8604:3: error: 'inxvec' undeclared (first use in this function)

inxvec=malloc(500*sizeof(double));

^

#beamline8.c:8605:3: error: 'inyvec' undeclared (first use in this function)

inyvec=malloc(500*sizeof(double));

^

#beamline8.c:8606:3: error: 'tcol' undeclared (first use in this function)

tcol=malloc(200*sizeof(double));

^

#beamline8.c:8607:3: error: 'Ecol' undeclared (first use in this function)

Ecol=malloc(200*sizeof(double));

^

#beamline8.c:8608:3: error: 'tyval' undeclared (first use in this function)

tyval=malloc(500*sizeof(double));

^

#beamline8.c:8609:3: error: 'txval' undeclared (first use in this function)

txval=malloc(500*sizeof(double));

^

#beamline8.c:8622:45: error: 'filename' undeclared (first use in this function)

printf("%s%s\n","Loading moderator file ",filename);

^

#beamline8.c:8623:4: warning: implicit declaration of function 'SNS_source2_load' [-Wimplicit-function-declaration]

SNS_source2_load(filename,inxvec,inyvec,0,2,&xylength,tcol,Ecol,Imat,&ntvals,&nEvals);

^

#beamline8.c:8623:74: error: 'ntvals' undeclared (first use in this function)

SNS_source2_load(filename,inxvec,inyvec,0,2,&xylength,tcol,Ecol,Imat,&ntvals,&nEvals);

^

#beamline8.c:8623:82: error: 'nEvals' undeclared (first use in this function)

SNS_source2_load(filename,inxvec,inyvec,0,2,&xylength,tcol,Ecol,Imat,&ntvals,&nEvals);

^

#beamline8.c:8629:2: error: 'INorm2' undeclared (first use in this function)

INorm2=integ1(xonly,Emin/1000.0,Emax/1000.0,0.001);

^

#beamline8.c:8629:9: warning: implicit declaration of function 'integ1' [-Wimplicit-function-declaration]

INorm2=integ1(xonly,Emin/1000.0,Emax/1000.0,0.001);

^

#beamline8.c:8629:16: error: 'xonly' undeclared (first use in this function)

INorm2=integ1(xonly,Emin/1000.0,Emax/1000.0,0.001);

^

#beamline8.c:8630:3: warning: implicit declaration of function 'Pcalc' [-Wimplicit-function-declaration]

Pcalc(xonly,llim,hlim,inxvec,Pvec,xylength,&idxstart,&idxstop);

^

#beamline8.c:8630:47: error: 'idxstart' undeclared (first use in this function)

Pcalc(xonly,llim,hlim,inxvec,Pvec,xylength,&idxstart,&idxstop);

^

#beamline8.c:8630:57: error: 'idxstop' undeclared (first use in this function)

Pcalc(xonly,llim,hlim,inxvec,Pvec,xylength,&idxstart,&idxstop);

^

#beamline8.c:8641:7: warning: implicit declaration of function 'tPcalc' [-Wimplicit-function-declaration]

tPcalc(txonly,ltlim,htlim,tcol,tPvec,ntvals,&tidxstart,&tidxstop);

^

#beamline8.c:8641:14: error: 'txonly' undeclared (first use in this function)

tPcalc(txonly,ltlim,htlim,tcol,tPvec,ntvals,&tidxstart,&tidxstop);

^

#beamline8.c:8641:52: error: 'tidxstart' undeclared (first use in this function)

tPcalc(txonly,ltlim,htlim,tcol,tPvec,ntvals,&tidxstart,&tidxstop);

^

#beamline8.c:8641:63: error: 'tidxstop' undeclared (first use in this function)

tPcalc(txonly,ltlim,htlim,tcol,tPvec,ntvals,&tidxstart,&tidxstop);

^

#beamline8.c:8648:4: error: 'EPmax' undeclared (first use in this function)

EPmax=quadfuncint(Emax/1000.0,xylength,inxvec,Pvec);

^

#beamline8.c:8648:10: warning: implicit declaration of function 'quadfuncint' [-Wimplicit-function-declaration]

EPmax=quadfuncint(Emax/1000.0,xylength,inxvec,Pvec);

^

#beamline8.c:8649:4: error: 'EPmin' undeclared (first use in this function)

EPmin=quadfuncint(Emin/1000.0,xylength,inxvec,Pvec);

^

#beamline8.c: In function 'class_SNS_source2_trace':

#beamline8.c:9041:3: error: 'hdiv' undeclared (first use in this function)

hdiv=theta;

^

#beamline8.c:9042:3: error: 'vdiv' undeclared (first use in this function)

vdiv=phi;

^

#beamline8.c:9046:11: error: 'EPmin' undeclared (first use in this function)

randp=EPmin+rand01()*(EPmax-EPmin);

^

#beamline8.c:9046:27: error: 'EPmax' undeclared (first use in this function)

randp=EPmin+rand01()*(EPmax-EPmin);

^

#beamline8.c:9048:10: warning: implicit declaration of function 'zero_find' [-Wimplicit-function-declaration]

Eval=zero_find(Pfunc,randp,inxvec[idxstart],inxvec[idxstop],1e-5);

^

#beamline8.c:9048:20: error: 'Pfunc' undeclared (first use in this function)

Eval=zero_find(Pfunc,randp,inxvec[idxstart],inxvec[idxstop],1e-5);

^

#beamline8.c:9048:32: error: 'inxvec' undeclared (first use in this function)

Eval=zero_find(Pfunc,randp,inxvec[idxstart],inxvec[idxstop],1e-5);

^

#beamline8.c:9048:39: error: 'idxstart' undeclared (first use in this function)

Eval=zero_find(Pfunc,randp,inxvec[idxstart],inxvec[idxstop],1e-5);

^

#beamline8.c:9048:56: error: 'idxstop' undeclared (first use in this function)

Eval=zero_find(Pfunc,randp,inxvec[idxstart],inxvec[idxstop],1e-5);

^

#beamline8.c:9052:16: error: 'nEvals' undeclared (first use in this function)

while((idx1<nEvals)&&(Ecol[idx1]<Eval)){

^

#beamline8.c:9052:26: error: 'Ecol' undeclared (first use in this function)

while((idx1<nEvals)&&(Ecol[idx1]<Eval)){

^

#beamline8.c:9058:21: error: 'ntvals' undeclared (first use in this function)

for (idx3=0;idx3<ntvals;idx3++){

^

#beamline8.c:9059:6: error: 'tyval' undeclared (first use in this function)

tyval[idx3]=linint(Eval,Ecol[Eidxl],Ecol[Eidxh],Ptmat[idx3][Eidxl],Ptmat[idx3][Eidxh]);

^

#beamline8.c:9059:18: warning: implicit declaration of function 'linint' [-Wimplicit-function-declaration]

tyval[idx3]=linint(Eval,Ecol[Eidxl],Ecol[Eidxh],Ptmat[idx3][Eidxl],Ptmat[idx3][Eidxh]);

^

#beamline8.c:9060:6: error: 'txval' undeclared (first use in this function)

txval[idx3]=tcol[idx3];

^

#beamline8.c:9060:18: error: 'tcol' undeclared (first use in this function)

txval[idx3]=tcol[idx3];

^

#beamline8.c:9062:16: error: 'tidxstart' undeclared (first use in this function)

randp=tyval[tidxstart]+rand01()*(tyval[tidxstop-1]-tyval[tidxstart]);

^

#beamline8.c:9062:43: error: 'tidxstop' undeclared (first use in this function)

randp=tyval[tidxstart]+rand01()*(tyval[tidxstop-1]-tyval[tidxstart]);

^

#beamline8.c:9064:22: error: 'tPfunc' undeclared (first use in this function)

tval=zero_find(tPfunc,randp,txval[tidxstart],txval[tidxstop-1],1e-5);}

^

#beamline8.c:9075:33: error: 'INorm2' undeclared (first use in this function)

p*=(xwidth*yheight/(0.1*0.1))*INorm2/mcget_ncount();

^

#beamline8.c: In function 'class_SNS_source2_finally':

#beamline8.c:10043:8: error: 'txval' undeclared (first use in this function)

free(txval);free(tyval);free(tPvec);

^

#beamline8.c:10043:20: error: 'tyval' undeclared (first use in this function)

free(txval);free(tyval);free(tPvec);

^

#beamline8.c:10044:8: error: 'inxvec' undeclared (first use in this function)

free(inxvec);free(inyvec);free(Pvec);free(tcol);free(Ecol);

^

#beamline8.c:10044:21: error: 'inyvec' undeclared (first use in this function)

free(inxvec);free(inyvec);free(Pvec);free(tcol);free(Ecol);

^

#beamline8.c:10044:34: error: 'Pvec' undeclared (first use in this function)

free(inxvec);free(inyvec);free(Pvec);free(tcol);free(Ecol);

^

#beamline8.c:10044:45: error: 'tcol' undeclared (first use in this function)

free(inxvec);free(inyvec);free(Pvec);free(tcol);free(Ecol);

^

#beamline8.c:10044:56: error: 'Ecol' undeclared (first use in this function)

free(inxvec);free(inyvec);free(Pvec);free(tcol);free(Ecol);

^

#beamline8.c: In function 'class_SNS_source2_display':

#beamline8.c:10206:0: warning: "line" redefined

#define line (_comp->_parameters.line)

^

#beamline8.c:10156:0: note: this is the location of the previous definition

#define line mcdis_line

^

#beamline8.c: In function 'class_Arm_display':

#beamline8.c:10257:3: warning: implicit declaration of function 'line' [-Wimplicit-function-declaration]

line(0,0,0,0.2,0,0);

^

start mcrun #beamline8.instr -d C:\mcstas-3.2\source_test\#beamline8_20230512_171044 -n 1000000

"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20230512/7392e4df/attachment-0001.html>


More information about the mcstas-users mailing list