1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
|
************************************************************************
* This file is part of OpenMolcas. *
* *
* OpenMolcas is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License, v. 2.1. *
* OpenMolcas is distributed in the hope that it will be useful, but it *
* is provided "as is" and without any express or implied warranties. *
* For more details see the full text of the license in the file *
* LICENSE or in <http://www.gnu.org/licenses/>. *
* *
* Copyright (C) 2003, Per-Olof Widmark *
************************************************************************
************************************************************************
* *
* This program tests the runfile utilities. *
* *
*----------------------------------------------------------------------*
* *
* Author: Per-Olof Widmark *
* Written: July 2003 *
* Lund University, Sweden *
* *
************************************************************************
Program TestRF
Use RunFile_data, only: TypDbl, TypInt, TypStr
Implicit None
Integer Mxdata
Parameter (MxData=64)
Logical UseOld
Integer iRc,iOpt
Integer iSeed
Integer Loop
Integer i
Integer nDataA,nDataB
Integer nDataC,nDataD
Integer nDataE,nDataF
Integer nDataAx,nDataBx
Integer nDataCx,nDataDx
Integer nDataEx,nDataFx
Integer RecTypA,RecTypB
Integer RecTypC,RecTypD
Integer RecTypE,RecTypF
Real*8 DataA(MxData)
Real*8 DataB(MxData)
Integer DataC(MxData)
Integer DataD(MxData)
Character*1 DataE(MxData)
Character*1 DataF(MxData)
Real*8 Random_molcas
External Random_molcas
Call Init_LinAlg
Call PrgmInit('TestRF')
Call NameRun('RUNFILE')
UseOld=.false.
If(UseOld) GoTo 500
iSeed=12345
nDataA=0
nDataB=0
nDataC=0
nDataD=0
nDataE=0
nDataF=0
Do i=1,MxData
DataA(i)= 1.0d0*i
DataB(i)=-1.0d0*i
DataC(i)= i
DataD(i)=-i
DataE(i)= Char(64+mod(i,48))
DataF(i)= Char(64+mod(i,48))
End Do
iRc=0
iOpt=0
Do Loop=1,16
If(Random_molcas(iSeed).gt.0.75d0) Then
nDataA=Int((MxData-4)*Random_molcas(iSeed)+4)
Write(*,*) 'Adding A',nDataA
Call dWrRun('Amat',DataA,nDataA)
End If
If(Random_molcas(iSeed).gt.0.75d0) Then
nDataB=Int((MxData-4)*Random_molcas(iSeed)+4)
Write(*,*) 'Adding B',nDataB
Call dWrRun('Bmat',DataB,nDataB)
End If
If(Random_molcas(iSeed).gt.0.75d0) Then
nDataC=Int((MxData-4)*Random_molcas(iSeed)+4)
Write(*,*) 'Adding C',nDataC
Call iWrRun('Cmat',DataC,nDataC)
End If
If(Random_molcas(iSeed).gt.0.75d0) Then
nDataD=Int((MxData-4)*Random_molcas(iSeed)+4)
Write(*,*) 'Adding D',nDataD
Call iWrRun('Dmat',DataD,nDataD)
End If
If(Random_molcas(iSeed).gt.0.75d0) Then
Call NameRun('RUNXXX')
i=Int((MxData-4)*Random_molcas(iSeed)/4)
nDataE=4*i+4
Write(*,*) 'Adding E',nDataE
Call cWrRun('Emat',DataE,nDataE)
Call NameRun('RUNFILE')
End If
If(Random_molcas(iSeed).gt.0.75d0) Then
i=Int((MxData-4)*Random_molcas(iSeed)/4)
nDataF=4*i+4
Write(*,*) 'Adding F',nDataF
Call cWrRun('Fmat',DataF,nDataF)
End If
End Do
500 Continue
Do i=1,MxData
DataA(i)= 0.0d0
DataB(i)= 0.0d0
DataC(i)= 0
DataD(i)= 0
DataE(i)= Char(0)
DataF(i)= Char(0)
End Do
nDataAx=nDataA
nDataBx=nDataB
nDataCx=nDataC
nDataDx=nDataD
nDataEx=nDataE
nDataFx=nDataF
nDataA=0
nDataB=0
nDataC=0
nDataD=0
nDataE=0
nDataF=0
Call ffRun('aMat',nDataA,RecTypA)
Call ffRun('bMat',nDataB,RecTypB)
Call ffRun('cMat',nDataC,RecTypC)
Call ffRun('dMat',nDataD,RecTypD)
Call NameRun('RUNXXX')
Call ffRun('eMat',nDataE,RecTypE)
Call NameRun('RUNFILE')
Call ffRun('fMat',nDataF,RecTypF)
If(UseOld) Then
nDataAx=nDataA
nDataBx=nDataB
nDataCx=nDataC
nDataDx=nDataD
nDataEx=nDataE
nDataFx=nDataF
End If
If(nDataA.ne.nDataAx) Then
Write(*,*) 'nDataA:',nDataA,nDataAx
Stop
End If
If(nDataB.ne.nDataBx) Then
Write(*,*) 'nDataB:',nDataB,nDataBx
Stop
End If
If(nDataC.ne.nDataCx) Then
Write(*,*) 'nDataC:',nDataC,nDataCx
Stop
End If
If(nDataD.ne.nDataDx) Then
Write(*,*) 'nDataD:',nDataD,nDataDx
Stop
End If
If(nDataE.ne.nDataEx) Then
Write(*,*) 'nDataE:',nDataE,nDataEx
Stop
End If
If(nDataF.ne.nDataFx) Then
Write(*,*) 'nDataF:',nDataF,nDataFx
Stop
End If
If(RecTypA.ne.TypDbl) Then
Write(*,*) 'RecTypA:',RecTypA,TypDbl
Stop
End If
If(RecTypB.ne.TypDbl) Then
Write(*,*) 'RecTypB:',RecTypB,TypDbl
Stop
End If
If(RecTypC.ne.TypInt) Then
Write(*,*) 'RecTypC:',RecTypC,TypInt
Stop
End If
If(RecTypD.ne.TypInt) Then
Write(*,*) 'RecTypD:',RecTypD,TypInt
Stop
End If
If(RecTypE.ne.TypStr) Then
Write(*,*) 'RecTypE:',RecTypE,TypStr
Stop
End If
If(RecTypF.ne.TypStr) Then
Write(*,*) 'RecTypF:',RecTypF,TypStr
Stop
End If
If(nDataA.gt.0) Then
Write(*,*) 'Testing A',nDataA
Call dRdRun('amat',DataA,nDataA)
Do i=1,nDataA
If(Abs(DataA(i)-i).gt.1.0d-12) Then
Write(*,*) 'A:',i,DataA(i)
End If
End Do
End If
If(nDataB.gt.0) Then
Write(*,*) 'Testing B',nDataB
Call dRdRun('bmat',DataB,nDataB)
Do i=1,nDataB
If(Abs(DataB(i)+i).gt.1.0d-12) Then
Write(*,*) 'B:',i,DataB(i)
End If
End Do
End If
If(nDataC.gt.0) Then
Write(*,*) 'Testing C',nDataC
Call iRdRun('cmat',DataC,nDataC)
Do i=1,nDataC
If(DataC(i)-i.ne.0) Then
Write(*,*) 'C:',i,DataC(i)
End If
End Do
End If
If(nDataD.gt.0) Then
Write(*,*) 'Testing D',nDataD
Call iRdRun('dmat',DataD,nDataD)
Do i=1,nDataD
If(DataD(i)+i.ne.0) Then
Write(*,*) 'D:',i,DataD(i)
End If
End Do
End If
If(nDataE.gt.0) Then
Call NameRun('RUNXXX')
Write(*,*) 'Testing E',nDataE
Call cRdRun('emat',DataE,nDataE)
Do i=1,nDataE
If(iChar(DataE(i))-64-mod(i,48).ne.0) Then
Write(*,*) 'E:',i,DataE(i)
End If
End Do
Call NameRun('RUNFILE')
End If
If(nDataF.gt.0) Then
Write(*,*) 'Testing F',nDataF
Call cRdRun('fmat',DataF,nDataF)
Do i=1,nDataF
If(iChar(DataF(i))-64-mod(i,48).ne.0) Then
Write(*,*) 'F:',i,DataF(i)
End If
End Do
End If
Call DumpRun(iRc,iOpt)
Stop
End
|