forked from grimme-lab/cefine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cefine.f90
2486 lines (2311 loc) · 79.3 KB
/
cefine.f90
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
! This file is part of cefine.
!
! Copyright (C) 2006-2019 Stefan Grimme
!
! cefine is free software: you can redistribute it and/or modify it under
! the terms of the GNU Lesser General Public License as published by
! the Free Software Foundation, either version 3 of the License, or
! (at your option) any later version.
!
! cefine is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU Lesser General Public License for more details.
!
! You should have received a copy of the GNU Lesser General Public License
! along with cefine. If not, see <https://www.gnu.org/licenses/>.
module dyn_array
integer, allocatable :: idx(:)
real, allocatable :: matrix(:, :)
end module
Program comand_line_define
use dyn_array
implicit none
integer maxarg, io, i, nn, err, ts_num
parameter(maxarg=20)
character*80 list
character*80 arg(maxarg)
character*80 out, run1, run2, run3
character*80 func
character*80 grid, cosxgrid
character*80 bas
character*80 sym
character*80 atmp
character*20 hsstmp
character*80 coord_name
character*80 newlib
character*80 dbas
character*80 homedir, cefinerc
character*80 str_scale
character*2 baselem(85)
character*2 baselem2(60)
character(len=:), allocatable :: ts_string
character(len=2) :: ts_str
real*8 extol !tolerance of K integrals
logical RI, MP2, DFT, VDW, DESY, OPT, KEEP, UHF, MODEHT, QUICK, TROLD
logical DFPT2, FC, pr, OR, RIK, NOVDW, EX, CP1, CP2, POL, CC, ECP
logical COORD, FOLD, MOLD, RANGST, SCS, TRUNC, LIB, ALIB, LAP, NDIFF
logical da, FON, TS, R12, MRCI, COSMO, OPTI, ECHO, TEST, OLDMO, SOS, ZERO, FAKE
logical strange_elem, diffuse, egrid, XMOL, MARIJ, REF, nori, BJ, ATM, D4
logical nomarij
logical deletion_failed, RMGF, RMF, MSC, SCFITER
logical cosx, nocosx ! SAW: added seminumerical exchange = COSX
logical hcore ! Modify control file to initiate hcore guess
logical modbas !basis defined in input
logical modgrid !grid defined in input
logical modrad !radsize defined in input
logical noauxg !remove g-fkt from auxbasis
logical modaux !aux handling defined in input
logical hf3c ! perform HF-3c calculation
logical donl ! perform nl non-self-consistent
logical gcpinfo !for pbe-3c, pbe0-3c, b3-lyp-3c (echo into control)
integer ricore, scfconv, intmem, thime, maxcor, rpacor, radsize
integer charge, maxiter, nheavy, nopen, nat, f
integer kfrag, libnr, l, ntypes, irare, att(20)
integer mend1, mend2, mstart
real*8 desythr, xx(5), thize, cosmodk, dum, fp, mscale, b_scale, readaa
! coord file handling
real*8 xyz(3, 10000)
integer iat(10000)
pr = .true.
! .'--------------------------------------------'
if (pr) write (*, *) 'Command line define V2.24, SG,HK,MM January 2022 (-h for help) '
! write(*,*)
! .'--------------------------------------------'
io = 1
out = 'def.inp' !> temporary input file name
! run3='define_huge<def.inp>define.out'
run3 = 'define<def.inp>define.out'
! defaults
maxiter = 250
desythr = 0.05
scfconv = 7
grid = 'm4'
cosxgrid = 'm2'
ricore = 1000
intmem = 1000
maxcor = 1000
rpacor = 1000
thime = 4
thize = 0.0000001
! func ='tpss'
func = 'pbeh-3c'
bas = 'def2-TZVP'
charge = 0
cosmodk = 78.0
fp = -3.5
extol = -1.0d0 !negatice extol -> not used
FAKE = .false.
VDW = .false.
ECHO = .false.
REF = .false.
XMOL = .false.
RI = .true.
RIK = .false.
COSX = .false. !SAW
NOCOSX = .false. ! MM
hcore = .false.
R12 = .false.
MODEHT = .false.
RANGST = .false.
DFT = .true.
DESY = .true.
CP1 = .false.
CP2 = .false.
OPT = .true.
MP2 = .false.
OPTI = .false.
KEEP = .false.
UHF = .false.
DFPT2 = .false.
OR = .false.
NOVDW = .false.
EX = .false.
POL = .false.
COORD = .false.
FOLD = .false.
MOLD = .false.
SCS = .false.
SOS = .false.
TRUNC = .false.
FC = .true.
LIB = .false.
ALIB = .false.
TS = .false.
FON = .false.
MRCI = .false.
COSMO = .false.
diffuse = .false.
TEST = .false.
TROLD = .false.
OLDMO = .false.
LAP = .false.
EGRID = .false.
MARIJ = .false.
NOMARIJ = .false.
QUICK = .false.
! BJ=.false.
RMGF = .false.
RMF = .false.
!JGB BJ as default (!)
BJ = .true.
ZERO = .false.
!FB ATM
ATM = .false.
!FB D4
D4 = .false.
NDIFF = .false.
ECP = .false.
CC = .false.
MSC = .false. !> mass scaling
modbas = .false.
modaux = .false.
noauxg = .false.
modgrid = .false.
modrad = .false.
hf3c = .false.
!FB NL
donl = .false.
!FB gcpinfo
gcpinfo = .false.
!> check for existence of .cefinerc
CALL get_environment_variable("HOME", homedir) !> get home directory to variable
cefinerc = trim(homedir)//'/.cefinerc' !> to remove trailing character
inquire (file=cefinerc, exist=da) !> check for existence
if (da) then
write (*, *) cefinerc
open (unit=20, file=cefinerc)
842 read (20, '(a)', end=942) atmp
if (index(atmp, 'desythr') .ne. 0) then
call readl(atmp, xx, nn)
desythr = xx(nn)
end if
if (index(atmp, 'scfconv') .ne. 0) then
call readl(atmp, xx, nn)
scfconv = xx(nn)
end if
if (index(atmp, 'fp') .ne. 0) then
call readl(atmp, xx, nn)
fp = xx(nn)
end if
if (index(atmp, 'ricore') .ne. 0) then
call readl(atmp, xx, nn)
ricore = idint(xx(nn))
end if
if (index(atmp, 'maxcor') .ne. 0) then
call readl(atmp, xx, nn)
maxcor = idint(xx(nn))
end if
if (index(atmp, 'rpacor') .ne. 0) then
call readl(atmp, xx, nn)
rpacor = idint(xx(nn))
end if
if (index(atmp, 'twoint') .ne. 0) then
call readl(atmp, xx, nn)
intmem = idint(xx(nn))
end if
if (index(atmp, 'func') .ne. 0) then
call backstring(atmp, func, 4)
end if
if (index(atmp, 'bas') .ne. 0) then
call backstring(atmp, bas, 3)
modbas = .true.
end if
if (index(atmp, 'grid') .ne. 0) then
call backstring(atmp, grid, 4)
egrid = .true.
modgrid = .true.
end if
if (index(atmp, 'radsize') .ne. 0) then
call readl(atmp, xx, nn)
radsize = xx(nn)
modrad = .true.
end if
if (index(atmp, 'vdw') .ne. 0) then
if (index(atmp, 'on') .ne. 0) BJ = .true.
end if
if (index(atmp, 'marij') .ne. 0) then
MARIJ = .true.
RI = .true.
end if
if (index(atmp, 'no-rij') .ne. 0) then
NORI = .true.
end if
if (index(atmp, 'echo') .ne. 0) then
if (index(atmp, 'on') .ne. 0) ECHO = .true.
end if
if (index(atmp, 'nodiff') .ne. 0) NDIFF = .true.
goto 842
942 close (20)
end if
arg = ''
do i = 1, maxarg
call getarg(i, arg(i))
end do
!FB print cml-input
write (6, '(a,1x)', advance="no") 'cml-input: cefine'
do i = 1, maxarg
write (6, '(a,1x)', advance="no") trim(arg(i))
end do
write (*, *)
if (arg(1) .eq. '-h' .or. arg(1) .eq. '?' .or. arg(1) .eq. '-help') then
write (*, *) 'options:'
write (*, *) ' -hf (def: RI-DFT/TPSS)'
write (*, *) ' -func <string>'
write (*, *) ' -bas <string>'
write (*, *) ' -grid <string>'
write (*, *) ' -radsize <integer>'
write (*, *) ' -mp2 (do RI-MP2)'
write (*, *) ' -scs (do RI-SCS-MP2)'
write (*, *) ' -sos (do RI-SOS-MP2)'
write (*, *) ' -lsos /-lap (do RI-Laplace-SOS-MP2)'
write (*, *) ' -msc_exc <string> (e.g., "1-9", list of atoms that should NOT be scaled) <real> (scaling factor, default 1000000)'
write (*, *) ' -cc (do RI-CCSD(T))'
write (*, *) ' -d3 ($disp3 -bj)'
write (*, *) ' -d3atm ($disp3 -bj -abc)' ! FB implemented
write (*, *) ' -zero (D3 zero damping)'
write (*, *) ' -d4 ($disp4)'
write (*, *) ' -donl ($donl, induces c1 sym)'
write (*, *) ' -ref (reference SP)'
! write(*,*)' -zero ($disp3 )'
! write(*,*)' -noscs (no SCS-MP2 when using ricc2)'
write (*, *) ' -vdw (DFT-D2)'
write (*, *) ' -quick (PWLDA/SVP grid 1, no ired)'
write (*, *) ' -chrg <integer>'
write (*, *) ' -angst (read coords in Angstroem)'
write (*, *) ' -uhf <integer> (integer=# Na-Nb)'
write (*, *) ' -sym <string> (def: desy 0.03)'
write (*, *) ' -scfconv <integer>'
write (*, *) ' -abel (adjust for Abelian subgroups->e.g. pmp2)'
write (*, *) ' -noopt (def: ired optimization)'
write (*, *) ' -opt (switch on opt e.g. for MP2)'
write (*, *) ' -novdw (switch it off for B97-D due to EDA)'
write (*, *) ' -nori'
write (*, *) ' -ri'
write (*, *) ' -nofc (all e-corr. for MP2)'
write (*, *) ' -rijk (RI for HF/hybrids)'
write (*, *) ' -senex (seminum. exchange w/ COS alg. for hybrids)' !SAW + MM
write (*, *) ' -nosenex (force NO seminum. exchange w/ COS alg. for hybrids)' !MM
write (*, *) ' -senexgrid <string> # default: m2'
write (*, *) ' -or (set flags for OR, escf)'
write (*, *) ' -ex (set flags UV/CD, escf)'
write (*, *) ' -fold (take forceapprox from previous run)'
write (*, *) ' -mold (take mos from previous run)'
write (*, *) ' -trold (takes hessian from previous run, activates TS)'
write (*, *) ' -trunc (truncated RIJK)'
write (*, *) ' -fon (Fermi smearing options switched on)'
write (*, *) ' -pol (set flags C6 computation, escf)'
write (*, *) ' -cp1 (counterpoise computation, frag1, calls splitmol)'
write (*, *) ' -cp2 (counterpoise computation, frag2, calls splitmol)'
write (*, *) ' -ts <integer> (statpt TS search settings, def ts 1)'
write (*, *) ' -r12 (R12/F12 options for ricc2)'
write (*, *) ' -dftmrci (sets cbas, bhlyp etc)'
write (*, *) ' -cosmo <real> (COSMO with dk=real)'
write (*, *) ' -echo (write important parts of control)'
write (*, *) ' -keep (debuging)'
write (*, *) ' -co <coord_file> (def: coord)'
write (*, *) ' -cox <xyz_file> (writes "coord" file)'
write (*, *) ' -lib <integer> (use own basis set lib) '
write (*, *) ' ($HOME/.definerc, basis=PATH)'
write (*, *) ' -auxlib <PATH> (own jbas/cbas basis lib)'
write (*, *) ' -diff (add spd/sp diffuse functions)'
write (*, *) ' -test (do not call define)'
write (*, *) ' -nodiff (turns off diff density feature of TM)'
write (*, *) ' -gf (remove g/f on H-Rn in def2-QZVP only)'
write (*, *) ' -fpol (remove f on B-Rn in def2-TZVPD only)'
write (*, *) 'needs: <coord> file in TM format'
write (*, *) 'optional files : <.SYM> with Schoenflies symbol'
write (*, *) '(in <coord> dir) <.UHF> integer number Na-Nb'
write (*, *) ' <.CHRG> integer (charge)'
write (*, *) 'possible options in .cefinerc:'
write (*, *) 'func STRING'
write (*, *) 'bas STRING'
write (*, *) 'grid STRING'
write (*, *) 'desythr REAL'
write (*, *) 'scfconv INTEGER'
write (*, *) 'ricore INTEGER'
write (*, *) 'twoint INTEGER'
write (*, *) 'maxcor INTEGER'
write (*, *) 'rpacor INTEGER'
write (*, *) 'fp REAL'
write (*, *) 'vdw on # sets DFT-D2(BJ) '
write (*, *) 'echo on # more printing'
write (*, *) 'marij #sets $marij '
write (*, *) 'nomarij #forbids $marij even for larger systems'
write (*, *) 'no-rij #no RIJ for hybrids, if functional is known'
write (*, *) 'nodiff #turns off diff density feature of TM'
stop
end if
do i = 1, maxarg
if (arg(i) .ne. '') then
if (index(arg(i), '-ref') .ne. 0) REF = .true.
if (index(arg(i), '-fake') .ne. 0) FAKE = .true.
if (index(arg(i), '-ecp') .ne. 0) ECP = .true.
!FB -d3atm
if (index(arg(i), '-d3atm') .ne. 0) then
BJ = .true.
ATM = .true.
end if
if (index(arg(i), '-d3') .ne. 0) BJ = .true.
if (index(arg(i), '-zero') .ne. 0) then
ZERO = .true.
BJ = .false.
end if
!FB d4
if (index(arg(i), '-d4') .ne. 0) then
D4 = .true.
BJ = .false.
ATM = .false.
ZERO = .false.
end if
!FB NL
if (index(arg(i), '-donl') .ne. 0) then
donl = .true.
end if
if (index(arg(i), '-quick') .ne. 0) QUICK = .true.
if (index(arg(i), '-nodiff') .ne. 0) NDIFF = .true.
if (index(arg(i), '-nolap') .ne. 0) LAP = .false.
if (index(arg(i), '-noscs') .ne. 0) SCS = .false.
if (index(arg(i), '-lap') .ne. 0 .or. index(arg(i), '-lsos') .ne. 0) then
LAP = .true.
DFT = .false.
NOVDW = .true.
func = 'tpss'
end if
if (index(arg(i), '-scs') .ne. 0) then
SCS = .true.
DFT = .false.
NOVDW = .true.
func = 'tpss'
end if
if (index(arg(i), '-sos') .ne. 0) then
SOS = .true.
DFT = .false.
NOVDW = .true.
func = 'tpss'
end if
if (index(arg(i), '-gf') .ne. 0) RMGF = .true.
if (index(arg(i), '-fpol') .ne. 0) RMF = .true.
if (index(arg(i), '-marij ') .ne. 0) MARIJ = .true.
if (index(arg(i), '-nomarij ') .ne. 0) NOMARIJ = .true.
if (index(arg(i), '-fold') .ne. 0) FOLD = .true.
if (index(arg(i), '-mold') .ne. 0) MOLD = .true.
if (index(arg(i), '-modeht') .ne. 0) MODEHT = .true.
if (index(arg(i), '-nofc') .ne. 0) FC = .false.
if (index(arg(i), '-or ') .ne. 0) OR = .true.
if (index(arg(i), '-pol ') .ne. 0) POL = .true.
if (index(arg(i), '-ex') .ne. 0) EX = .true.
if (index(arg(i), '-nori') .ne. 0) RI = .false.
if (index(arg(i), '-ri') .ne. 0) then
NORI = .false.
RI = .true.
end if
if (index(arg(i), '-noopt') .ne. 0) OPT = .false.
if (index(arg(i), '-opt') .ne. 0) OPTI = .true.
if (index(arg(i), '-hf') .ne. 0) DFT = .false.
if (index(arg(i), '-mp2') .ne. 0) then
MP2 = .true.
DFT = .false.
NOVDW = .true.
func = 'tpss'
end if
if (index(arg(i), '-vdw') .ne. 0) VDW = .true.
if (index(arg(i), '-novdw') .ne. 0) NOVDW = .true.
if (index(arg(i), '-cp1') .ne. 0) CP1 = .true.
if (index(arg(i), '-cp2') .ne. 0) CP2 = .true.
if (index(arg(i), '-rijk') .ne. 0) RIK = .true.
if (index(arg(i), '-senex') .ne. 0) COSX = .true.
if (index(arg(i), '-nosenex') .ne. 0) NOCOSX = .true.
if (index(arg(i), '-hcore') .ne. 0) hcore = .true.
if (index(arg(i), '-trunc') .ne. 0) TRUNC = .true.
if (index(arg(i), '-fon') .ne. 0) FON = .true.
if (index(arg(i), '-ts') .ne. 0) then
read (arg(i + 1), *, IOSTAT=err) ts_num
if (err .ne. 0) ts_num = 1
write (ts_str, '(I2)') ts_num
TS = .true.
end if
if (index(arg(i), '-r12') .ne. 0) R12 = .true.
if (index(arg(i), '-dftmrci') .ne. 0) then
MRCI = .true.
NOVDW = .true.
func = 'bh-lyp'
end if
if (index(arg(i), '-echo') .ne. 0) ECHO = .true.
if (index(arg(i), '-diff') .ne. 0) diffuse = .true.
if (index(arg(i), '-test') .ne. 0) TEST = .true.
if (index(arg(i), '-oldmo') .ne. 0) OLDMO = .true.
if (index(arg(i), '-pmos') .ne. 0) OLDMO = .true.
if (index(arg(i), '-trold') .ne. 0) TROLD = .true. ! cbann: enable use of old hessian for TS search
if (index(arg(i), '-cc ') .ne. 0) then
CC = .true.
DFT = .false.
NOVDW = .true.
func = 'tpss'
end if
!JGB include hf-3c compound key
if (index(arg(i), '-hf3c') .ne. 0) then
hf3c = .true.
dft = .false.
RI = .false.
end if
!JGB remove g functions from auxbasis
if (index(arg(i), '-noauxg ') .ne. 0) then
noauxg = .true.
modaux = .true.
end if
!JGB do not remove g functions in auxbasis
if (index(arg(i), '-auxg ') .ne. 0) then
noauxg = .false.
modaux = .true.
end if
if (index(arg(i), '-co ') .ne. 0) then
COORD = .true.
coord_name = arg(i + 1)
end if
if (index(arg(i), '-cox ') .ne. 0) then
! call readl(arg(i+1),xx,nn)
call xyzrd(xyz, iat, nat, arg(i + 1))
call wtm(xyz, iat, nat, 'coord')
! coord_name='coord'!arg(i+1)
end if
if (index(arg(i), '-chrg') .ne. 0) then
call readl(arg(i + 1), xx, nn)
charge = idint(xx(1))
end if
if (index(arg(i), '-cosmo') .ne. 0) then
call readl(arg(i + 1), xx, nn)
dum = xx(1)
if (dum .gt. 0.999) cosmodk = dum
COSMO = .true.
end if
if (index(arg(i), '-scfconv') .ne. 0) then
call readl(arg(i + 1), xx, nn)
scfconv = idint(xx(1))
end if
!FB radsize
if (index(arg(i), '-radsize') .ne. 0) then
call readl(arg(i + 1), xx, nn)
radsize = idint(xx(1))
modrad = .true.
end if
!JGB K tolerance
if (index(arg(i), '-ktol') .ne. 0) then
call readl(arg(i + 1), xx, nn)
extol = xx(1)
end if
if (index(arg(i), '-uhf') .ne. 0) then
call readl(arg(i + 1), xx, nn)
nopen = idint(xx(1))
! ??? if(nopen.gt.0)UHF=.true.
write (*, *) ' *Switching UHF mode on*'
UHF = .true.
end if
if (index(arg(i), '-sym') .ne. 0) then
sym = arg(i + 1)
DESY = .false.
end if
if (index(arg(i), '-abel') .ne. 0) then
call susy(sym, DESY)
end if
if (index(arg(i), '-grid') .ne. 0) then
grid = arg(i + 1)
modgrid = .true.
end if
if (index(arg(i), '-senexgrid') .ne. 0) then
cosxgrid = arg(i + 1)
end if
if (index(arg(i), '-bas') .ne. 0) then
bas = arg(i + 1)
modbas = .true.
end if
if (index(arg(i), '-func') .ne. 0) then
! c . index(arg(i),'-f').ne.0)then
func = arg(i + 1)
DFT = .true.
end if
if (index(arg(i), '-angst') .ne. 0) RANGST = .true.
if (index(arg(i), '-lib') .ne. 0) then ! ... hok
LIB = .true.
! no need for more than one own basis set library?
! call readl(arg(i+1),xx,nn)
! libnr=idint(xx(1))
libnr = 3
end if
if (index(arg(i), '-auxlib') .ne. 0) then
ALIB = .true.
newlib = arg(i + 1)
! call readl(arg(i+2),xx,nn)
! ntypes=idint(xx(1))
end if ! ...
!c keep outputs for debuging purposes
if (index(arg(i), '-keep') .ne. 0) KEEP = .true.
!> mass scaling
if (index(arg(i), '-msc_exc') .ne. 0) then
!> next argument should a list of atoms
list = arg(i + 1)
if (len(list) .eq. 0) then
write (*, *) "The list of atoms are not provided, masses will not be scaled"
else
call string_to_integer(list)!,idx)
end if
!> last one should be scaling factor
read (arg(i + 2), *, IOSTAT=err) mscale
if (err .ne. 0) then
write (*, *) 'Scaling factor is not provided, 1E7 will be used'
mscale = 1000000
end if
MSC = .true.
end if
end if
end do
!c read possible file .SYM and .UHF
inquire (file='.SYM', exist=da)
if (da) then
open (unit=21, file='.SYM')
read (21, '(a)') sym
if (pr) write (*, '(''!!! symmetry enforced by user in <.SYM> : '',a,'' !!!'')') trim(sym)
DESY = .false.
end if
inquire (file='.UHF', exist=da)
if (da) then
open (unit=21, file='.UHF')
read (21, *) nopen
UHF = .true.
if (pr) write (*, '(''!!! UHF enforced by user in <.UHF> . Na-Nb:'',i4,'' !!!'')') nopen
end if
inquire (file='.CHRG', exist=da)
if (da) then
open (unit=21, file='.CHRG')
read (21, *) charge
if (pr) write (*, '(''!!! charge in <.CHRG> :'',i4,'' !!!'')') charge
end if
! cbann: if trold, check for hessian files. If present, also activate TS
! and save hessian
if (TROLD) then
inquire (file='hessian', exist=da)
if (da) then
call system("mv hessian hss.tmp")
TS = .true.
end if
inquire (file='hessian_driver', exist=da)
if (da) then
call system("cat hessian_driver|sed 's/$hessian.*/$hessian (projected)/' > hss.tmp")
TS = .true.
end if
end if
if (MOLD) call system('mv mos mos.tmp')
if (OLDMO) then
call system('rm -fr TMP.MOS')
write (*, *) '* projecting old mos to new basis *'
call system("cpc TMP.MOS &> /dev/null ")
end if
call system('rm -rf control basis auxbasis mos alpha beta')
! c why?
! if((.not.OPT).and.(.not.MP2))scfconv=6
! if(CP) scfconv=8
if (POL) then
scfconv = 7
grid = '3'
end if
! c correct nonsense options
if (LAP) SOS = .true.
if (MP2 .and. DFT) DFT = .false.
if (SCS .and. DFT) DFT = .false.
if (SOS .and. DFT) DFT = .false.
if (CC .and. DFT) DFT = .false.
if (MP2) VDW = .false.
if (MP2) BJ = .false.
if (MP2) ZERO = .false.
if (MP2) ATM = .false.
if (MP2) D4 = .false.
if (VDW .and. BJ) BJ = .false.
if (MP2 .or. SCS .or. SOS) OPT = .false.
if (MP2 .or. SCS) LAP = .false.
if (rik .and. cosx) cosx = .false. ! SAW: don't use both
! c dfpt2 special
if (func .eq. 'b2-plyp' .or. func .eq. 'b2gp-plyp' .or. func .eq. 'ptpss' .or. &
& MRCI .or. func .eq. 'pwpb95' .or. func .eq. 'dsd-blyp') then
MP2 = .true.
SCS = .false.
DFPT2 = .true.
FC = .false.
OPT = .false.
if (ex) FC = .true.
if (.not. EGRID) grid = 'm5'
scfconv = 7
end if
! if(func.eq.'b97-d'.and.DFT)VDW=.true.
! if(func.eq.'ptpss'.or.func.eq.'pwpb95')then
! SOS=.true.
! SCS=.false.
! endif
if (NOVDW) then
VDW = .false.
BJ = .false.
ATM = .false.
ZERO = .false.
D4 = .false.
donl = .false.
end if
if (donl) then
VDW = .false.
BJ = .false.
ATM = .false.
ZERO = .false.
D4 = .false.
sym = 'c1'
DESY = .false.
end if
!FB define r2scan-3c defaults
if (func .eq. 'r2scan3c') func = 'r2scan-3c'
if (func .eq. 'r2scan-3c') then
!uses gcp
write (*, *) "Use R2SCAN-3C with radsize 10 for gas-phase optimizations and grid m4!"
if (.not. modbas) bas = 'def2-mTZVPP'
if (.not. modgrid) grid = 'm4'
if (.not. novdw) then
D4 = .true.
donl = .false.
BJ = .false.
ATM = .false.
end if
end if
!JGB define PBEh-3c defaults
if (func .eq. 'pbeh3c') func = 'pbeh-3c'
if (func .eq. 'pbeh-3c' .and. DFT) then
!FB needs .and.DFT else D4 turned off for HF
if (.not. modbas) bas = 'def2-mSVP'
if (.not. modgrid) grid = 'm4'
if (extol .lt. 0) extol = 2.5d0
if (.not. novdw) bj = .true.
if (.not. modaux) noauxg = .true.
D4 = .false.
donl = .false.
end if
!FB define B97-3c defaults
if (func .eq. 'b97-3c') then
if (.not. modbas) bas = 'def2-mTZVP'
if (.not. modgrid) grid = 'm4'
if (.not. novdw) then
BJ = .true.
ATM = .true.
D4 = .false.
donl = .false.
end if
! not sure about noauxg (ask stefan)
elseif (func .eq. 'b973c') then
write (*, *) "Using the slower b973c because of XCFun e.g. for hessian calculation"
! b973c uses XCFun for hessian calculation
if (.not. modbas) bas = 'def2-mTZVP'
if (.not. modgrid) grid = 'm4'
if (.not. novdw) then
BJ = .true.
ATM = .true.
D4 = .false.
end if
end if
!JGB define HF-3c defaults
if (hf3c) then
write (*, *) 'Setting up HF-3c calculation!' !FB
if (.not. modbas) bas = 'minix'
if (.not. novdw) bj = .true.
if (.not. modaux .and. RI) noauxg = .true.
D4 = .false.
donl = .false.
end if
!FB define PBE-3c defaults
if (func .eq. 'pbe3c') func = 'pbe-3c'
if (func .eq. 'pbe-3c') then
write (*, *) 'Setting up PBE-3c calculation (NOT PBEh-3c)!'
func = 'pbe'
gcpinfo = .true.
if (.not. novdw) then
BJ = .true.
ATM = .true.
D4 = .false.
donl = .false.
end if
if (.not. modgrid) then
grid = 'm3'
end if
if (.not. modbas) then
bas = 'def2-mSVP'
end if
if (.not. modaux) noauxg = .true.
if (extol .lt. 0) extol = 2.5d0
end if
!FB define B3-LYP-3c defaults
if (func .eq. 'b3-lyp-3c' .or. func .eq. 'b3lyp-3c') then
write (*, *) 'Setting up B3-LYP-3c calculation!'
func = 'b3-lyp'
gcpinfo = .true.
if (.not. novdw) then
BJ = .true.
ATM = .true.
D4 = .false.
donl = .false.
end if
if (.not. modgrid) then
grid = 'm4'
end if
if (.not. modbas) then
bas = 'def2-mSVP'
end if
if (.not. modaux) noauxg = .true.
if (extol .lt. 0) extol = 2.5d0
end if
!FB define PBE0-3c defaults
if (func .eq. 'pbe0-3c' .or. func .eq. 'pbe03c') then
write (*, *) 'Setting up PBE0-3c calculation!'
func = 'pbe0'
gcpinfo = .true.
if (.not. novdw) then
BJ = .true.
ATM = .true.
D4 = .false.
donl = .false.
end if
if (.not. modgrid) then
grid = 'm4'
end if
if (.not. modbas) then
bas = 'def2-mSVP'
end if
if (.not. modaux) noauxg = .true.
if (extol .lt. 0) extol = 2.5d0
end if
! MM define wB97X-3c defaults
if (func .eq. 'wb97x-3c' .or. func .eq. 'wb97x3c') then
write (*, *) 'Setting up a wB97X-3c calculation!'
func = 'wb97x-3c'
D4 = .true.
BJ = .false.
ATM = .false.
ZERO = .false.
if (.not. modgrid) then
grid = 'm4'
end if
if (.not. modbas) then
bas = 'vDZP'
end if
if (.not. nocosx) then
cosx = .true.
end if
ECP = .true.
end if
! MM set up ECP in general if vDZP basis is chosen
if (bas .eq. 'vDZP') then
ECP = .true.
end if
! c do reference single point?
if (REF) then
OPT = .false.
if (scfconv .lt. 7) then
scfconv = 7
write (*, *) 'increasing scfconv to 7'
end if
end if
! Quick&Dirty
if (QUICK) then
func = 'pwlda'
bas = 'SVP'
grid = '1'
OPT = .false.
end if
! c dft/mrci
if (MRCI) then
func = 'bh-lyp'
FC = .false.
VDW = .false.
BJ = .false.
ZERO = .false.
D4 = .false.
end if
! c override the default or derived setting via input
if (OPTI) OPT = .true.
if (OPTI .and. MP2) RI = .false.
! c check for hybrid
if (NORI) then
if (index(func, 'b3-lyp') .ne. 0 &
.or. index(func, 'bh-lyp') .ne. 0 &
.or. index(func, 'b2-plyp') .ne. 0 &
.or. index(func, 'b2gp-plyp') .ne. 0 &
.or. index(func, 'ptpss') .ne. 0 &
.or. index(func, 'dsd-blyp') .ne. 0 &
.or. index(func, 'tpssh') .ne. 0 &
.or. index(func, 'pbe38') .ne. 0 &
.or. index(func, 'pw6b95') .ne. 0 &
.or. index(func, 'pwpb95') .ne. 0 &
.or. index(func, 'pbe0') .ne. 0 &
.or. index(func, 'pwb95') .ne. 0 &
.or. index(func, 'mpw1b95') .ne. 0 &
.or. index(func, 'mpwb1k') .ne. 0 &
.or. index(func, 'pbe0') .ne. 0 &
) then
RI = .false.
elseif (.not. DFT) then
RI = .false.
end if
end if
if (RIK) RI = .true.
if (COSX) RI = .true.
! c how many different heavy atoms
call atoms(nheavy, nat, ntypes, strange_elem, irare, att)
!> nat -atom counter, if one no opt
if (nat .eq. 1) OPT = .false.
if (io .ne. 6) open (unit=io, file=out)
! ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
! c coord
write (io, *) ' '
write (io, *) ' '
if (COORD) then
if (RANGST) then
write (io, '(''aa '',a)') trim(coord_name)
else
write (io, '(''a '',a)') trim(coord_name)
end if
else
if (RANGST) then
write (io, *) 'aa coord'
else
write (io, *) 'a coord'
end if
end if
if (DESY) then
write (io, '('' desy '',f6.2)') desythr
else
write (io, '('' sy '',a)') trim(sym)
end if
if (OPT) write (io, '('' ired '')')
write (io, *) '*'
if (.not. OPT) write (io, '('' no '')')
!> the end of molecular geometry specification
! c basis
! hok
! own basis library in /$HOME/.definerc
if (LIB) then
write (io, *) 'lib'
write (io, *) libnr
end if
write (io, '('' b all '',a20)') bas
! ECPs
if (ECP) then
write (*, *) 'WARNING: Check BASIS/ECPs !!'
if (bas .eq. 'vDZP') then
write (io, *) 'ecp all ecp-vDZP'
else
write (io, *) 'ecp all ecp-2-sdf'
end if
do l = 1, ntypes
write (io, '('' '')')
write (io, '('' '')')
end do
if (bas .eq. 'vDZP') then
write (io, *) 'ecp all ecp-vDZP'
else
write (io, *) 'ecp all ecp-10-sdf'
end if
do l = 1, ntypes
write (io, '('' '')')
write (io, '('' '')')
end do
end if
! c add diffuse
if (diffuse) then
open (unit=142, file='dbas')
do i = 1, ntypes
read (142, '(a)') dbas
! c if(att(i).le.2)dbas='1s1p'
if (pr) write (*, *) 'adding functions ', dbas
write (io, '('' bm'')')
if (ntypes .gt. 1) write (io, '('' #'',i1)') i
write (io, '('' flat'')')
write (io, '(a)') dbas
write (io, '('' '')')
write (io, '('' '')')
write (io, '('' '')')
write (io, '('' '')')
end do
close (142)
end if
! RMGF -gf for def2-QZVP
DATA baselem/'he', &
'li', 'be', 'b ', 'c ', 'n ', 'o ', 'f ', 'ne', &
'na', 'mg', 'al', 'si', 'p ', 's ', 'cl', 'ar', &
'k ', 'ca', 'sc', 'ti', 'v ', 'cr', 'mn', 'fe', 'co', 'ni', 'cu', &
'zn', 'ga', 'ge', 'as', 'se', 'br', 'kr', &
'rb', 'sr', 'y ', 'zr', 'nb', 'mo', 'tc', 'ru', 'rh', 'pd', 'ag', &
'cd', 'in', 'sn', 'sb', 'te', 'i ', 'xe', &
'cs', 'ba', 'la', 'ce', 'pr', 'nd', 'pm', 'sm', 'eu', 'gd', 'tb', 'dy', &
'ho', 'er', 'tm', 'yb', 'lu', 'hf', 'ta', 'w ', 're', 'os', 'ir', 'pt', &
'au', 'hg', 'tl', 'pb', 'bi', 'po', 'at', 'rn'/
if (RMGF) then
write (io, '('' bm'')')
write (io, '(''h def2-QZVP'')')
write (io, '(''del'')')
write (io, '(''f'')')
write (io, '('' '')')
do i = 1, 85
write (io, '('' bm'')')
write (io, '(a,1x,a)') trim(baselem(i)), 'def2-QZVP'
!write(io,'(''b def2-QZVP'')')
write (io, '(''del'')')
write (io, '(''g'')')
write (io, '('' '')')
end do
end if
! RMF -f for all def2_TZVPD
DATA baselem2/ &
'b ', 'c ', 'n ', 'o ', 'f ', 'ne', &
'al', 'si', 'p ', 's ', 'cl', 'ar', &
'sc', 'ti', 'v ', 'cr', 'mn', 'fe', 'co', 'ni', 'cu', &
'zn', 'ga', 'ge', 'as', 'se', 'br', 'kr', &
'y ', 'zr', 'nb', 'mo', 'tc', 'ru', 'rh', 'pd', 'ag', &