Dimensioning and label generation errors (ESR)

If you think you found a bug this is where you can report it
Post Reply
taylor
Posts: 545
Joined: 15 Oct 2013, 05:37
First name(s): Peter
Middle name(s): Robert
Last name(s): Taylor
Affiliation: Tianjin University
Country: China

Dimensioning and label generation errors (ESR)

Post by taylor » 30 Jul 2019, 07:35

I had posted under "Running Dalton" a question about calculation of hyperfine coupling constants in a large system --- 120 atoms, although I only want the hfc for one atom. The problems I encountered relate to generation of labels to be written to file in her1pro.F, and for searching the AOPROPER file in response (specifically in lagrang.F). The following code is used to generate the property labels

Code: Select all

                     LABINT(ITYP) = 'FC '//NAMDEP(NUCPRE(IATOM)+1)(1:3)
     &                              //CHRNOS(IPTNUC(IATOM,IREP)/10)//
     &                                CHRNOS(MOD(IPTNUC(IATOM,IREP),10))
and inspection of this shows that as the last two character positions are used as a centre index, there will be a problem if IPTNUC(IATOM,IREP) is larger than 99, which will certainly be the case in my calculation. A kludge for this (which I have employed) is to redefine the array
CHARACTER*1 CHRNOS(0:9)
in chrnos.h, which originally contains the single characters '0', '1'...'9', to be
CHARACTER*1 CHRNOS(0:15)
with elements that are now the single character hexadecimal "digits" '0'...'F'. This admits labels up to a decimal value of 255. In principal one could use the whole alphabet, but I think this is neither aesthetic nor desirable. (I note here that a bit of grepping suggests there is at least one place in the code (CC response) where this array, dimensioned (0:9), is hardwired into the code, not included as a header file.)

A similar problem arises with the SD property integral labels, but the kludge above takes care of this, too. Nevertheless, I include the code fragment from her1pro.F for the label generation here because it figures in the problem with lagrang.F

Code: Select all

                     IFIRST = ISCOR1/100
                     ISECND = MOD(ISCOR1,100)/10
                     ITHIRD = MOD(MOD(ISCOR1,100),10)
                     IF (INTTYP .EQ. 11) THEN
                         LABINT(ITYP) = 'SD '//CHRNOS(IFIRST)
     &                                      //CHRNOS(ISECND)
     &                                      //CHRNOS(ITHIRD)//' '
     &                                      //CHRXYZ(-ICOOR2)
Now we turn to the ESR code and specifically the routine SDOPER in lagrang.F. This constructs a label to use in searching AOPROPER, using the code

Code: Select all

                 LABINT(NCOOR) = 'SD '//CHRNOS(ISCOR1/100)
     *                            //CHRNOS(ISCOR1/10)
     *                            //CHRNOS(MOD(ISCOR1,10))
     *                            //' '//CHRXYZ(-ICOOR2)
This is clearly incorrect and is guaranteed to fail for an index larger than 100. I have replaced it, aping her1pro.F, with

Code: Select all

                LABINT(NCOOR) = 'SD '//CHRNOS(ISCOR1/100)
     *                            //CHRNOS(mod(ISCOR1,100)/10)
     *                            //CHRNOS(mod(MOD(ISCOR1,100),10))
     *                            //' '//CHRXYZ(-ICOOR2)
Together with the redefined CHRNOS this seems to get to the point of actually running an ESR calculation. I think the CHRNOS and label construction in her1pro.F could be classed as an inadequacy rather than a bug, but the issue in lagrang.F is definitely a bug.

Incidentally, I do not really understand why the code is written in this way, using MOD calls. Internal files were available in Fortran77 and the labels could have been written with a formatted WRITE statement.

Best regards
Pete

hjaaj
Posts: 317
Joined: 27 Jun 2013, 18:44
First name(s): Hans Jørgen
Middle name(s): Aagaard
Last name(s): Jensen
Affiliation: Universith of Southern Denmark
Country: Denmark

Re: Dimensioning and label generation errors (ESR)

Post by hjaaj » 13 Aug 2019, 09:17

These problems have been fixed on Dalton Master in August 2019. The labels for Fermi contact were change to go up to 999 atoms, rather than introducing hexadecimal numbering.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests