-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rhover.f90
1561 lines (1250 loc) · 39 KB
/
rhover.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
!
! rhOver - a FORTRAN program to determine magnetic anisotropy and related
! properties for dysprosium(III) single-ion magnets by semi-empirical approaches
! Copyright (C) 2014-2019 Michael Böhme <boehme.mic@gmail.com>
!
! Permission is hereby granted, free of charge, to any person obtaining a copy
! of this software and associated documentation files (the "Software"), to deal
! in the Software without restriction, including without limitation the rights
! to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
! copies of the Software, and to permit persons to whom the Software is
! furnished to do so, subject to the following conditions:
!
! The above copyright notice and this permission notice shall be included in all
! copies or substantial portions of the Software.
!
! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
! IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
! FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
! AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
! LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
! OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
! SOFTWARE.
!
module data_c
use global_c
implicit none
double precision :: EnergyConv, AngConv
double precision :: MagDist
! 1 = single, 2 = screening, 3 = find min
integer :: JobType, nStep, MaxIter
double precision :: incStep
double precision :: cStates(8)
double precision :: MagX, MagY, MagZ, fMRotX, fMRotY
double precision :: rho
double precision :: MagVecDev
! rotation
double precision :: fRotA, fRotB, fRotG
double precision :: minRotX, minRotY, minValue
double precision :: maxRotX, maxRotY, maxValue
double precision :: minScanX, maxScanX, minScanY, maxScanY, minScanZ, maxScanZ, incScanX, incScanY, incScanZ
character (len=sMaxBuffer) :: sLine, InpFile, SepLine, TRJFilename
end module
subroutine print_jobinfo
use data_c
use data_mo
#ifdef _OPENMP
use omp_lib
#endif
implicit none
!
write(*,*) "> JOB INFO:"
write(*,*)
write(*,'(A35,A)') "title: ", trim(JobTitle)
call Hostnm(SHostname)
write(*,'(A35,A)') "host name: ", trim(SHostname)
call GetCWD(SWorkDir)
write(*,'(A35,A)') "working directory: ", trim(SWorkDir)
write(*,'(A35)', advance='no') "type of job: "
select case ( JobType )
case ( 1 )
write(*,'(A)') "Single-Point"
case ( 2 )
write(*,'(A)') "SCAN"
case ( 3 )
write(*,'(A)') "OPT"
case ( 4 )
write(*,'(A)') "SCANOPT"
case ( 5 )
write(*,'(A)') "LINSCAN"
case default
write(*,'(A)') "unknown"
end select
if ( JobType .eq. 4 ) then
write(*,'(A35)',advance='no') "mixed ESC/LFT mode: "
call write_option_bool(OMixedMode)
end if
#ifdef _OPENMP
write(*,'(A35,I14)') "parallel OpenMP threads: ", omp_get_max_threads()
#endif
write(*,*)
if ( CAtomID .eq. 0 ) then
write(*,'(A35,F14.8,F14.8,F14.8)') "Dy(III) ion is located at (a.u.): ", EDyX, EDyY, EDyZ
write(*,'(A35,F14.8,F14.8,F14.8)') "(angstrom): ", EDyX*au2pm, EDyY*au2pm, EDyZ*au2pm
else
write(*,'(A35,I14)') "Dy(III) ion has atom id: ", CAtomID
end if
write(*,*)
write(*,'(A35,A8,I2,A)') "m_J state: ", " | +/- ", int(15-(mJ-1)*2) , "/2 >"
write(*,*)
write(*,'(A35)', advance='no') "4f radial wave function: "
select case ( iRadWF )
case ( 1 )
write(*,'(A)') "ANO-RCC-based 4f basis set for Dy(0)"
write(*,'(35X,A)') "as published in the original rhOver article:"
write(*,'(35X,A)') "M. Böhme, W. Plass, J. Comput. Chem., 2018, 39, 2697--2712"
case ( 2 )
write(*,'(A)') "4f radial wave function for Dy(III)"
write(*,'(35X,A)') "as published in:"
write(*,'(35X,A)') "A.J. Freeman, R.E. Watson, Phys. Rev., 1962, 127, 2058--2075"
case ( 3 )
write(*,'(A)') "4f radial wave function for Dy(III)"
write(*,'(35X,A)') "CASSCF/DKH2/ANO-RCC-based"
write(*,'(35X,A)') "M. Böhme, 2019, unpublished"
case default
write(*,'(A)') "unknown"
end select
write(*,*)
if ( OMagVec .eqv. .TRUE. ) then
write(*,'(A35,3F14.8)') "reference axis: ", MagX, MagY, MagZ
end if
write(*,*)
write(*,*)
end subroutine
!---------------------------------------------------
! write_xyz_file
! generates structure file with the anisotropy axis (two He atoms)
!---------------------------------------------------
subroutine write_xyz_file(rotx, roty, trj, val)
use data_c
use data_mo
use data_grid
implicit none
double precision, intent(in) :: rotx, roty
logical, intent(in) :: trj
double precision, intent(in) :: val
double precision :: RDyX, RDyY, RDyZ ! rotated coordinates
integer :: i, iost
character (len=sMaxBuffer) :: sBuffer
if ( trj .eqv. .FALSE. ) then
write(*,*)
write(*,*)
write(*,*) "> GENERATING STRUCTURE WITH QUANTIZATION AXIS ..."
write(*,*)
write(*,'(5X,A)') "writing XYZ file '" // trim(XFilenameMin) // "' ..."
open(unit=uXYZ, file=XFilenameMin,action='write', status='replace',form='formatted')
else
open(unit=uXYZ, file=TRJFilename,action='write', status='old', form='formatted', position='append',iostat=iost)
if ( iost .ne. 0 ) then
open(unit=uXYZ, file=TRJFilename,action='write', status='new', form='formatted')
end if
end if
! file header
if ( OPCM .eqv. .FALSE. ) then
write(sBuffer, '(I8)') NA + 3
else
write(sBuffer, '(I8)') NCustomCharges + 3
end if
write(uXYZ, '(A)') trim(adjustl(sBuffer))
if ( trj .eqv. .FALSE. ) then
write(uXYZ, '(A/)', advance='no') "Generated with rhOver - (C) 2018 by Michael Böhme"
else
write(uXYZ, '(A,F12.6/)', advance='no') "Overlap ", val
end if
! Dy(III)
write(uXYZ,'(A,3F12.6)') adjustl(trim("Dy")), EDyX*au2pm, EDyY*au2pm, EDyZ*au2pm
! add two He atoms to mark the main magnetic anisotropy axis
call rotate_euler_3d(rotx, roty, 0d0, 0d0, 0d0, 0d0 + MagDist, RDyX, RDyY, RDyZ)
write(uXYZ,'(A,3F12.6)') adjustl(trim("Xx")), (EDyX+RDyX)*au2pm, (EDyY+RDyY)*au2pm, (EDyZ+RDyZ)*au2pm
write(uXYZ,'(A,3F12.6)') adjustl(trim("Xx")), (EDyX-RDyX)*au2pm, (EDyY-RDyY)*au2pm, (EDyZ-RDyZ)*au2pm
! other atoms
if ( OPCM .eqv. .FALSE. ) then
do i = 1, NA
if ( Atoms(i)%ghost .eqv. .FALSE. ) then
call get_Element_by_Charge(Atoms(i)%charge, sBuffer)
else
call get_Element_by_Charge(0, sBuffer)
end if
RDyX = Atoms(i)%x-EDyX
RDyY = Atoms(i)%y-EDyY
RDyZ = Atoms(i)%z-EDyZ
write(uXYZ,'(A,3F16.8)') adjustl(trim(sBuffer)), (RDyX+EDyX)*au2pm, (RDyY+EDyY)*au2pm, (RDyZ+EDyZ)*au2pm
end do
else
do i = 1, NCustomCharges
RDyX = PointCharges(i)%x-EDyX
RDyY = PointCharges(i)%y-EDyY
RDyZ = PointCharges(i)%z-EDyZ
write(uXYZ,'(A,3F16.8)') adjustl(trim("Xx")), (RDyX+EDyX)*au2pm, (RDyY+EDyY)*au2pm, (RDyZ+EDyZ)*au2pm
end do
end if
close(uXYZ)
if ( trj .eqv. .FALSE. ) then
call write_done
end if
end subroutine
subroutine parse_input_file(filename)
use data_c
use data_mo
use data_grid
#ifdef _OPENMP
use omp_lib
#endif
implicit none
!
character (len=sMaxBuffer), intent(in) :: filename
integer :: iost, i = 0, j
logical :: EOF = .FALSE.
logical :: FMagicStr = .FALSE.
logical :: FMOFile = .FALSE.
logical :: FCoord = .FALSE.
logical :: FLinScan = .FALSE.
double precision :: tempVal, tempValX, tempValY, tempValZ
character (len=sMaxBuffer) :: to_upper
!
write(*,'(/X,A,A,A/)', advance='no') "PARSING INPUT FILE '", trim(filename), "' ..."
open(unit=uInp, file=filename, action='read',status='old', iostat=iost)
if ( iost .ne. 0 ) then
write(*,*) "ERROR! Can't read input file!"
stop
end if
do while ( EOF .eqv. .FALSE. )
i = i + 1
read(uInp, '(A255)', iostat=iost) sLine
sLine = trim(adjustl(sLine))
if ( iost .lt. 0 ) then
EOF = .TRUE.
end if
! skip empty lines
if ( len_trim(sLine) .ne. 0 ) then
sLine = to_upper(sLine)
! parse input strings
if ( ( sLine(1:1) == "*" ) .OR. ( sLine(1:1) == "!" ) .OR. ( sLine(1:1) == "#" ) ) then
! comment, do nothing
else if ( sLine == "RHOVER" ) then
FMagicStr = .TRUE.
else if ( sLine == "TITLE" ) then
i = i + 1
read(uInp, '(A)', iostat=iost) sLine
JobTitle = trim(adjustl(sLine))
else if ( sLine == "JOB" ) then
i = i + 1
read(uInp, '(A)', iostat=iost) sLine
sLine = trim(adjustl(to_upper(sLine)))
if ( sLine == "SCANOPT" ) then
JobType = 4
else if ( sLine == "OPT" ) then
JobType = 3
else if ( sLine == "SCAN" ) then
JobType = 2
else if ( sLine == "SP" ) then
JobType = 1
else if ( sLine == "LINSCAN" ) then
JobType = 5
else
write(*,*) "ERROR! Unknown job type!"
stop
end if
else if ( sLine == "MAXITER" ) then
i = i + 1
read(uInp, *, iostat=iost) MaxIter
if ( MaxIter .lt. 1 ) then
write(*,*) "ERROR! MaxIter value is invalid!"
stop
end if
else if ( sLine == "MOFILE" ) then
i = i + 1
read(uInp, '(A)', iostat=iost) sLine
MOFile = trim(adjustl(sLine))
FMOFile = .TRUE.
else if ( sLine == "DYIII" ) then
i = i + 1
read(uInp, '(A)', iostat=iost) sLine
sLine = trim(adjustl(sLine))
read(sLine, *) EDyX, EDyY, EDyZ
FCoord = .TRUE.
else if ( sLine == "PRINTBASIS" ) then
OPrintBasis = .TRUE.
else if ( sLine == "MULLIKEN" ) then
OPrintMulliken = .TRUE.
else if ( ( sLine == "LDAX" ) .or. ( sLine == "SLATERX" ) ) then
OLDAX = .TRUE.
else if ( ( sLine == "NOLFT" ) .or. ( sLine == "NOCFT" ) ) then
OIESMode = .TRUE.
OMixedMode = .FALSE.
OMax = .FALSE.
else if ( ( sLine == "LFTONLY" ) .or. ( sLine == "CFTONLY" ) ) then
OIESMode = .FALSE.
OMixedMode = .FALSE.
OMax = .TRUE.
else if ( sLine == "ATOMID" ) then
i = i + 1
read(uInp, *) CAtomID
if ( ( CAtomID .lt. 1 ) .OR. ( CAtomID .gt. iMaxAtoms ) ) then
write(*,*) "ERROR! Invalid atom id specified!"
stop
end if
else if ( sLine == "REFERENCE" ) then
i = i + 1
read(uInp, '(A)', iostat=iost) sLine
sLine = trim(adjustl(sLine))
read(sLine, *) MagX, MagY, MagZ
OMagVec = .TRUE.
fMRotX = dasin( MagY )
fMRotY = dasin( - MagX / dcos(fMRotX) )
if ( fMRotX .lt. 0.0d0 ) then
fMRotX = fMRotX + pi
end if
else if ( sLine == "RADIALWF" ) then
i = i + 1
read(uInp, *, iostat=iost) iRadWF
if ( ( nGrid .lt. 1 ) .OR. ( nGrid .gt. 3 ) ) then
write(*,*) "ERROR! Invalid value for 'RADIALWF'!"
stop
end if
else if ( sLine == "SETROT" ) then
i = i + 1
read(uInp, '(A)', iostat=iost) sLine
sLine = trim(adjustl(sLine))
read(sLine, *) fRotA, fRotB
fRotA = fRotA * pi/180d0
fRotB = fRotB * pi/180d0
fRotB = 0d0
else if ( sLine == "SETROT3D" ) then
i = i + 1
read(uInp, '(A)', iostat=iost) sLine
sLine = trim(adjustl(sLine))
read(sLine, *) fRotA, fRotB, fRotG
fRotA = fRotA * pi/180d0
fRotB = fRotB * pi/180d0
fRotG = fRotG * pi/180d0
else if ( sLine == "DANGLE" ) then
i = i + 1
read(uInp, *, iostat=iost) incStep
if ( ( incStep .lt. 0.001 ) .OR. ( incStep .gt. 180.0 ) ) then
write(*,*) "ERROR! DANGLE option is invalid!"
stop
end if
incStep = incStep * 2.0 * pi / 360.0
else if ( sLine == "GRID" ) then
i = i + 1
read(uInp, *, iostat=iost) nGrid
if ( ( nGrid .lt. 1 ) .OR. ( nGrid .gt. 5 ) ) then
write(*,*) "ERROR! Invalid value for 'GRID'!"
stop
end if
else if ( sLine == "SAVEGRIDPOINTS" ) then
OExportGPs = .TRUE.
else if ( sLine == "LFTCUTOFF" ) then
i = i + 1
read(uInp, *, iostat=iost) LFTCutOff_O
if ( LFTCutOff_O .le. LFTCutOff_I ) then
write(*,*) "ERROR! Invalid value for 'LFTCUTOFF'!"
stop
end if
else if ( sLine == "PARA" ) then
#ifdef _OPENMP
i = i + 1
read(uInp, *, iostat=iost) omp_man_threads
if ( omp_man_threads .lt. 1 ) then
write(*,*) "ERROR! Invalid value for 'PARA'!"
stop
end if
#else
write(*,*) "ERROR! Keyword 'PARA' is not available in serial mode!"
stop
#endif
else if ( sLine == "SCANRANGE" ) then
i = i + 1
read(uInp, '(A)', iostat=iost) sLine
sLine = trim(adjustl(sLine))
read(sLine, *) minScanX, minScanY, maxScanX, maxScanY
if ( minScanX .gt. maxScanX ) then
tempVal = maxScanX
maxScanX = minScanX
minScanX = tempVal
end if
if ( minScanY .gt. maxScanY ) then
tempVal = maxScanY
maxScanY = minScanY
minScanY = tempVal
end if
else if ( sLine == "LINSCANRANGE" ) then
i = i + 1
read(uInp, '(A)', iostat=iost) sLine
sLine = trim(adjustl(sLine))
read(sLine, *) LinScanS, LinScanX1, LinScanY1, LinScanX2, LinScanY2
if ( LinScanS .lt. 2 ) then
write(*,*) "ERROR! Number of points is invalid!"
stop
end if
LinScanDX = (LinScanX2-LinScanX1) / (LinScanS-1)
LinScanDY = (LinScanY2-LinScanY1) / (LinScanS-1)
FLinScan = .TRUE.
else if ( sLine == "SCANINC" ) then
i = i + 1
read(uInp, '(A)', iostat=iost) sLine
sLine = trim(adjustl(sLine))
read(sLine, *) incScanX, incScanY
if ( incScanX .lt. 0.0 ) then
incScanX = - incScanX
end if
if ( incScanY .lt. 0.0 ) then
incScanY = - incScanY
end if
if ( ( incScanX .eq. 0.0 ) .OR. ( incScanY .eq. 0.0 ) ) then
write(*,*) "ERROR! Value of SCANINC is invalid!"
stop
end if
else if ( sLine == "NOGRIDPRUNING" ) then
OPruning = .FALSE.
else if ( sLine == "GRIDPRUNING" ) then
OPruning = .TRUE.
else if ( sLine == "NORANDOMROT" ) then
ORandRot = .FALSE.
else if ( sLine == "RANDOMROT" ) then
ORandRot = .TRUE.
else if ( sLine == "EXPERT" ) then
OExpert = .TRUE.
else if ( sLine == "TURBOMOLE" ) then
OTurbomole = .TRUE.
else if ( sLine == "NOTURBOMOLE" ) then
OTurbomole = .FALSE.
OFNoTurbomole = .TRUE.
else if ( sLine == "NODEPPFILE" ) then
ONoDEPPFile = .TRUE.
else if ( sLine == "NOSHIELDING" ) then
OSternheimer = .FALSE.
else if ( sLine == "SHIELDING" ) then
OSternheimer = .TRUE.
else if ( sLine == "PCM" ) then
i = i + 1
if ( OPCM .eqv. .TRUE. ) then
write(*,*) "ERROR! Point charges were already defined!"
stop
end if
OPCM = .TRUE.
read(uInp, *, iostat=iost) NCustomCharges
if ( ( NCustomCharges .lt. 1 ) .or. ( NCustomCharges .gt. iMaxAtoms ) ) then
write(*,*) "ERROR! Too many charges (PCM)!"
stop
end if
allocate(PointCharges(NCustomCharges))
do j = 1, NCustomCharges
i = i + 1
read(uInp,*, iostat=iost) tempValX, tempValY, tempValZ, tempVal
PointCharges(j)%id = j
PointCharges(j)%x = tempValX
PointCharges(j)%y = tempValY
PointCharges(j)%z = tempValZ
PointCharges(j)%Charge = tempVal
end do
else if ( sLine == "SCALING" ) then
i = i + 1
i = i + 1
read(uInp,*, iostat=iost) LFPScalingFactors(2), LFPScalingFactors(4), LFPScalingFactors(6)
else if ( sLine == "MJ" ) then
i = i + 1
read(uInp, *, iostat=iost) mJ
if ( ( mJ .lt. 1 ) .OR. ( mJ .gt. 8 ) ) then
write(*,*) "ERROR! mJ value is invalid!"
stop
end if
else if ( sLine == "MAXGP" ) then
i = i + 1
read(uInp, *, iostat=iost) NGP
if ( ( NGP .lt. 1000 ) .or. ( NGP .gt. 10000000 ) ) then
write(*,*) "ERROR! MaxGP value is invalid!"
stop
end if
else if ( sLine == "TRJFILE" ) then
i = i + 1
read(uInp, '(A)', iostat=iost) sLine
TRJFilename = trim(adjustl(sLine))
OTraj = .TRUE.
else if ( sLine == "OLFILE" ) then
i = i + 1
read(uInp, '(A)', iostat=iost) sLine
OLFile = trim(adjustl(sLine))
OGenPotE = .TRUE.
else if ( sLine == "ANGSTROM" ) then
OAngstrom = .TRUE.
else if ( sLine == "DELETE4F" ) then
ODelete4f = .TRUE.
else if ( sLine == "DELETEALL" ) then
ODeleteAll = .TRUE.
else if ( sLine == "NOXYZ" ) then
OGenXYZ = .FALSE.
else if ( sLine == "VERBOSE" ) then
OVerbose = .TRUE.
else if ( sLine == "END" ) then
EOF = .TRUE.
else
write(*,*)
write(*,'(X,A,A,A,I4,A)') "ERROR! Unknown keyword '",trim(sLine),"' found on line ", i, " !"
stop
end if
end if
if ( iost .lt. 0 ) then
EOF = .TRUE.
end if
end do
close(uINP)
XFilenameMin = trim(adjustl(InpFile))//".xyz"
OLFile = trim(adjustl(InpFile))//".dat"
DEPPFile = trim(adjustl(InpFile))//".depp"
GPFile = trim(adjustl(InpFile))//".grid.dat"
! convert angstrom to a.u.
if ( OAngstrom .eqv. .TRUE. ) then
EDyX = EDyX / au2pm
EDyY = EDyY / au2pm
EDyZ = EDyZ / au2pm
if ( OPCM .eqv. .TRUE. ) then
do i = 1, NCustomCharges
PointCharges(i)%x = PointCharges(i)%x / au2pm
PointCharges(i)%y = PointCharges(i)%y / au2pm
PointCharges(i)%z = PointCharges(i)%z / au2pm
end do
end if
OAngstrom = .FALSE.
end if
! prepare point charges, if necessary
if ( OPCM .eqv. .TRUE. ) then
do i = 1, NCustomCharges
PointCharges(i)%x = PointCharges(i)%x - EDyX
PointCharges(i)%y = PointCharges(i)%y - EDyY
PointCharges(i)%z = PointCharges(i)%z - EDyZ
PointCharges(i)%dist = dsqrt(PointCharges(i)%x**2 + PointCharges(i)%y**2 + PointCharges(i)%z**2)
write(*,'(5X,I3,5F18.8)') i, PointCharges(i)%x, PointCharges(i)%y, PointCharges(i)%z, PointCharges(i)%dist, PointCharges(i)%Charge
end do
end if
if ( FMagicStr .eqv. .FALSE. ) then
write(*,*) "ERROR! Input file is invalid! (KEYWORD 'RHOVER' IS MISSING!)"
stop
else if ( ( FMOFile .eqv. .FALSE. ) .AND. ( OPCM .eqv. .FALSE. ) ) then
write(*,*) "ERROR! Neither MOFile nor PCM keyword not found!"
stop
else if ( ( OLDAX .eqv. .TRUE. ) .AND. ( OPCM .eqv. .TRUE. ) ) then
write(*,*) "ERROR! Keywords 'LDAX' and 'PCM' are incompatible!"
stop
else if ( ( FMOFile .eqv. .TRUE. ) .AND. ( OPCM .eqv. .TRUE. ) ) then
write(*,*) "ERROR! Keywords 'MOFile' and 'PCM' are incompatible!"
stop
else if ( ( FCoord .eqv. .FALSE. ) .AND. ( CAtomID .eq. 0 ) ) then
write(*,*) "ERROR! Neither DyIII nor AtomID keyword found!"
stop
else if ( ( JobType .eq. 5 ) .and. ( FLinScan .eqv. .FALSE. ) ) then
write(*,*) "ERROR! LINSCAN mode activated, but no parameters specified!"
stop
end if
#ifdef _OPENMP
if ( omp_man_threads .gt. 0 ) then
call omp_set_num_threads(omp_man_threads)
end if
#endif
call write_done
write(*,*)
end subroutine
subroutine set_default_values
use data_c
use data_mo
use global_c
#ifdef _OPENMP
use omp_lib
#endif
implicit none
!
! default values for OPT
incStep = 10d0 * pi / 180d0
fRotA = 90d0 * pi / 180d0
fRotB = 90d0 * pi / 180d0
fRotG = 90d0 * pi / 180d0
EnergyConv = 1.0E-03
AngConv = 5.0E-02
MaxIter = 999
! default values for SCAN
minScanX = 0d0
minScanY = -90d0
minScanZ = 0d0
maxScanX = 180d0
maxScanY = 90d0
maxScanZ = 360d0
incScanX = 10d0
incScanY = 10d0
incScanZ = 10d0
! misc
minValue = 1.0E+09
minRotX = 0d0
minRotY = 0d0
maxValue =-1.0E+09
maxRotX = 0d0
maxRotY = 0d0
MagDist = 5d0
JobType = 4
NLigRadShells = 55
NGP = 100000
nGrid = 3
MaxKRank = 6
iRadWF = 1
LFPScalingFactors = 0d0
LFPScalingFactors(2) = 1d0
LFPScalingFactors(4) = 1d0
LFPScalingFactors(6) = 1d0
OVerbose = .FALSE.
OMagVec = .FALSE.
OAngstrom = .FALSE.
OMax = .FALSE.
OTraj = .FALSE.
OGenPotE = .TRUE.
OGenXYZ = .TRUE.
OPruning = .TRUE.
ORandRot = .FALSE.
ONoDEPPFile = .FALSE.
OPrintBasis = .FALSE.
OPrintMulliken= .FALSE.
OIESMode = .TRUE.
ODelete4f = .FALSE.
OExpert = .FALSE.
OSkipMom = .TRUE.
OLDAX = .FALSE.
OMixedMode = .TRUE.
OPCM = .FALSE.
OSternheimer = .FALSE.
OExportGPs = .FALSE.
OTurbomole = .FALSE.
OFNoTurbomole = .FALSE.
#ifdef _OPENMP
omp_threads = omp_get_max_threads()
omp_man_threads = 0
#endif
end subroutine
subroutine do_scan
use data_c
use data_mo
use data_grid
implicit none
!
double precision :: angX, angY, angZ
double precision :: rhoVal, incScanZOld
!
angX = minScanX
angY = minScanY
angZ = minScanZ
minScanZ = 0d0
incScanZOld = incScanZ
incScanZ = 360d0
maxScanZ = 360d0
write(*,'(/X,A/)') "PERFORMING SCAN OF EULER ANGLES ALPHA AND BETA ..."
write(*,'(A33,A/)') "energies determined by: ", "electrostatic calculation"
write(*,'(A33,F7.2,A,F7.2,A,F6.2,A)') "alpha scan range: ", minScanX, " deg -- ", maxScanX, " deg (inc. ", incScanX, " deg)"
write(*,'(A33,F7.2,A,F7.2,A,F6.2,A)') " beta scan range: ", minScanY, " deg -- ", maxScanY, " deg (inc. ", incScanY, " deg)"
write(*,*)
if ( OGenPotE .eqv. .TRUE. ) then
open(unit=uEner, file=OLFile, action='write',status='replace')
end if
if ( OIESMode .eqv. .FALSE. ) then
call write_rline(51)
write(*,"(30X,2A12,A25)") "alpha", "beta", "m_J contribution"
write(*,"(30X,2A12,A25)") "/ degree", "/ degree", " "
call write_rline(51)
else
call write_rline(51)
write(*,"(30X,2A12,A25)") "alpha", "beta", "relative energy"
write(*,"(30X,2A12,A25)") "/ degree", "/ degree", "/ a.u."
call write_rline(51)
end if
do while ( angX .le. maxScanX )
fRotA = angX * pi / 180d0
if ( angX .ne. minScanX ) then
write(*,*)
end if
do while ( angY .le. maxScanY )
fRotB = angY * pi / 180d0
do while ( angZ .lt. maxScanZ )
fRotG = angZ * pi / 180d0
if ( OIESMode .eqv. .FALSE. ) then
call calc_cf_energy(fRotA, fRotB, fRotG, rhoVal)
write(*,"(30X,2F12.2,F25.8)") angX, angY, rhoVal
else
call cpot_calc_energy(fRotA, fRotB, 0d0, rhoVal)
write(*,"(30X,2F12.2,F25.8)") angX, angY, rhoVal
end if
if ( OTraj .eqv. .TRUE. ) then
call write_xyz_file(fRotA, fRotB, .TRUE., rhoVal)
end if
if ( rhoVal .lt. minValue ) then
minValue = rhoVal
minRotX = fRotA
minRotY = fRotB
end if
if ( rhoVal .gt. maxValue ) then
maxValue = rhoVal
maxRotX = fRotA
maxRotY = fRotB
end if
if ( OGenPotE .eqv. .TRUE. ) then
if ( OIESMode .eqv. .FALSE. ) then
write(uEner,"(3X,2F8.2,3F18.10)") angX, angY, rhoVal
else
write(uEner,"(3X,2F8.2,F18.10)") angX, angY, rhoVal
end if
end if
angZ = angZ + incScanZ
end do
angY = angY + incScanY
angZ = minScanZ
end do
if ( OGenPotE .eqv. .TRUE. ) then
write(uEner,*)
end if
angX = angX + incScanX
angY = minScanY
end do
if ( OIESMode .eqv. .FALSE. ) then
call write_rline(63)
else
call write_rline(51)
incScanZ = incScanZOld
end if
write(*,'(/5X,A)') " > energetic minimum:"
if ( OIESMode .eqv. .FALSE. ) then
write(*,'(/A35,F16.8/)') " KD1 |+/-15/2> contribution = ", maxValue
write(*,'(A35,F10.2,A)') " alpha = ", maxRotX/pi*180d0, " degree"
write(*,'(A35,F10.2,A)') " beta = ", maxRotY/pi*180d0, " degree"
else
write(*,'(/A35,F16.8,A/)') " relative energy = ", minValue, " a.u."
write(*,'(A35,F10.2,A)') " alpha = ", minRotX/pi*180d0, " degree"
write(*,'(A35,F10.2,A)') " beta = ", minRotY/pi*180d0, " degree"
end if
write(*,*)
if ( OGenPotE .eqv. .TRUE. ) then
close(uEner)
end if
end subroutine
subroutine do_scan_ab
use data_c
use data_mo
use data_grid
implicit none
!
double precision :: angX, angY, angZ
double precision :: rhoVal, incScanZOld
!
angX = minScanX
angY = minScanY
angZ = minScanZ
write(*,'(/X,A/)') "PERFORMING SCAN OF EULER ANGLES ALPHA AND BETA ..."
if ( OIESMode .eqv. .TRUE. ) then
write(*,'(A33,A/)') "energies determined by: ", "electrostatic calculation"
else
write(*,'(A33,A/)') "energies determined by: ", "crystal-field theory"
end if
write(*,'(A33,F7.2,A,F7.2,A,F6.2,A)') "alpha scan range: ", minScanX, " deg -- ", maxScanX, " deg (inc. ", incScanX, " deg)"
write(*,'(A33,F7.2,A,F7.2,A,F6.2,A)') " beta scan range: ", minScanY, " deg -- ", maxScanY, " deg (inc. ", incScanY, " deg)"
write(*,*)
if ( OGenPotE .eqv. .TRUE. ) then
open(unit=uEner, file=OLFile, action='write',status='replace')
end if
call write_rline(63)
write(*,"(18X,3A12,A25)") "alpha", "beta", "gamma", "relative energy"
write(*,"(18X,3A12,A25)") "/ degree", "/ degree", "/ degree", "/ cm-1"
call write_rline(63)
do while ( angX .lt. maxScanX )
fRotA = angX * pi / 180d0
if ( angX .ne. minScanX ) then
write(*,*)
end if
do while ( angY .le. maxScanY )
fRotB = angY * pi / 180d0
if ( OIESMode .eqv. .FALSE. ) then
call calc_cf_energy(fRotA, fRotB, fRotG, rhoVal)
write(*,"(18X,3F12.2,F25.8)") angX, angY, angZ, rhoVal
else
call cpot_calc_energy(fRotA, fRotB, fRotG, rhoVal)
write(*,"(30X,2F12.2,F25.8)") angX, angY, rhoVal
end if
if ( OTraj .eqv. .TRUE. ) then
call write_xyz_file(fRotA, fRotB, .TRUE., rhoVal)
end if
if ( rhoVal .lt. minValue ) then
minValue = rhoVal
minRotX = fRotA
minRotY = fRotB
end if
if ( rhoVal .gt. maxValue ) then
maxValue = rhoVal
maxRotX = fRotA
maxRotY = fRotB
end if
if ( OGenPotE .eqv. .TRUE. ) then
if ( OIESMode .eqv. .TRUE. ) then
write(uEner,"(3X,2F8.2,F18.10)") angX, angY, rhoVal
else
write(uEner,"(3X,3F8.2,F18.10)") angX, angY, angZ, rhoVal
end if
end if
angY = angY + incScanY
angZ = minScanZ
end do
if ( OGenPotE .eqv. .TRUE. ) then
write(uEner,*)
end if
angX = angX + incScanX
angY = minScanY
end do
if ( OIESMode .eqv. .FALSE. ) then
call write_rline(63)
else
call write_rline(51)
incScanZ = incScanZOld
end if
write(*,'(/5X,A)') " > energetic minimum:"
write(*,'(/A35,F16.8,A/)') " relative energy = ", minValue, " 1/cm"
write(*,'(A35,F10.2,A)') " alpha = ", minRotX/pi*180d0, " degree"