next up previous contents
Next: Computing LS transitions Up: Computing Atomic Transitions Previous: Optimization   Contents

Computing the wave functions using MCHF

In the MCHF approach, the first step is to find an approximate wave function for the initial and final states of an atomic system. An energy criterion is used for this purpose and once a wave function has been determined, then a number of atomic properties can be computed including also relativistic effects. Figure  2.2 is more a detailed version of Figure  2.1 and includes information about the applications and intermediate files in each major step.

Figure 2.2: Computing wave functions for the initial and final states. Initially, hf gives an estimate for the n=3. The angular data is Z independent and for each n computed only once. For each Z mchf computes the wave functions.
\begin{figure}\begin{center}
\centerline{\epsfig{file=tex/fig/atsp_run1.epsi,width=10cm}}\end{center}\end{figure}

Normally, an mchf calculation starts at n=3. In order to start the calculation with good initial estimates, an average energy Hartree-Fock calculation is performed. Providing initial estimates for n=3 from hf is an optional but a worthwhile step to ensure good initial estimates for the correlation calculation. The script below shows a way of using the hf program, the comments on the right side explain the expected input:

set -x

# this script runs the Hartree-Fock program and for average energies
# and saves the output wave function file in E1.${Z}_2.w, which
# will be used as initial estimates at n=3 for the mchf calculation
# the file shows runs for Z=8,9, for different Z the line below 
# should be modified:

for Z in  8 9 #10 11 12 13 14 15 16 17
do
   (echo
   rm wfn.inp
${ATSP}/bin/hf <<EOF
N,AV,${Z}         # Atom label, Average energy, Atomic number
  1s              # closed shells
2s(1)2p(4)        # electrons outside closed shells
all               # optimize on all orbitals
y                 # default electron parameters
y                 # default remaining parameters
n                 # 
n
EOF
   mv wfn.out E1.${Z}_2.w)    # wfn.out is moved
done
rm *log

The script demonstrates the hf calculation only for Z=8,9, however, it is easily extendible for higher Z. By default hf saves the resulting wave function in a file wfn.out and the script further renames it to incorporate the group and atomic number in the file name. Since this file is used as initial estimate for mchf at n=3, it is convenient to use number 2 in the file name (the mchf script starts at n=3 and expects an initial estimate from n=2).

When a range of mchf calculations is desired, it is convenient to encode the algorithm shown in Figure  2.2 into a shell script. In this case, the calculations for n=3,4,5,6,... and for the desired set of atomic numbers Z=8,9,... are included. The script starts with assigning values for terms, eigenvalues, optimization of orbitals and other parameters as required by mchf. Note that the main loop is over each n and the internal loop for a given n is over each Z. The script assumes all files are in the current directory, except the configuration lists for the terms. They are common to all groups and are located in a separate directory, file_c. An expansion for a given term has the name LSn.c. For example, the expansion for $^4P$ and n=3 has been saved in the file files_c/4P3.c. In order to avoid name conflicts with even terms with the same LS, the odd parity is denoted as "o" in the file name (4Po3.c). A script like the above assumes calculations are robust, that no errors are encountered. The user should inspect the output for potential errors.

set -x
# Variables $a, $b, $c and $d correspond to the configuration
# expansions for the 2s.2p(4)3P2 states, which are simultaneously
# optimized and the group is named E1

a=2S;
b=2P;
c=2D;
d=4P;

# the variable $o is used to include the parity in the file names saved
# for further reference
o=

#the variables below are set equal to a string with the
#desired eigenvalue and in a parenthesis the value of the
#weights, note that the eigenvalues for a given term
#are separated by comas. Example: EIG1='1(1.0),3(0.3),4(1.0)'
EIG1='1(1.0)';
EIG2='1(1.0)';
EIG3='1(1.0)';
EIG4='1(1.0)';

# the variable $s refers to the name  of the states E1 (Even, 1-st group)
s=E1;

# variable n; f desired the calculation can be extended
# up to n=7 by erasing the '#' character, configuration files are
# provided
for n in 3 4 #5 6 7
do
   (echo
cat \
../files_c/${a}${n}.c \
../files_c/${b}${n}.c \
../files_c/${c}${n}.c \
../files_c/${d}${n}.c \
> cfg.inp;

cp cfg.inp E${n}.c          # Make a copy of the configuration file

#run nonh
${ATSP}/bin/nonh

# select orbitals to optimize and n iterations as a function of n
# for example at n=4, 1s is kept fixed, n=5 1s,2s,2p are fixed etc.
   case $n in
        3)      ORB=all; NEW=all;;
        4)      ORB==9;  NEW==4;;
        5)      ORB==12; NEW==5;;
        6)      ORB==14; NEW==5;;
        7)      ORB==19; NEW==5;;
   esac

#delete previous wfn.inp files
rm wfn.inp

# the line below is used to assign the variable $previous_n=n-1
# this variable is used to copy the wave function at n-1 to file
# wfn.inp used as initial estimates at n
   previous_n=`expr $n - 1`;

#for each atomic number optimize the energy functional with mchf
#here only Z=8 and Z=9 will be processed, the same procedure is
#valid for the entire sequence

for nat in 8 9
do
   (echo

#use the wave function file at n-1 for initial estimates
cp ${s}.${nat}_${previous_n}.w wfn.inp;

${ATSP}/bin/mchf > out_${s}.${Z}-${n} << EOF
Z=${nat}, ${nat}.
${EIG1}             # eigenvalues for term a
${EIG2}             # eigenvalues for term b
${EIG3}             # eigenvalues for term c
${EIG4}             # eigenvalues for term d
${ORB}              # orbitals which will be optimized
1s,2s,2p            # spectroscopic orbitals
y                   # default electron parameters
n                   # not default other parameters (iterations, etc)
y                   # default values of
n                   # non-default values of the convergence criteria
F,10E-9,10E-9       # convergence criteria
n                   # non-default number of scf iterations (default is 200)
2000,0              # number of iterations
y                   # default other parameters.
EOF

# save all LSn.l files to unique names, not to be overwritten at next n, Z
   mv ${a}.l ${a}1.${nat}_${n}.l;
   mv ${b}.l ${b}1.${nat}_${n}.l;
   mv ${c}.l ${c}1.${nat}_${n}.l;
   mv ${d}.l ${d}1.${nat}_${n}.l;
# save the file summry which gives some wave functions computed parameters
   mv summry ${d}1.${nat}_${n}.s;
# save wfn.out, the computed wave function with a unique file name
   mv wfn.out ${s}.${nat}_${n}.w;)
   done;)
done;

# remove not needed files
rm *lst* fort* *log summry wfn* cfg*  ??.l

The script utilizes nonh and mchf, but it is preferable to look upon the needs and I/O data separately for each one.

nonh requires cfg.inp to be present in the current working directory. All parameters in nonh are default. The only input file is cfg.inp, which is required. While processing the configuration lists, nonh prints out important reference information which can be used to detect possible errors or deviations from the desired procedures: number of orbitals, number of closed shells, number of integrals, number of configurations. The same information is repeated for each term. nonh can be run interactively without providing any input:

%nonh
Thus, the output of correctly running nonh (at n=4) is similar to:

%nonh
 input file is cfg.inp ...



                       ===============================
                             N O N H       2000
                       ===============================



 THERE ARE  9 ORBITALS AS FOLLOWS:

       2s  2p  3s  3p  3d  4s  4p  4d  4f

 THERE ARE  1 CLOSED SUBSHELLS COMMON TO ALL CONFIGURATIONS AS FOLLOWS:

       1s
 Allocating space for          1054  integrals
 processing  2P with           872 configurations
    jb =          100
    jb =          200
    jb =          300
    jb =          400
    jb =          500
    jb =          600
    jb =          700
    jb =          800
   95818 non-zero matrix elements
   10959 NF   23905 NG  204934 NR    8481 NL
  248279 Total number of integrals
 processing  2D with           888 configurations
    jb =          100
    jb =          200
    jb =          300
    jb =          400
    jb =          500
    jb =          600
    jb =          700
    jb =          800
  103833 non-zero matrix elements
   11940 NF   28320 NG  223283 NR    8557 NL
  272100 Total number of integrals
 processing  4S with           243 configurations
    jb =          100
    jb =          200
   10211 non-zero matrix elements
    2575 NF    3623 NG   23286 NR    1731 NL
   31215 Total number of integrals

 end-of-file clist!!!

After a successful completion nonh will have created the following files (Note the presence of ih.01.lst, ih.02.lst and ih.03.lst, which correspond to 2P, 2D, 4S, in the order they occurred in cfg.inp.

-rw-r--r--    1 georgio  georgio       252 Sep 20 00:35 cfg.h
-rw-r--r--    1 georgio  georgio    114019 Sep 20 00:34 cfg.inp
-rw-r--r--    1 georgio  georgio   6619380 Sep 20 00:35 c.lst
-rw-r--r--    1 georgio  georgio    863484 Sep 20 00:35 ico.lst
-rw-r--r--    1 georgio  georgio    393736 Sep 20 00:35 ih.01.lst
-rw-r--r--    1 georgio  georgio    425988 Sep 20 00:35 ih.02.lst
-rw-r--r--    1 georgio  georgio     43760 Sep 20 00:35 ih.03.lst
-rw-r--r--    1 georgio  georgio     16760 Sep 20 00:35 yint.lst

cfg.h is a text file which provides information pertaining to the expansions for each term found in the list and it is used by mchf for memory allocation and initialization and it records a number of parameters (discussed in  14.15):

   1 Closed Shells:
  1s
   9 Other Orbitals:
  2s  2p  3s  3p  3d  4s  4p  4d  4f
  3    1054   30000   snonh
   2P   872     95818         248279       370
   2D   888    103833         272100       400
   4S   243     10211          31215       124

yint.lst is a binary file that has global information about the expansions. c.lst has the coefficients and integrals needed for the energy expression and the generation of the interaction matrix. ih.#n.lst is also a binary file, it records the row index of a matrix element. The user can find the description of the format of each file in Chapter  14.15.

After nonh, mchf continues with computing the radial wave functions. Step wise mchf calculations with respect to n and good initial estimates are one of the most important factors for correct results and faster convergence of mchf calculations. The wave function at n-1 is used as an optional initial estimate and it is copied into wfn.inp. mchf reads wfn.inp provided that it is present in the current working directory. The script must have a consistent way to refer each needed file and to save results from each n and Z step into a unique file. After converging mchf saves the output wave function by default to wfn.out, and further, the scripts renames it to a file with name comprised by the name of the group, Z and n. In addition to the wave function saved in file wfn.out, the eigenvectors are computed and saved in LS.l files by default, which the script renames to a unique file name from a combination of LS term, Z and n information.

The user is responsible for providing correct initial estimate of the wave function. This becomes more difficult for runs covering multiple n and Z. Shell scripts should be prepared with care. Correct shell makes the calculation easier and reduce the error, however, they may propagate multiple errors.

In interactive mode the user must provide a number of parameters (the expected input is shown on lines starting with '$>$'):

                    =======================
                            M C H F  ... 2000
                    =======================




          THE DIMENSIONS FOR THE CURRENT VERSION ARE:
             NWD= 60        NO=220    Lagrange Multipliers=800



 START OF CASE
 =============


 ATOM, Z in FORMAT(A, F) :
 cfg.inp has configurations for             4  terms

 Enter eigenvalues and weights: one line per term, eigenvalues with weights
 in parenthesis and separated by commas, default is 1.0
 2S
 2P
 2D
 4P

 There are  10 orbitals as follows:
   1s  2s  2p  3s  3p  3d  4s  4p  4d  4f
 Enter orbitals to be varied: (ALL,NONE,SOME,NIT=,comma delimited list)
>=9
 Enter those that are spectroscopic
>1s,2s,2p
 Default electron parameters ? (Y/N)
>y         # normally yes
Default values for other parameters? (Y/N)
>n         # the answer no opens a dialog for which parameters to modify
 Default values (NO,REL,STRONG) ? (Y/N)
>y         # 
 Z=9       9.   220 10  9  0  F

 Default values for PRINT, CFGTOL, SCFTOL ? (Y/N)
>y
 Input free FORMAT(L, F, F)
>F,10E-9,10E-9    #convergence criteria, default is 10E-9
 Default values for NSCF, IC ? (Y/N)
>n
 Input free FORMAT(I, I)
>1000, 0    #by default mchf makes only 200, larger may be needed
Default values for ACFG,LD,TRACE? (Y/N)

  >>> MEMORY AND DISK USE: <<<
  ALL IN MEMORY : c.lst ih ico hmx
  >>> END MEMORY AND DISK USE<<<

  DeltaE =   -96.71221392604600      Sum_Energy =    -96.71221392604600
  DeltaE =  -1.3491365617298356E-002 Sum_Energy =    -96.72570529166330
  DeltaE =  -1.5615602415124386E-003 Sum_Energy =    -96.72726685190482
  DeltaE =  -6.3982817178498408E-004 Sum_Energy =    -96.72790668007660
  DeltaE =  -3.5633507930299402E-004 Sum_Energy =    -96.72826301515590
  DeltaE =  -1.9477728162087260E-004 Sum_Energy =    -96.72845779243752
...
...
...
  DeltaE =  -1.0284111340297386E-008 Sum_Energy =    -96.72916623947961
          740  iterations, output written to wfn.out
  DeltaE =  -1.0245514658890897E-008 Sum_Energy =    -96.72916624972513
  DeltaE =  -1.0207216405433428E-008 Sum_Energy =    -96.72916625993234
  DeltaE =  -1.0169003417104250E-008 Sum_Energy =    -96.72916627010135
  DeltaE =  -1.0207216405433428E-008 Sum_Energy =    -96.72916625993234
  DeltaE =  -1.0169003417104250E-008 Sum_Energy =    -96.72916627010135
  DeltaE =  -1.0131046224159945E-008 Sum_Energy =    -96.72916628023239
  DeltaE =  -1.0093202718053362E-008 Sum_Energy =    -96.72916629032559
  DeltaE =  -1.0055515531348647E-008 Sum_Energy =    -96.72916630038111
  DeltaE =  -1.0018084140028805E-008 Sum_Energy =    -96.72916631039919
  DeltaE =  -9.9807664355466841E-009 Sum_Energy =    -96.72916632037996
  DeltaE =  -9.9436334721758612E-009 Sum_Energy =    -96.72916633032359
++ mv 2S.l 2S1.9_4.l
++ mv 2P.l 2P1.9_4.l
++ mv 2D.l 2D1.9_4.l
++ mv 4P.l 4P1.9_4.l
++ mv wfn.out E1.9_4.w

In the first line, mchf program, expects a label (Z=9, in this case), followed by the atomic number. Then, for each term, the user is asked to specify the index of the desirable eigenvalue and its weight. For example, to compute the first eigenvalue, with weight 1.0, and the second with weight 0.5, say, the input data would be 1(1.0), 2(0.5). In the present case both are the lowest with the default weight of 1. Again, it may not be necessary to optimize only the orbitals for which there are no initial estimates provided. So in this case, we optimize only on the last 9 orbitals, or all n=2,3 orbitals.

mchf processes all CPU intensive calculations in memory, however the program has the capability to switch to disk storage, if the memory is insufficient for all arrays. The major arrays are: c.lst (coefficient data), ih and ico (pointer data) and hmx (matrix elements) and the output shows if all arrays are in the memory, or which ones are on disk, this can help the user to optimize the speed of an mchf calculation. CPU intensive calculations for data stored on disk could be considerably slower compared to data storage in memory. The output above shows that all four arrays are in memory.

In the course of an mchf calculation the change in the weighted energy and the total energy are displayed after each iteration. Poor models or optimization strategies (LS terms or weights) may result in oscillation of the total energy, or very slow convergence. The user needs to monitor the change DeltaE and the total energy Sum_Energy and should modify the script if the optimization does not proceed as expected. Those two parameters are printed to stderr, or UNIT=0. In the script described earlier the output stdout from mchf is redirected to a separate file for each mchf run. It contains more extensive information with intermediate results for each iteration and the user should review it carefully for errors or unexpected events. The output from stderr only prints the energy convergence.

Assuming that the output of stdout has been saved to a file out_O1.9-4, "grep Sum out_O1.9-4" will provide the weighted total energy after each iteration:

         Sum of ETOTAL :     -97.58248322
         Sum of ETOTAL :     -97.59942473
         Sum of ETOTAL :     -97.60086846
         Sum of ETOTAL :     -97.60101437
         Sum of ETOTAL :     -97.60103722
         Sum of ETOTAL :     -97.60104493
......
and "grep ETOT out_O1.9-4" will show more details about the the energy convergence of each LS term, including some details of the performance of the Davidson program after computing the eigenvalues (Loops,DeltaE,Res.):
         ETOTAL=   -97.47484217   Loops,DeltaE,Res.:  17  8.105D-15  6.183D-08
         ETOTAL=   -97.55365890   Loops,DeltaE,Res.:  16  6.439D-15  5.888D-08
         ETOTAL=   -97.71893986   Loops,DeltaE,Res.:  15  3.442D-15  4.197D-08
         Sum of ETOTAL :     -97.58248322
         ETOTAL=   -97.49290695   Loops,DeltaE,Res.:  15  8.438D-15  9.867D-08
         ETOTAL=   -97.57279015   Loops,DeltaE,Res.:  15  1.443D-15  6.171D-08
         ETOTAL=   -97.73256837   Loops,DeltaE,Res.:  15  3.331D-15  3.015D-08
         Sum of ETOTAL :     -97.59942473
         ETOTAL=   -97.49465420   Loops,DeltaE,Res.:  14  3.109D-15  6.362D-08
         ETOTAL=   -97.57421689   Loops,DeltaE,Res.:  14  3.053D-15  3.286D-08
         ETOTAL=   -97.73372555   Loops,DeltaE,Res.:  13  5.551D-15  5.598D-08
         Sum of ETOTAL :     -97.60086846
Those are valuable quick checks on the convergence patterns during and after an mchf run for each LS term and for the total energy without interrupting the program. In the next step of the mchf cycle, we again move the wfn.out to wfn.inp and perform a calculation on the next n..

Upon successful completion the iteration over each Z and n, a set of files is saved: *.w, out*, *.s, and a number of .l files corresponding to the number of terms. Multiple eigenvectors for the same LS term are saved in a single .l file. Note that in addition to energy, coefficient and electron data, each *.l contains the specific mass shift parameter Ssms.

245% head  4So1.8_4.l
  Z=8     Z =   8.0  NEL =   0   NCFG =    243


  2*J =    0  NUMBER =   1
     Ssms =      4.623859419
     1   -74.495142248  2s(2).2p(3)4S3_4S
 0.98261091-0.05205512-0.00749617 0.00713153 0.08850041-0.02273411 0.01386312
-0.04402566-0.00635483 0.03426689-0.02166538-0.00616148 0.01724229-0.00998867
 0.00111927 0.00189890 0.00070353 0.00106733 0.00063790-0.00146846 0.00026875
-0.00005382 0.00010698-0.00011283 0.10293901 0.01172426-0.00401144-0.04858777
In addition to the wave functions, and eigenvectors, mchf writes many orbital parameters to summry file. Each summry file is saved to a file with a suffix .s and a base name consistent with the wave function file name.


next up previous contents
Next: Computing LS transitions Up: Computing Atomic Transitions Previous: Optimization   Contents
2001-10-11