-
Notifications
You must be signed in to change notification settings - Fork 2
/
esp.f
1928 lines (1925 loc) · 57.8 KB
/
esp.f
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
SUBROUTINE ESP
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
INCLUDE 'SIZES'
C***********************************************************************
C
C THIS IS A DRIVER ROUTINE FOR ELECTROSTATIC POTENTIAL GENERATION
C WRITTEN BY K.M.MERZ FEB. 1989 AT UCSF
C
C***********************************************************************
COMMON /KEYWRD/ KEYWRD
CHARACTER*241 KEYWRD
C SET STANDARD PARAMETERS FOR THE SURFACE GENERATION
C
IF(INDEX(KEYWRD,'SCALE=') .NE. 0)THEN
SCALE = READA(KEYWRD,INDEX(KEYWRD,'SCALE='))
ELSE
SCALE = 1.4D0
ENDIF
C
IF(INDEX(KEYWRD,'DEN=') .NE. 0)THEN
DEN = READA(KEYWRD,INDEX(KEYWRD,'DEN='))
ELSE
DEN = 1.0D0
ENDIF
C
IF(INDEX(KEYWRD,'SCINCR=') .NE. 0)THEN
SCINCR = READA(KEYWRD,INDEX(KEYWRD,'SCINCR='))
ELSE
SCINCR = 0.20D0
ENDIF
C
IF(INDEX(KEYWRD,'NSURF=') .NE. 0)THEN
N = READA(KEYWRD,INDEX(KEYWRD,'NSURF='))
ELSE
N = 4
ENDIF
C
TIME1=SECOND()
C
C NOW CALCULATE THE SURFACE POINTS
C
IF(INDEX(KEYWRD,'WILLIAMS') .NE. 0) THEN
CALL PDGRID
ELSE
DO 10 I = 1,N
CALL SURFAC(SCALE,DEN,I)
SCALE = SCALE + SCINCR
10 CONTINUE
ENDIF
C
C NEXT CALCULATE THE ESP AT THE POINTS CALCULATED BY SURFAC
C
CALL POTCAL
C
C END OF CALCULATION
C
TIME1=SECOND()-TIME1
WRITE(6,20) 'TIME TO CALCULATE ESP:',TIME1,' SECONDS'
20 FORMAT(/9X,A,F8.2,A)
RETURN
END
SUBROUTINE PDGRID
C
C ROUTINE TO CALCULATE WILLIAMS SURFACE
C
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
INCLUDE 'SIZES'
DIMENSION IZ(100),XYZ(3,100),VDERW(53),DIST(100)
DIMENSION XMIN(3),XMAX(3),COORD(3,NUMATM)
COMMON /GEOM/ GEO(3,NUMATM)
COMMON /GEOKST/ NATOMS,LABELS(NUMATM), NABC(3*NUMATM)
C
COMMON /ABC/ CO(3,NUMATM),IAN(NUMATM),NATOM
COMMON /WORK1/ POTPT(3,MESP), WORK1D(4*MESP)
COMMON /POTESP/ XC,YC,ZC,ESPNUC,ESPELE,NESP
C
DATA VDERW/53*0.0D0/
VDERW(1)=2.4D0
VDERW(5)=3.0D0
VDERW(6)=2.9D0
VDERW(7)=2.7D0
VDERW(8)=2.6D0
VDERW(9)=2.55D0
VDERW(15)=3.1D0
VDERW(16)=3.05D0
VDERW(17)=3.0D0
VDERW(35)=3.15D0
VDERW(53)=3.35D0
SHELL=1.2D0
NESP=0
GRID=0.8D0
CLOSER=0.D0
C CHECK IF VDERW IS DEFINED FOR ALL ATOMS
C
C CONVERT INTERNAL TO CARTESIAN COORDINATES
C
CALL GMETRY(GEO,COORD)
C
C STRIP COORDINATES AND ATOM LABEL FOR DUMMIES (I.E. 99)
C
ICNTR = 0
DO 20 I=1,NATOMS
DO 10 J=1,3
10 CO(J,I) = COORD(J,I)
IF(LABELS(I) .EQ. 99) GOTO 20
ICNTR = ICNTR + 1
IAN(ICNTR) = LABELS(I)
20 CONTINUE
NATOM=ICNTR
C
DO 30 I=1,NATOM
J=IAN(I)
IF (VDERW(J).EQ.0.0D0) GO TO 40
30 CONTINUE
GO TO 50
40 CONTINUE
WRITE(6,*) 'VAN DER WAALS'' RADIUS NOT DEFINED FOR ATOM',I
WRITE(6,*) 'IN WILLIAMS SURFACE ROUTINE PDGRID!'
STOP
C NOW CREATE LIMITS FOR A BOX
50 DO 100 IX = 1,3
XMIN(IX)= 100000.0D0
XMAX(IX)=-100000.0D0
DO 90 IA = 1,NATOM
IF (CO(IX,IA)-XMIN(IX))60,70,70
60 XMIN(IX)=CO(IX,IA)
70 IF (CO(IX,IA)-XMAX(IX))90,90,80
80 XMAX(IX)=CO(IX,IA)
90 CONTINUE
100 CONTINUE
C ADD (OR SUBTRACT) THE MAXIMUM VDERW PLUS SHELL
VDMAX=0.0D0
DO 110 I=1,53
IF (VDERW(I).GT.VDMAX) VDMAX=VDERW(I)
110 CONTINUE
DO 120 I=1,3
XMIN(I)=XMIN(I)-VDMAX-SHELL
120 XMAX(I)=XMAX(I)+VDMAX+SHELL
C STEP GRID BACK FROM ZERO TO FIND STARTING POINTS
XSTART=0.0D0
130 XSTART=XSTART-GRID
IF (XSTART.GT.XMIN(1)) GO TO 130
YSTART=0.0D0
140 YSTART=YSTART-GRID
IF (YSTART.GT.XMIN(2)) GO TO 140
ZSTART=0.0D0
150 ZSTART=ZSTART-GRID
IF (ZSTART.GT.XMIN(3)) GO TO 150
NPNT=0
ZGRID=ZSTART
160 YGRID=YSTART
170 XGRID=XSTART
180 DO 190 L=1,NATOM
JZ=IAN(L)
DIST(L)=SQRT((CO(1,L)-XGRID)**2+(CO(2,L)-YGRID)**2+
1 (CO(3,L)-ZGRID)**2)
C REJECT GRID POINT IF ANY ATOM IS TOO CLOSE
IF(DIST(L).LT.(VDERW(JZ)-CLOSER)) GO TO 220
190 CONTINUE
C BUT AT LEAST ONE ATOM MUST BE CLOSE ENOUGH
DO 200 L=1,NATOM
JZ=IAN(L)
IF(DIST(L).GT.(VDERW(JZ)+SHELL)) GO TO 200
GO TO 210
200 CONTINUE
GO TO 220
210 NPNT=NPNT+1
NESP=NESP+1
POTPT(1,NESP)=XGRID
POTPT(2,NESP)=YGRID
POTPT(3,NESP)=ZGRID
220 XGRID=XGRID+GRID
IF (XGRID.LE.XMAX(1)) GO TO 180
YGRID=YGRID+GRID
IF (YGRID.LE.XMAX(2)) GO TO 170
ZGRID=ZGRID+GRID
IF (ZGRID.LE.XMAX(3)) GO TO 160
RETURN
END
C***********************************************************************
SUBROUTINE SURFAC(SCALE,DENS,IPT)
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
INCLUDE 'SIZES'
C***********************************************************************
C
C THIS SUBROUTINE CALCULATES THE MOLECULAR SURFACE OF A MOLECULE
C GIVEN THE COORDINATES OF ITS ATOMS. VAN DER WAALS' RADII FOR
C THE ATOMS AND THE PROBE RADIUS MUST ALSO BE SPECIFIED.
C
C ON INPUT SCALE = INITIAL VAN DER WAALS' SCALE FACTOR
C DENS = DENSITY OF POINTS PER UNIT AREA
C
C THIS SUBROUTINE WAS LIFTED FROM MICHAEL CONNOLLY'S SURFACE
C PROGRAM FOR UCSF GRAPHICS SYSTEM BY U.CHANDRA SINGH AND
C P.A.KOLLMAN AND MODIFIED FOR USE IN QUEST. K.M.MERZ
C ADAPTED AND CLEANED UP THIS PROGRAM FOR USE IN AMPAC/MOPAC
C IN FEB. 1989 AT UCSF.
C
C***********************************************************************
COMMON /GEOM/ GEO(3,NUMATM)
COMMON /GEOKST/ NATOMS,LABELS(NUMATM),
1 NA(NUMATM),NB(NUMATM),NC(NUMATM)
COMMON /KEYWRD/ KEYWRD
C
COMMON /ABC/ CO(3,NUMATM),IAN(NUMATM),NATOM
COMMON /WORK1/ POTPT(3,MESP), PAD1(2*MESP), RAD(MESP),
1IAS(MESP)
COMMON /POTESP/ XC,YC,ZC,ESPNUC,ESPELE,NESP
C
CHARACTER*241 KEYWRD
C
C CARTESIAN COORDINATE AND ATOM LABELS
C
DIMENSION COORD(3,NUMATM),VANDER(100)
DIMENSION CON(3,1000),ROT(3,3)
C
C NEIGHBOR ARRAYS
C
C THIS SAME DIMENSION FOR THE MAXIMUM NUMBER OF NEIGHBORS
C IS USED TO DIMENSION ARRAYS IN THE LOGICAL FUNCTION COLLID
C
DIMENSION INBR(200),CNBR(3,200),RNBR(200)
LOGICAL SNBR(200),MNBR(200)
C
C ARRAYS FOR ALL ATOMS
C
C IATOM, JATOM AND KATOM COORDINATES
C
DIMENSION CI(3), IELDAT(56), TEMP0(3)
C
C GEOMETRIC CONSTRUCTION VECTORS
C
DIMENSION CW(3,2)
C
C LOGICAL VARIABLES
C
LOGICAL SI
C
C LOGICAL FUNCTIONS
C
LOGICAL COLLID
C
C DATA FOR VANDER VALL RADII
C
CHARACTER MARKER*3, MARKSS*3, MYNAM*3, IELDAT*4, NAMATM*4
DATA VANDER/1.20D0,1.20D0,1.37D0,1.45D0,1.45D0,1.50D0,1.50D0,
1 1.40D0,1.35D0,1.30D0,1.57D0,1.36D0,1.24D0,1.17D0,
2 1.80D0,1.75D0,1.70D0,17*0.0D0,2.3D0,65*0.0D0/
DATA MARKER/'A '/,MARKSS/'SS0'/,MYNAM/'UC '/
C
DATA IELDAT/' BQ',' H ',' HE',' LI',' BE',' B ',
1 ' C ',' N ',' O ',' F ',' NE',' NA',
2 ' MG',' AL',' SI',' P ',' S ',' CL',
3 ' AR',' K ',' CA',' SC',' TI',' V ',
4 ' CR',' MN',' FE',' CO',' NI',' CU',
5 ' ZN',' GA',' GE',' AS',' SE',' BR',
6 ' KR',' RB',' SR',' Y',' ZR',' NB',
7 ' MO',' TC',' RU',' RH',' PD',' AG',
8 ' CD',' IN',' SN',' SB',' TE',' I',
9 ' X',' CS'/
PI=4.D0*ATAN(1.D0)
C INSERT VAN DER WAAL RADII FOR ZINC
VANDER(30)=1.00D0
C
C CONVERT INTERNAL TO CARTESIAN COORDINATES
C
CALL GMETRY(GEO,COORD)
C
C STRIP COORDINATES AND ATOM LABEL FOR DUMMIES (I.E. 99)
C
ICNTR = 0
DO 20 I=1,NATOMS
DO 10 J=1,3
10 CO(J,I) = COORD(J,I)
IF(LABELS(I) .EQ. 99) GOTO 20
ICNTR = ICNTR + 1
IAN(ICNTR) = LABELS(I)
20 CONTINUE
C
C ONLY VAN DER WAALS' TYPE SURFACE IS GENERATED
C
IOP = 1
RW =0.0D0
NATOM = ICNTR
DEN = DENS
DO 30 I=1,NATOM
IPOINT = IAN(I)
RAD(I) = VANDER(IPOINT)*SCALE
IF (RAD(I) .LT. 0.01D0) THEN
WRITE(6,'(T2,''VAN DER WAALS'''' RADIUS FOR ATOM '',I3,
1 '' IS ZERO, SUPPLY A VALUE IN SUBROUTINE SURFAC)''
2 )')
ENDIF
IAS(I) = 2
30 CONTINUE
C
C BIG LOOP FOR EACH ATOM
C
DO 110 IATOM = 1, NATOM
IF (IAS(IATOM) .EQ. 0) GO TO 110
C
C TRANSFER VALUES FROM LARGE ARRAYS TO IATOM VARIABLES
C
NAMATM =IELDAT(IAN(IATOM)+1)
RI = RAD(IATOM)
SI = IAS(IATOM) .EQ. 2
DO 40 K = 1,3
CI(K) = CO(K,IATOM)
40 CONTINUE
C
C GATHER THE NEIGHBORING ATOMS OF IATOM
C
NNBR = 0
DO 60 JATOM = 1, NATOM
IF (IATOM .EQ. JATOM .OR. IAS(JATOM) .EQ. 0) GO TO 60
D2 = DIST2(CI,CO(1,JATOM))
IF (D2 .GE. (2*RW+RI+RAD(JATOM)) ** 2) GO TO 60
C
C WE HAVE A NEW NEIGHBOR
C TRANSFER ATOM COORDINATES, RADIUS AND SURFACE REQUEST NUMBER
C
NNBR = NNBR + 1
IF (NNBR .GT. 200)THEN
WRITE (6,'(''ERROR'',2X,''TOO MANY NEIGHBORS:'',I5)')NNBR
STOP
ENDIF
INBR(NNBR) = JATOM
DO 50 K = 1,3
CNBR(K,NNBR) = CO(K,JATOM)
50 CONTINUE
RNBR(NNBR) = RAD(JATOM)
SNBR(NNBR) = IAS(JATOM) .EQ. 2
60 CONTINUE
C
C CONTACT SURFACE
C
IF (.NOT. SI) GO TO 110
NCON = (4 * PI * RI ** 2) * DEN
IF (NCON .GT. 1000) NCON = 1000
C
C THIS CALL MAY DECREASE NCON SOMEWHAT
C
IF ( NCON .EQ. 0) THEN
WRITE(6,'(T2,''VECTOR LENGTH OF ZERO IN SURFAC'')')
STOP
ENDIF
CALL GENUN(CON,NCON)
AREA = (4 * PI * RI ** 2) / NCON
C
C CONTACT PROBE PLACEMENT LOOP
C
DO 100 I = 1,NCON
DO 70 K = 1,3
CW(K,1) = CI(K) + (RI + RW) * CON(K,I)
70 CONTINUE
C
C CHECK FOR COLLISION WITH NEIGHBORING ATOMS
C
IF (COLLID(CW(1,1),RW,CNBR,RNBR,MNBR,NNBR,1,
1 JNBR,KNBR)) GO TO 100
DO 80 KK=1,3
TEMP0(KK) =CI(KK)+RI*CON(KK,I)
80 CONTINUE
C
C STORE POINT IN POTPT AND INCREMENT NESP
C
NESP = NESP + 1
IF (NESP .GT. MESP) THEN
WRITE(6,90)
90 FORMAT(/'ERROR - TO MANY POINTS GENERATED IN SURFAC')
WRITE(6,'('' REDUCE NSURF, SCALE, DEN, OR SCINCR'')')
STOP
ENDIF
POTPT(1,NESP) = TEMP0(1)
POTPT(2,NESP) = TEMP0(2)
POTPT(3,NESP) = TEMP0(3)
100 CONTINUE
110 CONTINUE
RETURN
END
C****************************************************************
FUNCTION DIST2(A,B)
C
C DETERMINE DISTANCES BETWEEN NEIGHBORING ATOMS
C
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
DIMENSION A(3)
DIMENSION B(3)
DIST2 = (A(1)-B(1))**2 + (A(2)-B(2))**2 + (A(3)-B(3))**2
RETURN
END
C****************************************************************
LOGICAL FUNCTION COLLID(CW,RW,CNBR,RNBR,MNBR,NNBR,ISHAPE,
1JNBR,KNBR)
C****************************************************************
C
C COLLISION CHECK OF PROBE WITH NEIGHBORING ATOMS
C USED BY SURFAC ONLY.
C
C****************************************************************
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
DIMENSION CW(3)
DIMENSION CNBR(3,200)
DIMENSION RNBR(200)
LOGICAL MNBR(200)
IF (NNBR .LE. 0) GO TO 20
C
C CHECK WHETHER PROBE IS TOO CLOSE TO ANY NEIGHBOR
C
DO 10 I = 1, NNBR
IF (ISHAPE .GT. 1 .AND. I .EQ. JNBR) GO TO 10
IF (ISHAPE .EQ. 3 .AND. (I .EQ. KNBR .OR. .NOT. MNBR(I)))
1 GO TO 10
SUMRAD = RW + RNBR(I)
VECT1 = DABS(CW(1) - CNBR(1,I))
IF (VECT1 .GE. SUMRAD) GO TO 10
VECT2 = DABS(CW(2) - CNBR(2,I))
IF (VECT2 .GE. SUMRAD) GO TO 10
VECT3 = DABS(CW(3) - CNBR(3,I))
IF (VECT3 .GE. SUMRAD) GO TO 10
SR2 = SUMRAD ** 2
DD2 = VECT1 ** 2 + VECT2 ** 2 + VECT3 ** 2
IF (DD2 .LT. SR2) GO TO 30
10 CONTINUE
20 CONTINUE
COLLID = .FALSE.
GO TO 40
30 CONTINUE
COLLID = .TRUE.
40 CONTINUE
RETURN
END
C****************************************************************
SUBROUTINE GENUN(U,N)
C****************************************************************
C
C GENERATE UNIT VECTORS OVER SPHERE. USED BY SURFAC ONLY.
C
C****************************************************************
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
DIMENSION U(3,N)
PI=4.D0*ATAN(1.D0)
NEQUAT = SQRT(N * PI)
NVERT = NEQUAT/2
NU = 0
DO 20 I = 1,NVERT+1
FI = (PI * (I-1)) / NVERT
Z = COS(FI)
XY = SIN(FI)
NHOR = NEQUAT * XY
IF (NHOR .LT. 1) NHOR = 1
DO 10 J = 1,NHOR
FJ = (2.D0 * PI * (J-1)) / NHOR
X = DCOS(FJ) * XY
Y = DSIN(FJ) * XY
IF (NU .GE. N) GO TO 30
NU = NU + 1
U(1,NU) = X
U(2,NU) = Y
U(3,NU) = Z
10 CONTINUE
20 CONTINUE
30 CONTINUE
N = NU
RETURN
END
C***********************************************************************
SUBROUTINE POTCAL
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
INCLUDE 'SIZES'
C***********************************************************************
C
C THIS SUBROUTINE CALCULATES THE TOTAL ELECTROSTATIC POTENTIAL
C THE NUCLEAR CONTRIBUTION IS EVALUATED BY NUCPOT
C THE ELECTRONIC CONTRIBUTION IS EVALUATED BY ELESP
C ESPFIT FITS THE QUANTUM POTENTIAL TO A CLASSICAL POINT CHARGE
C MODEL.
C THIS SUBROUTINE WAS WRITTEN BY B.H.BESLER AND K.M.MERZ IN FEB.
C 1989 AT UCSF
C
C***********************************************************************
COMMON /KEYWRD/ KEYWRD
COMMON /CORE/ TORE(107)
COMMON /ELEMTS/ ELEMNT(107)
COMMON /DENSTY/ P(MPACK),PA(MPACK),PB(MPACK)
COMMON /POTESP/ XC,YC,ZC,ESPNUC,ESPELE,NESP
COMMON /WORK1/ POTPT(3,MESP), ES(MESP), ESP(MESP), WORK1D(2*MESP)
COMMON /ABC/ CO(3,NUMATM),IAN(NUMATM),NATOM
COMMON /DIPSTO/ UX,UY,UZ,CH(NUMATM)
COMMON /ESPF/ AL((NUMATM+4)**2),A(NUMATM,NUMATM),B(NUMATM),
1Q(NUMATM+4),QSC(NUMATM+4),CF, ESPFD(MAXORB**2-NUMATM-5)
CHARACTER*241 KEYWRD
CHARACTER *2 ELEMNT
LOGICAL DEBUG,WRTESP,CEQUIV(NUMATM,NUMATM)
C
C DEBUG PRINTING - RESULTS IN COPIOUS OUTPUT
C
DEBUG = (INDEX(KEYWRD,'DEBUG') .NE. 0)
C
C
CALL ELESP
BOHR = 0.529167D00
C
C NOW FIT THE ELECTROSTATIC POTENTIAL
C
WRITE(6,'(//12X,''ELECTROSTATIC POTENTIAL CHARGES'',/)')
IZ=0
IF(INDEX(KEYWRD,'CHARGE=') .NE. 0) IZ=READA(KEYWRD,INDEX(KEYWRD,
1'CHARGE='))
C
C DIPOLAR CONSTRAINTS IF DESIRED
C
IF(INDEX(KEYWRD,'DIPOLE') .NE. 0) THEN
IDIP = 1
IF(IZ .NE. 0)THEN
IDIP = 0
WRITE(6,'(/12X,'' DIPOLE CONSTRAINTS NOT USED'')')
WRITE(6,'(12X,'' CHARGED MOLECULE'',/)')
ENDIF
ELSE
IDIP = 0
ENDIF
IF (IDIP .EQ. 1) THEN
WRITE(6,'(/12X,''DIPOLE CONSTRAINTS WILL BE USED'',/)')
ENDIF
C
C GET X,Y,Z DIPOLE COMPONENTS IF DESIRED
C
IF(INDEX(KEYWRD,'DIPX=') .NE. 0) THEN
DX = READA(KEYWRD,INDEX(KEYWRD,'DIPX='))
ELSE
DX = UX
ENDIF
IF(INDEX(KEYWRD,'DIPY=') .NE. 0) THEN
DY = READA(KEYWRD,INDEX(KEYWRD,'DIPY='))
ELSE
DY = UY
ENDIF
IF(INDEX(KEYWRD,'DIPZ=') .NE. 0) THEN
DZ = READA(KEYWRD,INDEX(KEYWRD,'DIPZ='))
ELSE
DZ = UZ
ENDIF
CALL ESPFIT(IDIP,NATOM,NESP,IZ,ESP,POTPT,CO,DX,DY,DZ,RMS,RRMS)
C
C WRITE OUT OUR RESULTS TO CHANNEL 6
C THE CHARGES ARE SCALED TO REPRODUCE 6-31G* CHARGES FOR MNDO ONLY
C AM1 AND MINDO/3 CHARGES ARE NOT SCALED DUE TO THE LOW COORELATION
C COEFFICIENT. SEE BESLER,MERZ,KOLLMAN IN J. COMPUT. CHEM.
C (IN PRESS)
C
IF((INDEX(KEYWRD,'AM1') .NE. 0) .OR.
1(INDEX(KEYWRD,'MINDO') .NE. 0) .OR.
2(INDEX(KEYWRD,'PM3') .NE. 0))THEN
WRITE(6,'(15X,''ATOM NO. TYPE CHARGE'')')
DO 10 I=1,NATOM
WRITE(6,'(17X,I2,9X,A2,1X,F10.4)')I,ELEMNT(IAN(I)),Q(I)
10 CONTINUE
ELSE
C
C MNDO CALCULATION-SCALE THE CHARGES. TEST FOR SLOPE KEYWORD
C
IF(INDEX(KEYWRD,'SLOPE=') .NE. 0) THEN
SLOPE = READA(KEYWRD,INDEX(KEYWRD,'SLOPE='))
ELSE
SLOPE = 1.422D0
ENDIF
DO 20 I=1,NATOM
QSC(I) = SLOPE*Q(I)
20 CONTINUE
WRITE(6,'(7X,''ATOM NO. TYPE CHARGE SCALED CHARGE'')')
DO 30 I=1,NATOM
WRITE(6,'(9X,I2,9X,A2,1X,F10.4,2X,F10.4)')I,ELEMNT(IAN(I
1)), Q(I),QSC(I)
30 CONTINUE
ENDIF
WRITE(6,'(/12X,A,4X,I6)') 'THE NUMBER OF POINTS IS:',NESP
WRITE(6,'(12X,A,4X,F9.4)') 'THE RMS DEVIATION IS:',RMS
WRITE(6,'(12X,A,3X,F9.4)') 'THE RRMS DEVIATION IS:',RRMS
C
C CALCULATE DIPOLE MOMENT IF NEUTRAL MOLECULE
C
IF (IZ .NE. 0) THEN
GO TO 60
ELSE
WRITE(6,40)
40 FORMAT (//5X,'DIPOLE MOMENT EVALUATED FROM '
1,'THE POINT CHARGES',/)
DO 50 I=1,NATOM
DIPX=DIPX+CO(1,I)*Q(I)/BOHR
DIPY=DIPY+CO(2,I)*Q(I)/BOHR
DIPZ=DIPZ+CO(3,I)*Q(I)/BOHR
50 CONTINUE
DIP=SQRT(DIPX**2+DIPY**2+DIPZ**2)
WRITE(6,'(12X,'' X Y Z TOTAL'')')
WRITE(6,'(8X,4F9.4)')DIPX*CF,DIPY*CF,DIPZ*CF,DIP*CF
ENDIF
60 CONTINUE
C DETERMINE WHICH CHARGES SHOULD BE EQUIVALENT BY SYMMETRY AND
C AVERAGE THEM IF DESIRED
IF(INDEX(KEYWRD,'SYMAVG') .NE. 0) THEN
DO 70 I=1,NATOM
DO 70 J=1,NATOM
CEQUIV(I,J)=.FALSE.
IF(ABS(ABS(CH(I))-ABS(CH(J))) .LT. 1.D-5) CEQUIV(I,J)=.T
1RUE.
70 CONTINUE
DO 90 I=1,NATOM
IEQ=0
QSC(I)=0.D0
DO 80 J=1,NATOM
IF(CEQUIV(I,J)) THEN
QSC(I)=QSC(I)+ABS(Q(J))
IEQ=IEQ+1
ENDIF
80 CONTINUE
CH(I)=Q(I)/ABS(Q(I))*QSC(I)/IEQ
90 CONTINUE
WRITE(6,*) ' '
WRITE(6,*)' ELECTROSTATIC POTENTIAL CHARGES AVERAGED FOR'
WRITE(6,*)' SYMMETRY EQUIVALENT ATOMS'
WRITE(6,*) ' '
IF((INDEX(KEYWRD,'AM1') .NE. 0) .OR.
1(INDEX(KEYWRD,'MINDO') .NE. 0) .OR.
2(INDEX(KEYWRD,'PM3') .NE. 0))THEN
WRITE(6,'(7X,''ATOM NO. TYPE CHARGE'')')
DO 100 I=1,NATOM
WRITE(6,'(9X,I2,9X,A2,1X,F10.4)')I,ELEMNT(IAN(I)),
1 CH(I)
100 CONTINUE
ELSE
WRITE(6,'(7X,''ATOM NO. TYPE CHARGE SCALED CHARGE'')
1')
DO 110 I=1,NATOM
WRITE(6,'(9X,I2,9X,A2,1X,F10.4,2X,F10.4)')I,ELEMNT(IA
1N(I)), CH(I),CH(I)*SLOPE
110 CONTINUE
ENDIF
ENDIF
RETURN
END
SUBROUTINE ELESP
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C***********************************************************************
C ELESP LOADS THE STO-6G BASIS SET ONTO THE ATOMS, PERFOMS THE
C DEORTHOGONALIZATION OF THE COEFFICIENTS AND EVALUATES THE
C ELECTRONIC CONTRIBUTION TO THE ESP. IT WAS WRITTEN BY B.H.BESLER
C AND K.M.MERZ IN FEB. 1989 AT UCSF.
C
C***********************************************************************
CHARACTER*241 KEYWRD
DOUBLE PRECISION NORM,OVL
LOGICAL CALLED,POTWRT,RST,STO3G
INCLUDE 'SIZES'
COMMON/ESPF/ AL((NUMATM+4)**2),A(NUMATM,NUMATM),B(NUMATM),
1Q(NUMATM+4),CESPM(MAXORB,MAXORB)
COMMON /DENSTY/ P(MPACK),PA(MPACK),PB(MPACK)
COMMON /POTESP/ XC,YC,ZC,ESPNUC,ESPELE,NESP
COMMON /ABC/ CO(3,NUMATM),IAN(NUMATM),NATOM
COMMON /WORK1/ POTPT(3,MESP), ES(MESP), ESP(MESP), WORK1D(2*MESP)
COMMON /STO6G/ ALLC(6,5,2),ALLZ(6,5,2)
COMMON /VECTOR/ C(MORB2*2+MAXORB*2)
COMMON /MOLKST/ NUMAT,NAT(NUMATM),NFIRST(NUMATM),NMIDLE(NUMATM),
1 NLAST(NUMATM), NORBS, NELECS,NALPHA,NBETA,
2 NCLOSE,NOPEN,NDUMY,FRACT
COMMON /KEYWRD/ KEYWRD
COMMON /ESPC/ CC(MAXPR),CEN(MAXPR,3),IAM(MAXPR,2),IND(MAXPR),
1 EX(MAXPR),ESPI(MAXORB,MAXORB),
2 FV(0:8,821),FAC(0:7),
3 DEX(-1:96),TF(0:2),TEMP(MAXPR),ITEMP(MAXPR),
4 OVL(MAXORB,MAXORB),FC(MAXPR*6)
6 /CORE / TORE(107)
7 /EXPONT/ ZS(107),ZP(107),ZD(107)
*
* END OF MINDO/3 COMMON BLOCKS
*
COMMON /INDX/ INDC(MAXORB)
DIMENSION CESPM2(MAXORB,MAXORB),SLA(10)
DIMENSION CESPML(MAXORB*MAXORB),CESP(MAXORB*MAXORB)
DATA BOHR/0.529167D0/
C aoyama added 1/2
CHARACTER INF*80 ,OUTF*80,RESF*80,DENF*80,LOGF*80,ARCF*80,
+ GPTF*80,SYBF*80,ERR0*80,ERR1*80
COMMON /DECKS/ INF,OUTF,RESF,DENF,LOGF,ARCF,GPTF,SYBF,ERR0,ERR1
integer ER1LEN
IF(len_trim(ERR1)==0) THEN
ERR1='FOR021'
ENDIF
ER1LEN=len_trim(ERR1)
C end aoyama added 1/2
PI=4.D0*ATAN(1.D0)
C
C PUT STO-6G BASIS SET ON ATOM CENTERS
C
DO 10 I=-1,10
DEX(I)=DEX2(I)
10 CONTINUE
DO 20 I=0,7
FAC(I)=1.D0/FAC(I)
20 CONTINUE
DO 30 M=0,8
K=1
FV(M,1)=1.D0/(2.D0*M+1.D0)
DO 30 T=0.05D0,41.D0,0.05D0
K=K+1
CALL FSUB(M,T,FVAL)
FV(M,K)=FVAL
30 CONTINUE
C
C LOAD BASIS FUNCTIONS INTO ARRAYS
C
STO3G=(INDEX(KEYWRD,'STO3G') .NE. 0)
IF(STO3G) THEN
ICD=3
CALL SETUP3
ELSE
ICD=6
CALL SETUPG
ENDIF
NC=0
NPR=0
DO 80 I=1,NATOM
IF (IAN(I) .LE. 2) THEN
DO 40 J=1,ICD
CC(NPR+J)=ALLC(J,1,1)
EX(NPR+J)=ALLZ(J,1,1)*ZS(1)**2
CEN(NPR+J,1)=CO(1,I)/BOHR
CEN(NPR+J,2)=CO(2,I)/BOHR
CEN(NPR+J,3)=CO(3,I)/BOHR
IAM(NPR+J,1)=0
IAM(NPR+J,2)=0
FC(NPR+J)=I
40 CONTINUE
NC=NC+1
NPR=NPR+ICD
ELSE
C DETERMINE PRINCIPAL QUANTUM NUMBER(NQN)
C OF ORBITALS TO BE USED
C
NQN=2
IF(IAN(I) .GT. 10 .AND. IAN(I) .LE. 18) NQN=3
IF(IAN(I) .GT. 18 .AND. IAN(I) .LE. 36) NQN=4
IF(IAN(I) .GT. 36 .AND. IAN(I) .LE. 54) NQN=5
C
DO 50 J=1,ICD
CC(NPR+J)=ALLC(J,NQN,1)
EX(NPR+J)=ALLZ(J,NQN,1)*ZS(IAN(I))**2
CEN(NPR+J,1)=CO(1,I)/BOHR
CEN(NPR+J,2)=CO(2,I)/BOHR
CEN(NPR+J,3)=CO(3,I)/BOHR
IAM(NPR+J,1)=0
IAM(NPR+J,2)=0
50 CONTINUE
NC=NC+1
NPR=NPR+ICD
DO 70 K=1,3
DO 60 J=1,ICD
CC(NPR+J)=ALLC(J,NQN,2)
EX(NPR+J)=ALLZ(J,NQN,2)*ZP(IAN(I))**2
CEN(NPR+J,1)=CO(1,I)/BOHR
CEN(NPR+J,2)=CO(2,I)/BOHR
CEN(NPR+J,3)=CO(3,I)/BOHR
IAM(NPR+J,1)=1
IAM(NPR+J,2)=K
60 CONTINUE
NC=NC+1
NPR=NPR+ICD
70 CONTINUE
ENDIF
80 CONTINUE
C
C CALCULATE NORMALIZATION CONSTANTS AND INCLUDE
C THEM IN THE CONTRACTION COEFFICIENTS
C
DO 90 I=1,NPR
NORM=(2.D0*EX(I)/PI)**0.75D0*(4.D0*EX(I))**(IAM(I,1)/2.D0)/
1 SQRT(DEX(2*IAM(I,1)-1))
CC(I)=CC(I)*NORM
90 CONTINUE
IPR=0
C
C PERFORM SORT OF PRIMITIVES BY ANGULAR MOMENTUM
C
IS=0
IP=0
IPC=0
ISC=0
J=0
DO 100 I=1,NPR
IF (IAM(I,1) .EQ. 0) THEN
IS=IS+1
IND(IS)=I
ENDIF
100 CONTINUE
IP=IS
DO 110 I=1,NPR
IF (IAM(I,1) .EQ. 1 .AND. IAM(I,2) .EQ. 1) THEN
IP=IP+1
IND(IP)=I
ENDIF
110 CONTINUE
DO 120 I=1,NPR
IF (IAM(I,1) .EQ. 1 .AND. IAM(I,2) .EQ. 2) THEN
IP=IP+1
IND(IP)=I
ENDIF
120 CONTINUE
DO 130 I=1,NPR
IF (IAM(I,1) .EQ. 1 .AND. IAM(I,2) .EQ. 3) THEN
IP=IP+1
IND(IP)=I
ENDIF
130 CONTINUE
DO 140 I=1,NC
IN=I*ICD-ICD+1
IF (IAM(IN,1) .EQ. 0) THEN
ISC=ISC+1
INDC(ISC)=I
ENDIF
140 CONTINUE
IPC=ISC
DO 150 I=1,NC
IN=I*ICD-ICD+1
IF (IAM(IN,1) .EQ. 1 .AND. IAM(IN,2) .EQ. 1) THEN
IPC=IPC+1
INDC(IPC)=I
ENDIF
150 CONTINUE
DO 160 I=1,NC
IN=I*ICD-ICD+1
IF (IAM(IN,1) .EQ. 1 .AND. IAM(IN,2) .EQ. 2) THEN
IPC=IPC+1
INDC(IPC)=I
ENDIF
160 CONTINUE
DO 170 I=1,NC
IN=I*ICD-ICD+1
IF (IAM(IN,1) .EQ. 1 .AND. IAM(IN,2) .EQ. 3) THEN
IPC=IPC+1
INDC(IPC)=I
ENDIF
170 CONTINUE
DO 180 I=1,NPR
TEMP(I)=CC(IND(I))
180 CONTINUE
DO 190 I=1,NPR
CC(I)=TEMP(I)
190 CONTINUE
DO 200 I=1,NPR
TEMP(I)=EX(IND(I))
200 CONTINUE
DO 210 I=1,NPR
EX(I)=TEMP(I)
210 CONTINUE
DO 220 I=1,NPR
TEMP(I)=CEN(IND(I),1)
220 CONTINUE
DO 230 I=1,NPR
CEN(I,1)=TEMP(I)
230 CONTINUE
DO 240 I=1,NPR
TEMP(I)=CEN(IND(I),2)
240 CONTINUE
DO 250 I=1,NPR
CEN(I,2)=TEMP(I)
250 CONTINUE
DO 260 I=1,NPR
TEMP(I)=CEN(IND(I),3)
260 CONTINUE
DO 270 I=1,NPR
CEN(I,3)=TEMP(I)
270 CONTINUE
DO 280 I=1,NPR
ITEMP(I)=IAM(IND(I),1)
280 CONTINUE
DO 290 I=1,NPR
IAM(I,1)=ITEMP(I)
290 CONTINUE
DO 300 I=1,NPR
ITEMP(I)=IAM(IND(I),2)
300 CONTINUE
DO 310 I=1,NPR
IAM(I,2)=ITEMP(I)
310 CONTINUE
C CALCULATE OVERLAP MATRIX OF STO-6G FUNCTIONS
C
DO 320 J=1,NC
CALL OVLP(J,1,IS,IP,NPR,NC,ICD)
320 CONTINUE
C
DO 330 J=1,NC
DO 330 K=1,NC
CESPM2(INDC(J),INDC(K))=OVL(J,K)
330 CONTINUE
DO 340 J=1,NC
DO 340 K=1,NC
OVL(J,K)=CESPM2(J,K)
340 CONTINUE
L=0
DO 350 I=1,NC
DO 350 J=1,I
L=L+1
CESP(L)=OVL(I,J)
350 CONTINUE
C
C DEORTHOGONALIZE THE COEFFICIENTS AND REFORM THE DENSITY MATRIX
C
CALL RSP(CESP,NC,1,TEMP,CESPML)
DO 360 I=1,NC
DO 360 J=1,I
SUM=0.D0
DO 360 K=1,NC
SUM=SUM+CESPML(I+(K-1)*NC)/SQRT(TEMP(K))*CESPML(J+(K-1)*N
1C)
CESP(I+(J-1)*NC)=SUM
CESP(J+(I-1)*NC)=SUM
360 CONTINUE
CALL MULT(C,CESP,CESPML,NC)
CALL DENSIT(CESPML,NC,NC,NCLOSE,NOPEN,FRACT,CESP,2)
C
C NOW CALCULATE THE ELECTRONIC CONTRIBUTION TO THE ELECTROSTATIC POT
C
L=0
DO 370 I=1,NC
DO 370 J=1,I
L=L+1
CESPM(I,J)=CESP(L)
CESPM(J,I)=CESP(L)
370 CONTINUE
IPX=(NPR-IS)/3
IPE=IS+IPX
DO 380 I=1,NESP
ES(I)=0.D0
380 CONTINUE
CALL NAICAS(ISC,IS,IP,NPR,NC,IPE,IPX,ICD)
CALL NAICAP(ISC,IS,IP,NPR,NC,IPE,IPX,ICD)
C CALCULATE TOTAL ESP AND FORM ARRAYS FOR ESPFIT
DO 400 I=1,NESP
ESP(I)=0.D0
DO 390 J=1,NATOM
RA=SQRT((CO(1,J)-POTPT(1,I))**2+(CO(2,J)-POTPT(2,I))**2+(CO(
13,J)-POTPT(3,I))**2)
ESP(I)=ESP(I)+TORE(IAN(J))/(RA/BOHR)
390 CONTINUE
ESP(I)=ESP(I)-ES(I)
DO 400 J=1,NATOM
RIJ=SQRT((CO(1,J)-POTPT(1,I))**2+(CO(2,J)-POTPT(2,I))**2
1+(CO(3,J)-POTPT(3,I))**2)/BOHR
B(J)=B(J)+ESP(I)*1.D0/RIJ
400 CONTINUE
C
C IF REQUESTED WRITE OUT ELECTRIC POTENTIAL DATA TO
C UNIT 21
C
POTWRT=(INDEX(KEYWRD,'POTWRT') .NE. 0)
IF(POTWRT) THEN
C aoyama editted 2/2
OPEN(21,FILE=ERR1(1:ER1LEN),STATUS='NEW')
C OPEN(21,STATUS='NEW')
C end aoyama editted 2/2
WRITE(21,'(I5)') NESP
DO 410 I=1,NESP
410 WRITE(21,420) ESP(I),POTPT(1,I)/BOHR,POTPT(2,I)/BOHR,
1POTPT(3,I)
ENDIF
420 FORMAT(1X,4E16.7)
RETURN
END
DOUBLE PRECISION FUNCTION DEX2(M)
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
IF(M .LT. 2) THEN
DEX2=1
ELSE
DEX2=1
DO 10 I=1,M,2
10 DEX2=DEX2*I
ENDIF
RETURN
END
BLOCK DATA ESPBLO
IMPLICIT DOUBLE PRECISION (A-H, O-Z)
INCLUDE 'SIZES'
COMMON /ESPC/ CC(MAXPR),CEN(MAXPR,3),IAM(MAXPR,2),IND(MAXPR),
1 EX(MAXPR),ESPI(MAXORB,MAXORB),
2 FV(0:8,821),FAC(0:7),
3 DEX(-1:96),TF(0:2),TEMP(MAXPR),ITEMP(MAXPR),
4 OVL(MAXORB,MAXORB),FC(MAXPR*6)
DATA TF/33.D0,37.D0,41.D0/
DATA FAC/1.D0,1.D0,2.D0,6.D0,24.D0,120.D0,720.D0,5040.D0/
END
C***********************************************************************
SUBROUTINE ESPFIT(IDIP,NATOM,NESP,IZ,ESP,POTPT,CO,
1DX,DY,DZ,RMS,RRMS)
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
INCLUDE 'SIZES'
C***********************************************************************
C