[Wien] Exit code "0" for LAPW1 with an error
Peter Blaha
pblaha at theochem.tuwien.ac.at
Tue Sep 8 22:01:28 CEST 2020
Exactly.
In run_lapw we define an alias (tcsh syntax, in bash it is slightly
different) like:
alias testerror 'if (! -z \!:1.error) goto error'
and with
x lapw1
testerror lapw1
you can catch a problem.
Instead of "goto error" you could also do something else.
PS: Most of our shell scripts exit with an error code when a real error
came up. This can be catched with echo $status
Am 08.09.2020 um 20:38 schrieb Yundi Quan:
> The simplest way that I can think of is to check whether the lawp1.error
> file is empty or not after executing x lapw1. If it is empty after
> executing 'x lapw1', then lapw1 terminates without any errors. If it is
> not, then lapw1 terminates with error(s).
>
> On Tue, Sep 8, 2020 at 2:23 PM Rubel, Oleg <rubelo at mcmaster.ca
> <mailto:rubelo at mcmaster.ca>> wrote:
>
> Dear WIEN2k community,
>
> suppose we have a code that includes a sequence of commands. Before
> running the next command, I would like to check if the previous one
> completed successfully. It is convenient to use exit codes for that
> purpose. Here is a small example in bash (looking for a file that
> does not exist):
>
> [rubel at gra-login3 lambda1]$ ls oleg
> ls: cannot access 'oleg': No such file or directory
> [rubel at gra-login3 lambda1]$ echo $?
> 2
>
> Here "echo $?" returns the exit code of a previous command. If it is
> not "0", there is a problem (like in this case, there is no "oleg"
> file).
>
> Now I try to apply the same strategy to WIEN2k:
>
> [rubel at gra-login3 lambda1]$ x lapw1
> LAPW1 - Error
> 0.001u 0.018s 0:00.06 16.6% 0+0k 23592+16io 67pf+0w
> [rubel at gra-login3 lambda1]$ echo $?
> 0
>
> This is an unexpected result. The exist status is OK in spite of the
> fact that LAPW1 exited with an error. Of course, there are error
> files created for each program + spin up/dn (even process for
> parallel calculations). But it can be quite elaborate to search
> through them, and it depends on whether you run lapw1 or lapw2, etc.
>
> I wonder if there is a _simple_ alternative way for sensing an
> error? Also message is not always "XXXXX - Error". It can be
> different (e.g., segmentation fault).
>
> Thank you in advance
> Oleg
>
> --
> Oleg Rubel (PhD, PEng)
> Department of Materials Science and Engineering
> McMaster University
> JHE 359, 1280 Main Street West, Hamilton, Ontario L8S 4L8, Canada
> Email: rubelo at mcmaster.ca <mailto:rubelo at mcmaster.ca>
> Tel: +1-905-525-9140, ext. 24094
> Web: http://olegrubel.mcmaster
>
>
> _______________________________________________
> Wien mailing list
> Wien at zeus.theochem.tuwien.ac.at <mailto:Wien at zeus.theochem.tuwien.ac.at>
> http://zeus.theochem.tuwien.ac.at/mailman/listinfo/wien
> SEARCH the MAILING-LIST at:
> http://www.mail-archive.com/wien@zeus.theochem.tuwien.ac.at/index.html
>
>
> _______________________________________________
> Wien mailing list
> Wien at zeus.theochem.tuwien.ac.at
> http://zeus.theochem.tuwien.ac.at/mailman/listinfo/wien
> SEARCH the MAILING-LIST at: http://www.mail-archive.com/wien@zeus.theochem.tuwien.ac.at/index.html
>
--
--------------------------------------------------------------------------
Peter BLAHA, Inst.f. Materials Chemistry, TU Vienna, A-1060 Vienna
Phone: +43-1-58801-165300 FAX: +43-1-58801-165982
Email: blaha at theochem.tuwien.ac.at WIEN2k: http://www.wien2k.at
WWW:
http://www.imc.tuwien.ac.at/tc_blaha-------------------------------------------------------------------------
More information about the Wien
mailing list