Error 54

Asked by Sayan Kr. Das

Hello!
I implemented a user-defined function in Calchep that ran successfully in the graphical interface. But when I am running a batch file, this error is showing up.

Error in calculation of cross section for ne,ne->A,ne,ne
Please have a look at cs.o and cs.out in Processes/m1/Feynman/p1/single.
CH Error 54
Killing all jobs and quitting.

In the manual, error 54 is described as 'usrfun was not defined, but is used'.

I do not understand what more I have to do. I have linked the function path in the Libraries section of the model.

The extlib1.mdl file reads:

SM
Libraries
External libraries and function prototypes <|
$WORK/usrfun.c

So I know the function is there.

The cs.o file says that:

 usrfun(char* name) is called with parameter logE(A)
But is not defined!

Any help will be appreciated.

Question information

Language:
English Edit question
Status:
Solved
For:
CalcHEP Edit question
Assignee:
No assignee Edit question
Solved by:
Sayan Kr. Das
Solved:
Last query:
Last reply:
Revision history for this message
Alexander Belyaev (alexander.belyaev) said :
#1

Could you, please
send me (<email address hidden>)

your
usrfunc.c, bacth file and the model ?

Best
Alexander

P.S.
I am glad you have figured out the solution of the previous problems

Revision history for this message
Sayan Kr. Das (sayankrdas2) said :
#2

Thank you for your response. I am sending the files.

Revision history for this message
Alexander Belyaev (alexander.belyaev) said :
#3

Everything is correct,
but you need to make sure that the location of usrfun.c
is correct

Looks like you are not picking usrfun.c from the right place

copy it to your work directory and change

$CALCHEP/usrfun.c --> $WORK/usrfun.c

in extlib1.mdl

or use absolute path to it in this file

Revision history for this message
Sayan Kr. Das (sayankrdas2) said :
#4

Initially I had done exactly that. I have tried it from $WORK. I have written the absolute path. But nothing works in the batch file itself. The function runs smoothly in the interactive session. That is the confusing part.

Revision history for this message
Sayan Kr. Das (sayankrdas2) said :
#5

One thing I have done is creating copies of the userfun.c and placing them in multiple locations and then changing extlib1.mdl accordingly. It still could not find the files.

Then I referenced them in extlib1.mdl simultaneously. As in

$CALCHEP/usrfun.c
$WORK/usrfun.c

Then the error message is:
multiple definition of 'usrfun'; path/to/file:53: first defined here
Compilation of VandP.so failed.

So the program can find the file locations and intentify them. But somehow cannot use them

Revision history for this message
Sayan Kr. Das (sayankrdas2) said :
#6

I deleted my work directory and created another one. I works fine now. Thank you for your time.

Revision history for this message
Alexander Belyaev (alexander.belyaev) said :
#7

Sorry,
I should have previewd this.
Instead of deleting work directory, you should have deleted "Processes"
directory with compiled processes.
Alternatively and more correctly, you should
have changed

Model:         SM
Model changed: False
Gauge:         Feynman

to

Model:         SM
Model changed: True
Gauge:         Feynman

i.e. Model changed: False --> Model changed: True

then calchep batch will remove precompiled  librraries in Processes folder
so, yo do not need to remove the whole work folder.
Sorry , I have forgotten this. Now you know this for the next time

Best
Alexander

On 18/02/2024 07:15, Sayan Kr. Das wrote:
> [You don't often get email from <email address hidden>. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> CAUTION: This e-mail originated outside the University of Southampton.
>
> Question #709296 on CalcHEP changed:
> https://answers.launchpad.net/calchep/+question/709296
>
> Status: Open => Solved
>
> Sayan Kr. Das confirmed that the question is solved:
> I deleted my work directory and created another one. I works fine now.
> Thank you for your time.
>
> --
> You received this question notification because your team CalcHEP is an
> answer contact for CalcHEP.

--
................................
Professor Alexander S Belyaev
https://www.soton.ac.uk/~ab1u06
.......
Physics & Astronomy 46/5047
University of Southampton
Southampton SO171BJ
................................

Revision history for this message
Alexander Belyaev (alexander.belyaev) said :
#8

P.S.

logE(A) or any photon distribution for e E -> A, Aprocess
does not no make much sense, since because of the energy conservation
E(A) == sqrts/2

It is more interesting  to look at logPT(A)
or at logE(A)for e,A -> e,A compton scattering

On 18/02/2024 09:53, Alexander Belyaev wrote:
> Sorry,
> I should have previewd this.
> Instead of deleting work directory, you should have deleted
> "Processes" directory with compiled processes.
> Alternatively and more correctly, you should
> have changed
>
> Model:         SM
> Model changed: False
> Gauge:         Feynman
>
> to
>
> Model:         SM
> Model changed: True
> Gauge:         Feynman
>
> i.e. Model changed: False --> Model changed: True
>
> then calchep batch will remove precompiled  librraries in Processes
> folder
> so, yo do not need to remove the whole work folder.
> Sorry , I have forgotten this. Now you know this for the next time
>
> Best
> Alexander
>
>
> On 18/02/2024 07:15, Sayan Kr. Das wrote:
>> [You don't often get email from <email address hidden>.
>> Learn why this is important at
>> https://aka.ms/LearnAboutSenderIdentification ]
>>
>> CAUTION: This e-mail originated outside the University of Southampton.
>>
>> Question #709296 on CalcHEP changed:
>> https://answers.launchpad.net/calchep/+question/709296
>>
>>
>>      Status: Open => Solved
>>
>> Sayan Kr. Das confirmed that the question is solved:
>> I deleted my work directory and created another one. I works fine now.
>> Thank you for your time.
>>
>> --
>> You received this question notification because your team CalcHEP is an
>> answer contact for CalcHEP.
>

--
................................
Professor Alexander S Belyaev
https://www.soton.ac.uk/~ab1u06
.......
Physics & Astronomy 46/5047
University of Southampton
Southampton SO171BJ
................................

Revision history for this message
Alexander Belyaev (alexander.belyaev) said :
#9

P.P.S. Final remark.

For the batch regime the best way to use usrfunc.c or other .c files to be linked
is to put those files into the "models" folder,
since the batch will use this folder and copy it into the different subfolders in "Processes" folder
during the batch run and scan.
If you copy usrfunc.c file into the work folder $WORK/ and not into the $WORK/ models/
then there be an earror since error since folders work will be created under the Processes folder,
but files from $WORK/ like usrfun.c etc will be not copied to Processes folder
and will not be found.

But if you copy usrfunc.c into the $WORK/ models then it will propagate into the "Processes" folder
So the right way to do things is:

1. copy usrfun.c into $WORK/models folder (you can call it differently as you wish)
2. edit extlibxxx.mdl file with your editor or through the calchep menu and add the line
$WORK/models/usrfun.c
there
3. If you modify the model, i.e. modify usrfun.c file, then in your batch you change
Model changed: False --> Model changed: True

This is it.
We will add these instruction to the new version of manual.

Best
Alexander

Revision history for this message
Sayan Kr. Das (sayankrdas2) said (last edit ):
#10

Thanks you for your detailed insights.

I do not know how to reply to the individual messages in launchpad so I shall answer them collectively here.

When my code was not working I had frantically tried many things. I had also changed the 'model changed' parameter from True to False many times. But it did not work. I suppose there were indeed some problems with my work directory. One evidence of this was that the model directory contained only two models: SM and SM(+hgg). When I recreated the directory suddenly I had five models!

The process I was investigating was the Bremsstrahlung from neutrino scattering, i.e. the process ne, ne -> ne, ne, A
So there is a distribution of the photon energy.

Lastly, I would like to mention a tiny bug. The files calchep and calchep_batch are supposed to create the paths $CALCHEP and $WORK when they are run. But my calchep does not create $WORK path. Thus the interactive session does not recognise the path $WORK/models/usrfun.c. It is easily fixable if you just add

WORK=`pwd`
export WORK

inside the file. But it sure caused a mild headache till I figured it out. The file calchep_batch works fine though.