-
Notifications
You must be signed in to change notification settings - Fork 1
/
calc_xi.f90
941 lines (908 loc) · 39 KB
/
calc_xi.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
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! CARACAL - Ring polymer molecular dynamics and rate constant calculations
! on black-box generated potential energy surfaces
!
! Copyright (c) 2023 by Julien Steffen ([email protected])
! Stefan Grimme ([email protected]) (QMDFF code)
!
! 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.
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! subroutine calc_xi: calculate value as well as first and
! second derivatives of the reaction coordinate Xi for
! the different types of implemented reactions
!
! Disclaimer (taken from with slightly changes):
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! RPMDrate - Bimolecular reaction rates via ring polymer molecular dynamics
!
! Copyright (c) 2012 by Joshua W. Allen ([email protected])
! William H. Green ([email protected])
! Yury V. Suleimanov ([email protected], [email protected])
!
! 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.
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
subroutine calc_xi(coords,xi_ideal,xi_act,dxi_act,d2xi_act,mode)
use general
use evb_mod
implicit none
integer::i,j,k,l,i1,i2,j1,j2 ! loop indices
integer::mode ! if usual umbrella sampling or recrossing shall be calculated!
integer::s0_terms ! number of interaction betweem sum_reacs reactant particles
real(kind=8)::coords(3,natoms) ! the actual coordinates
real(kind=8)::Red(3,sum_reacs,sum_reacs) ! all possible reactant-reactant distances
real(kind=8)::r_eds(sum_reacs,sum_reacs) ! the actual distane between two reactants
real(kind=8)::eds_avg ! the average distance between two reactants
real(kind=8)::R_f(3,form_num),R_b(3,break_num) ! generalized vectors for all bonds
real(kind=8)::form_act(form_num),break_act(break_num) ! actual bondlengths
real(kind=8)::xi_act ! the calculated Xi value
real(kind=8)::dxi_act(3,natoms) ! the calculated Xi derivative
real(kind=8)::d2xi_act(3,natoms,3,natoms) ! the calculated Xi hessian
real(kind=8)::s0,s1 ! dividing surface values
real(kind=8)::ds0(3,natoms),ds1(3,natoms) ! the calculated surface derivatives
real(kind=8)::d2s0(3,natoms,3,natoms),d2s1(3,natoms,3,natoms) ! the calculated surface hessians
real(kind=8)::com(sum_reacs,3) ! array with center of mass coordinates
real(kind=8)::Rinv ! the inverse bond length/distance (for derivatives)
real(kind=8)::r_factor(sum_reacs,sum_reacs) ! modifying factor in s0 for different distances
real(kind=8)::correct ! local correction for ds0 and d2s0
real(kind=8)::massfactor ! for hessians: factor of two masses
real(kind=8)::dxx,dxy,dxz,dyy,dyz,dzz ! abbreviations for hessian elements
real(kind=8)::xi_ideal ! the reference xi value (for recrossing)
integer::atom,atom1,atom2 ! the actual atomic indices
!
! Here methods to calculate the Xi, dXi and d2Xi values/arrays are
! listed for all supported types of reactions
!
! Currently these are:
! 1. Bimolecular reaction (one forming, one breaking bond)
! 2. Cycloaddition (two forming bonds)
! 3. Bimolecular cyclic exchange (two forming, two breaking bonds)
! 4. Addition (two forming, one breaking bonds)
! 5. Addition3 (three forming, two breaking bonds)
! 6. Addition4 (four forming, three breaking bonds)
! 7. Addition3 with solvent complex (three forming, two breaking bonds)
! 8. Addition4 with solvent complex (four forming, three breaking bonds)
! 9. Merging (one forming bond)
!
! #############################################################################
! 1 THE BIMOLECULAR REACTION MECHANISMS
!
if ((umbr_type .eq. "BIMOLEC") .or. (umbr_type .eq. "CYCLOADD") &
& .or. (umbr_type .eq. "BIMOL_EXCH") &
& .or. (umbr_type .eq. "ADDITION") .or. (umbr_type .eq. "ADDITION3") &
& .or. (umbr_type .eq. "ADDITION4") .or. (umbr_type .eq. "ADD3_SOLV") &
& .or. (umbr_type .eq. "ADD4_SOLV") .or. (umbr_type .eq. "MERGING")) then
!
! STEP1: calculate the bondlengths and then the Xi-value
!
!
! the forming bonds (in total form_num bonds)
!
do i=1,form_num
atom1=bond_form(i,1)
atom2=bond_form(i,2)
R_f(1,i)=coords(1,atom1) - coords(1,atom2)
R_f(2,i)=coords(2,atom1) - coords(2,atom2)
R_f(3,i)=coords(3,atom1) - coords(3,atom2)
form_act(i)=sqrt(R_f(1,i)*R_f(1,i)+R_f(2,i)*R_f(2,i)+R_f(3,i)*R_f(3,i))
end do
!
! the breaking bonds (in total break_num bonds)
!
do i=1,break_num
atom1=bond_break(i,1)
atom2=bond_break(i,2)
R_b(1,i)=coords(1,atom1) - coords(1,atom2)
R_b(2,i)=coords(2,atom1) - coords(2,atom2)
R_b(3,i)=coords(3,atom1) - coords(3,atom2)
break_act(i)=sqrt(R_b(1,i)*R_b(1,i)+R_b(2,i)*R_b(2,i)+R_b(3,i)*R_b(3,i))
end do
!
! value of the TS dividing surface funtion: sum up all breaking
! bond differences and divide this through the total number of
! breaking and sum up all forming bond differences and divide this
! through the total numbe of forming
!
s1=0.d0
do i=1,break_num
s1=s1+(break_act(i)-break_ref(i))/real(break_num)
end do
do i=1,form_num
s1=s1-(form_act(i)-form_ref(i))/real(form_num)
end do
!
! value of the reactant dividing surface function
! calculate the difference between center of masses of both reactands
! and compare it to the predefined R_inf distance (no interaction)
!
! write(*,*) "coords2",coords
call calc_com(coords,com)
!
! calclate the R_ed matrix will all needed combination
! (upper triangular matrix)
! and apply its elements to the s0 coordinate
!
r_eds=0.d0
s0=0.d0
do i=1,sum_reacs
do j=i+1,sum_reacs
Red(1,i,j)=com(j,1)-com(i,1)
Red(2,i,j)=com(j,2)-com(i,2)
Red(3,i,j)=com(j,3)-com(i,3)
r_eds(i,j)=sqrt(Red(1,i,j)*Red(1,i,j) + Red(2,i,j)*Red(2,i,j) &
& + Red(3,i,j)*Red(3,i,j))
s0=s0+(R_inf-r_eds(i,j))
end do
end do
! write(*,*) "s0 calculation",s0
!
! divide the surface function through the number of interactions
! (n_reac^2-n_reac)/2
!
s0_terms=(sum_reacs*sum_reacs-sum_reacs)/2
s0=s0/real(s0_terms)
!
! Try to enforce similar values for all possible reactant-reactant distances
! calculate average and the deviation to it to correct the actual values
!
! eds_avg=sum(r_eds)/real(s0_terms)
! do i=1,sum_reacs
! do j=i+1,sum_reacs
! r_factor(i,j)=1/((2*r_eds(i,j)-eds_avg)/r_eds(i,j) )
! write(*,*) i,j,eds_avg,r_eds(i,j),r_factor(i,j)
! r_eds(i,j)=eds_avg !r_eds(i,j)+(-eds_avg+r_eds(i,j))
! end do
! end do
! write(*,*) s0_terms,sum(r_eds)
! write(*,*) "r12,r13,r23",r_eds(1,2),r_eds(1,3),r_eds(2,3),eds_avg
! write(*,*) "s0,s1",s0,s1
!
! calculate Xi value with the RPMDrate formula
!
! for usual umbrella sampling
!
if (mode .eq. 1) then
xi_act=s0/(s0-s1)
! write(*,*) "xi_act",xi_ideal,xi_act,s0,s1
!
! for recrossing calculation
!
else if (mode .eq. 2) then
xi_act=xi_ideal*s1+(1-xi_ideal)*s0
! write(*,*) "xi_act",xi_act,xi_ideal,s0,s1
end if
!
! STEP2: calculate the gradient of reaction coordinate
!
!
! The transition state dividing surface
!
ds1=0.d0
!
! the forming bonds (in total, n_form forming bonds)
!
do i=1,form_num
atom1=bond_form(i,1)
atom2=bond_form(i,2)
Rinv=1.d0/form_act(i)
ds1(1,atom1) = ds1(1,atom1) - R_f(1,i) * Rinv/real(form_num)
ds1(2,atom1) = ds1(2,atom1) - R_f(2,i) * Rinv/real(form_num)
ds1(3,atom1) = ds1(3,atom1) - R_f(3,i) * Rinv/real(form_num)
ds1(1,atom2) = ds1(1,atom2) + R_f(1,i) * Rinv/real(form_num)
ds1(2,atom2) = ds1(2,atom2) + R_f(2,i) * Rinv/real(form_num)
ds1(3,atom2) = ds1(3,atom2) + R_f(3,i) * Rinv/real(form_num)
end do
!
! the breaking bonds (in total, n_break breaking bonds)
!
do i=1,break_num
atom1=bond_break(i,1)
atom2=bond_break(i,2)
Rinv=1.d0/break_act(i)
ds1(1,atom1) = ds1(1,atom1) + R_b(1,i) * Rinv/real(break_num)
ds1(2,atom1) = ds1(2,atom1) + R_b(2,i) * Rinv/real(break_num)
ds1(3,atom1) = ds1(3,atom1) + R_b(3,i) * Rinv/real(break_num)
ds1(1,atom2) = ds1(1,atom2) - R_b(1,i) * Rinv/real(break_num)
ds1(2,atom2) = ds1(2,atom2) - R_b(2,i) * Rinv/real(break_num)
ds1(3,atom2) = ds1(3,atom2) - R_b(3,i) * Rinv/real(break_num)
end do
!
! The reactants dividing surface
!
ds0=0.d0
do i=1,sum_reacs
do j=i+1,sum_reacs
Rinv=1.d0/r_eds(i,j)
do k=1,n_reac(i)
atom=at_reac(i,k)
ds0(1,atom)=ds0(1,atom)+Red(1,i,j)*Rinv*mass(atom)/mass_reac(i)/real(s0_terms)
ds0(2,atom)=ds0(2,atom)+Red(2,i,j)*Rinv*mass(atom)/mass_reac(i)/real(s0_terms)
ds0(3,atom)=ds0(3,atom)+Red(3,i,j)*Rinv*mass(atom)/mass_reac(i)/real(s0_terms)
end do
do k=1,n_reac(j)
atom=at_reac(j,k)
ds0(1,atom)=ds0(1,atom)-Red(1,i,j)*Rinv*mass(atom)/mass_reac(j)/real(s0_terms)
ds0(2,atom)=ds0(2,atom)-Red(2,i,j)*Rinv*mass(atom)/mass_reac(j)/real(s0_terms)
ds0(3,atom)=ds0(3,atom)-Red(3,i,j)*Rinv*mass(atom)/mass_reac(j)/real(s0_terms)
end do
end do
end do
!
! For usual umbrella sampling
!
if (mode .eq. 1) then
dxi_act=(s0*ds1-s1*ds0)/((s0-s1)*(s0-s1))
!
! For recrossing calculation
!
else if (mode .eq. 2) then
dxi_act=xi_ideal*ds1+(1-xi_ideal)*ds0
end if
!
! STEP3: calculate the hessian of the reaction coordinate
! (I don´t know why this is needed!)
!
!
! The transition state dividing surface
!
d2s1=0.d0
!
! the forming bonds (in total form_num forming bonds)
!
do i=1,form_num
atom1=bond_form(i,1)
atom2=bond_form(i,2)
Rinv=1.d0/form_act(i)
dxx = -(R_f(2,i) * R_f(2,i) + R_f(3,i) * R_f(3,i)) * (Rinv * Rinv * Rinv)
dyy = -(R_f(3,i) * R_f(3,i) + R_f(1,i) * R_f(1,i)) * (Rinv * Rinv * Rinv)
dzz = -(R_f(1,i) * R_f(1,i) + R_f(2,i) * R_f(2,i)) * (Rinv * Rinv * Rinv)
dxy = R_f(1,i) * R_f(2,i) * (Rinv * Rinv * Rinv)
dxz = R_f(1,i) * R_f(3,i) * (Rinv * Rinv * Rinv)
dyz = R_f(2,i) * R_f(3,i) * (Rinv * Rinv * Rinv)
d2s1(1,atom1,1,atom1) = d2s1(1,atom1,1,atom1) + dxx/real(form_num)
d2s1(1,atom1,2,atom1) = d2s1(1,atom1,2,atom1) + dxy/real(form_num)
d2s1(1,atom1,3,atom1) = d2s1(1,atom1,3,atom1) + dxz/real(form_num)
d2s1(2,atom1,1,atom1) = d2s1(2,atom1,1,atom1) + dxy/real(form_num)
d2s1(2,atom1,2,atom1) = d2s1(2,atom1,2,atom1) + dyy/real(form_num)
d2s1(2,atom1,3,atom1) = d2s1(2,atom1,3,atom1) + dyz/real(form_num)
d2s1(3,atom1,1,atom1) = d2s1(3,atom1,1,atom1) + dxz/real(form_num)
d2s1(3,atom1,2,atom1) = d2s1(3,atom1,2,atom1) + dyz/real(form_num)
d2s1(3,atom1,3,atom1) = d2s1(3,atom1,3,atom1) + dzz/real(form_num)
d2s1(1,atom1,1,atom2) = d2s1(1,atom1,1,atom2) - dxx/real(form_num)
d2s1(1,atom1,2,atom2) = d2s1(1,atom1,2,atom2) - dxy/real(form_num)
d2s1(1,atom1,3,atom2) = d2s1(1,atom1,3,atom2) - dxz/real(form_num)
d2s1(2,atom1,1,atom2) = d2s1(2,atom1,1,atom2) - dxy/real(form_num)
d2s1(2,atom1,2,atom2) = d2s1(2,atom1,2,atom2) - dyy/real(form_num)
d2s1(2,atom1,3,atom2) = d2s1(2,atom1,3,atom2) - dyz/real(form_num)
d2s1(3,atom1,1,atom2) = d2s1(3,atom1,1,atom2) - dxz/real(form_num)
d2s1(3,atom1,2,atom2) = d2s1(3,atom1,2,atom2) - dyz/real(form_num)
d2s1(3,atom1,3,atom2) = d2s1(3,atom1,3,atom2) - dzz/real(form_num)
d2s1(1,atom2,1,atom1) = d2s1(1,atom2,1,atom1) - dxx/real(form_num)
d2s1(1,atom2,2,atom1) = d2s1(1,atom2,2,atom1) - dxy/real(form_num)
d2s1(1,atom2,3,atom1) = d2s1(1,atom2,3,atom1) - dxz/real(form_num)
d2s1(2,atom2,1,atom1) = d2s1(2,atom2,1,atom1) - dxy/real(form_num)
d2s1(2,atom2,2,atom1) = d2s1(2,atom2,2,atom1) - dyy/real(form_num)
d2s1(2,atom2,3,atom1) = d2s1(2,atom2,3,atom1) - dyz/real(form_num)
d2s1(3,atom2,1,atom1) = d2s1(3,atom2,1,atom1) - dxz/real(form_num)
d2s1(3,atom2,2,atom1) = d2s1(3,atom2,2,atom1) - dyz/real(form_num)
d2s1(3,atom2,3,atom1) = d2s1(3,atom2,3,atom1) - dzz/real(form_num)
d2s1(1,atom2,1,atom2) = d2s1(1,atom2,1,atom2) + dxx/real(form_num)
d2s1(1,atom2,2,atom2) = d2s1(1,atom2,2,atom2) + dxy/real(form_num)
d2s1(1,atom2,3,atom2) = d2s1(1,atom2,3,atom2) + dxz/real(form_num)
d2s1(2,atom2,1,atom2) = d2s1(2,atom2,1,atom2) + dxy/real(form_num)
d2s1(2,atom2,2,atom2) = d2s1(2,atom2,2,atom2) + dyy/real(form_num)
d2s1(2,atom2,3,atom2) = d2s1(2,atom2,3,atom2) + dyz/real(form_num)
d2s1(3,atom2,1,atom2) = d2s1(3,atom2,1,atom2) + dxz/real(form_num)
d2s1(3,atom2,2,atom2) = d2s1(3,atom2,2,atom2) + dyz/real(form_num)
d2s1(3,atom2,3,atom2) = d2s1(3,atom2,3,atom2) + dzz/real(form_num)
end do
!
! the breaking bonds (in total break_num breaking bonds)
!
do i=1,break_num
atom1=bond_break(i,1)
atom2=bond_break(i,2)
Rinv=1.d0/break_act(i)
dxx = (R_b(2,i) * R_b(2,i) + R_b(3,i) * R_b(3,i)) * (Rinv * Rinv * Rinv)
dyy = (R_b(3,i) * R_b(3,i) + R_b(1,i) * R_b(1,i)) * (Rinv * Rinv * Rinv)
dzz = (R_b(1,i) * R_b(1,i) + R_b(2,i) * R_b(2,i)) * (Rinv * Rinv * Rinv)
dxy = -R_b(1,i) * R_b(2,i) * (Rinv * Rinv * Rinv)
dxz = -R_b(1,i) * R_b(3,i) * (Rinv * Rinv * Rinv)
dyz = -R_b(2,i) * R_b(3,i) * (Rinv * Rinv * Rinv)
d2s1(1,atom1,1,atom1) = d2s1(1,atom1,1,atom1) + dxx/real(break_num)
d2s1(1,atom1,2,atom1) = d2s1(1,atom1,2,atom1) + dxy/real(break_num)
d2s1(1,atom1,3,atom1) = d2s1(1,atom1,3,atom1) + dxz/real(break_num)
d2s1(2,atom1,1,atom1) = d2s1(2,atom1,1,atom1) + dxy/real(break_num)
d2s1(2,atom1,2,atom1) = d2s1(2,atom1,2,atom1) + dyy/real(break_num)
d2s1(2,atom1,3,atom1) = d2s1(2,atom1,3,atom1) + dyz/real(break_num)
d2s1(3,atom1,1,atom1) = d2s1(3,atom1,1,atom1) + dxz/real(break_num)
d2s1(3,atom1,2,atom1) = d2s1(3,atom1,2,atom1) + dyz/real(break_num)
d2s1(3,atom1,3,atom1) = d2s1(3,atom1,3,atom1) + dzz/real(break_num)
d2s1(1,atom1,1,atom2) = d2s1(1,atom1,1,atom2) - dxx/real(break_num)
d2s1(1,atom1,2,atom2) = d2s1(1,atom1,2,atom2) - dxy/real(break_num)
d2s1(1,atom1,3,atom2) = d2s1(1,atom1,3,atom2) - dxz/real(break_num)
d2s1(2,atom1,1,atom2) = d2s1(2,atom1,1,atom2) - dxy/real(break_num)
d2s1(2,atom1,2,atom2) = d2s1(2,atom1,2,atom2) - dyy/real(break_num)
d2s1(2,atom1,3,atom2) = d2s1(2,atom1,3,atom2) - dyz/real(break_num)
d2s1(3,atom1,1,atom2) = d2s1(3,atom1,1,atom2) - dxz/real(break_num)
d2s1(3,atom1,2,atom2) = d2s1(3,atom1,2,atom2) - dyz/real(break_num)
d2s1(3,atom1,3,atom2) = d2s1(3,atom1,3,atom2) - dzz/real(break_num)
d2s1(1,atom2,1,atom1) = d2s1(1,atom2,1,atom1) - dxx/real(break_num)
d2s1(1,atom2,2,atom1) = d2s1(1,atom2,2,atom1) - dxy/real(break_num)
d2s1(1,atom2,3,atom1) = d2s1(1,atom2,3,atom1) - dxz/real(break_num)
d2s1(2,atom2,1,atom1) = d2s1(2,atom2,1,atom1) - dxy/real(break_num)
d2s1(2,atom2,2,atom1) = d2s1(2,atom2,2,atom1) - dyy/real(break_num)
d2s1(2,atom2,3,atom1) = d2s1(2,atom2,3,atom1) - dyz/real(break_num)
d2s1(3,atom2,1,atom1) = d2s1(3,atom2,1,atom1) - dxz/real(break_num)
d2s1(3,atom2,2,atom1) = d2s1(3,atom2,2,atom1) - dyz/real(break_num)
d2s1(3,atom2,3,atom1) = d2s1(3,atom2,3,atom1) - dzz/real(break_num)
d2s1(1,atom2,1,atom2) = d2s1(1,atom2,1,atom2) + dxx/real(break_num)
d2s1(1,atom2,2,atom2) = d2s1(1,atom2,2,atom2) + dxy/real(break_num)
d2s1(1,atom2,3,atom2) = d2s1(1,atom2,3,atom2) + dxz/real(break_num)
d2s1(2,atom2,1,atom2) = d2s1(2,atom2,1,atom2) + dxy/real(break_num)
d2s1(2,atom2,2,atom2) = d2s1(2,atom2,2,atom2) + dyy/real(break_num)
d2s1(2,atom2,3,atom2) = d2s1(2,atom2,3,atom2) + dyz/real(break_num)
d2s1(3,atom2,1,atom2) = d2s1(3,atom2,1,atom2) + dxz/real(break_num)
d2s1(3,atom2,2,atom2) = d2s1(3,atom2,2,atom2) + dyz/real(break_num)
d2s1(3,atom2,3,atom2) = d2s1(3,atom2,3,atom2) + dzz/real(break_num)
end do
!
! The reactants dividing surface
!
d2s0=0.d0
do i=1,sum_reacs
do j=i+1,sum_reacs
Rinv=1.d0/r_eds(i,j)
dxx = -(Red(2,i,j) * Red(2,i,j) + Red(3,i,j) * Red(3,i,j)) * (Rinv * Rinv * Rinv)
dyy = -(Red(3,i,j) * Red(3,i,j) + Red(1,i,j) * Red(1,i,j)) * (Rinv * Rinv * Rinv)
dzz = -(Red(1,i,j) * Red(1,i,j) + Red(2,i,j) * Red(2,i,j)) * (Rinv * Rinv * Rinv)
dxy = Red(1,i,j) * Red(2,i,j) * (Rinv * Rinv * Rinv)
dxz = Red(1,i,j) * Red(3,i,j) * (Rinv * Rinv * Rinv)
dyz = Red(2,i,j) * Red(3,i,j) * (Rinv * Rinv * Rinv)
do k=1,n_reac(i)
atom1=at_reac(i,k)
do l=1,n_reac(i)
atom2=at_reac(i,l)
massfactor=mass(atom1)/mass_reac(i)*mass(atom2)/mass_reac(i)
d2s0(1,atom1,1,atom2) = d2s0(1,atom1,1,atom2)+dxx * massfactor/real(s0_terms)
d2s0(1,atom1,2,atom2) = d2s0(1,atom1,2,atom2)+dxy * massfactor/real(s0_terms)
d2s0(1,atom1,3,atom2) = d2s0(1,atom1,3,atom2)+dxz * massfactor/real(s0_terms)
d2s0(2,atom1,1,atom2) = d2s0(2,atom1,1,atom2)+dxy * massfactor/real(s0_terms)
d2s0(2,atom1,2,atom2) = d2s0(2,atom1,2,atom2)+dyy * massfactor/real(s0_terms)
d2s0(2,atom1,3,atom2) = d2s0(2,atom1,3,atom2)+dyz * massfactor/real(s0_terms)
d2s0(3,atom1,1,atom2) = d2s0(3,atom1,1,atom2)+dxz * massfactor/real(s0_terms)
d2s0(3,atom1,2,atom2) = d2s0(3,atom1,2,atom2)+dyz * massfactor/real(s0_terms)
d2s0(3,atom1,3,atom2) = d2s0(3,atom1,3,atom2)+dzz * massfactor/real(s0_terms)
end do
do l=1,n_reac(j)
atom2=at_reac(j,l)
massfactor=mass(atom1)/mass_reac(i)*mass(atom2)/mass_reac(j)
d2s0(1,atom1,1,atom2) = d2s0(1,atom1,1,atom2)-dxx * massfactor/real(s0_terms)
d2s0(1,atom1,2,atom2) = d2s0(1,atom1,2,atom2)-dxy * massfactor/real(s0_terms)
d2s0(1,atom1,3,atom2) = d2s0(1,atom1,3,atom2)-dxz * massfactor/real(s0_terms)
d2s0(2,atom1,1,atom2) = d2s0(2,atom1,1,atom2)-dxy * massfactor/real(s0_terms)
d2s0(2,atom1,2,atom2) = d2s0(2,atom1,2,atom2)-dyy * massfactor/real(s0_terms)
d2s0(2,atom1,3,atom2) = d2s0(2,atom1,3,atom2)-dyz * massfactor/real(s0_terms)
d2s0(3,atom1,1,atom2) = d2s0(3,atom1,1,atom2)-dxz * massfactor/real(s0_terms)
d2s0(3,atom1,2,atom2) = d2s0(3,atom1,2,atom2)-dyz * massfactor/real(s0_terms)
d2s0(3,atom1,3,atom2) = d2s0(3,atom1,3,atom2)-dzz * massfactor/real(s0_terms)
end do
end do
do k=1,n_reac(j)
atom1=at_reac(j,k)
do l=1,n_reac(i)
atom2=at_reac(i,l)
massfactor=mass(atom1)/mass_reac(j)*mass(atom2)/mass_reac(i)
d2s0(1,atom1,1,atom2) = d2s0(1,atom1,1,atom2)-dxx * massfactor/real(s0_terms)
d2s0(1,atom1,2,atom2) = d2s0(1,atom1,2,atom2)-dxy * massfactor/real(s0_terms)
d2s0(1,atom1,3,atom2) = d2s0(1,atom1,3,atom2)-dxz * massfactor/real(s0_terms)
d2s0(2,atom1,1,atom2) = d2s0(2,atom1,1,atom2)-dxy * massfactor/real(s0_terms)
d2s0(2,atom1,2,atom2) = d2s0(2,atom1,2,atom2)-dyy * massfactor/real(s0_terms)
d2s0(2,atom1,3,atom2) = d2s0(2,atom1,3,atom2)-dyz * massfactor/real(s0_terms)
d2s0(3,atom1,1,atom2) = d2s0(3,atom1,1,atom2)-dxz * massfactor/real(s0_terms)
d2s0(3,atom1,2,atom2) = d2s0(3,atom1,2,atom2)-dyz * massfactor/real(s0_terms)
d2s0(3,atom1,3,atom2) = d2s0(3,atom1,3,atom2)-dzz * massfactor/real(s0_terms)
end do
do l=1,n_reac(j)
atom2=at_reac(j,l)
massfactor=mass(atom1)/mass_reac(j)*mass(atom2)/mass_reac(j)
d2s0(1,atom1,1,atom2) = d2s0(1,atom1,1,atom2)+dxx * massfactor/real(s0_terms)
d2s0(1,atom1,2,atom2) = d2s0(1,atom1,2,atom2)+dxy * massfactor/real(s0_terms)
d2s0(1,atom1,3,atom2) = d2s0(1,atom1,3,atom2)+dxz * massfactor/real(s0_terms)
d2s0(2,atom1,1,atom2) = d2s0(2,atom1,1,atom2)+dxy * massfactor/real(s0_terms)
d2s0(2,atom1,2,atom2) = d2s0(2,atom1,2,atom2)+dyy * massfactor/real(s0_terms)
d2s0(2,atom1,3,atom2) = d2s0(2,atom1,3,atom2)+dyz * massfactor/real(s0_terms)
d2s0(3,atom1,1,atom2) = d2s0(3,atom1,1,atom2)+dxz * massfactor/real(s0_terms)
d2s0(3,atom1,2,atom2) = d2s0(3,atom1,2,atom2)+dyz * massfactor/real(s0_terms)
d2s0(3,atom1,3,atom2) = d2s0(3,atom1,3,atom2)+dzz * massfactor/real(s0_terms)
end do
end do
end do
end do
!
! Determine Hessian of the reaction coordinate from dividing surface
! hessians
!
! for usual umbrella sampling
!
if (mode .eq. 1) then
do i1 = 1, 3
do j1 = 1, Natoms
do i2 = 1, 3
do j2 = 1, Natoms
d2xi_act(i1,j1,i2,j2) = ((s0 * d2s1(i1,j1,i2,j2) + ds0(i2,j2) * ds1(i1,j1) &
& - ds1(i2,j2) * ds0(i1,j1) - s1 * d2s0(i1,j1,i2,j2)) * (s0 - s1) &
& - 2.0d0 * (s0 * ds1(i1,j1) - s1 * ds0(i1,j1)) &
& * (ds0(i2,j2) - ds1(i2,j2))) &
& / ((s0 - s1) * (s0 - s1) * (s0 - s1))
end do
end do
end do
end do
!
! For recrossing factor calculation
!
else if (mode .eq. 2) then
d2xi_act=xi_ideal*d2s1+(1-xi_ideal)*d2s0
end if
! write(*,*) "Xiii values!",mode
! write(*,*) "xi_act",xi_act,xi_ideal,s0,s1
! write(*,*) xi_act
! write(*,*) "dxi_act"
! write(*,*) dxi_act
! write(*,*) "d2s1!"
! write(*,*) d2s1
! write(*,*) "d2s0!"
! write(*,*) d2s0
!
! write(*,*) "d2xi_act"
! write(*,*) d2xi_act
! stop "gizfitcditucD"
!
! #############################################################################
! 2 THE ATOM SHIFT (ONE COORDINATE RESTRAINT ON ONE ATOM)
!
! These coordinate is rather simple: for s0, the expression is x_real-x_ideal,
! the first derivative is 1 for the relevent coordinate, the second is zero
!
else if (umbr_type .eq. "ATOM_SHIFT") then
!
! value of the TS dividing surface function: reference to shift_hi
!
if (shift_coord .lt. 4) then
s1=coords(shift_coord,shift_atom)-shift_hi
else
!
! For diagonal shifts: average of both coordinates!
!
if (shift_coord .eq. 4) then
s1=((coords(1,shift_atom)-shift_hi)+(coords(2,shift_atom)-shift2_hi))/2d0
end if
if (shift_coord .eq. 5) then
s1=((coords(1,shift_atom)-shift_hi)+(coords(3,shift_atom)-shift2_hi))/2d0
end if
if (shift_coord .eq. 6) then
s1=((coords(2,shift_atom)-shift_hi)+(coords(3,shift_atom)-shift2_hi))/2d0
end if
end if
!
! value of the reactants dividing surface function: reference to shift_lo
!
if (shift_coord .lt. 4) then
s0=coords(shift_coord,shift_atom)-shift_lo
else
!
! For diagonal shifts: average of both coordinates!
!
if (shift_coord .eq. 4) then
s0=((coords(1,shift_atom)-shift_lo)+(coords(2,shift_atom)-shift2_lo))/2d0
end if
if (shift_coord .eq. 5) then
s0=((coords(1,shift_atom)-shift_lo)+(coords(3,shift_atom)-shift2_lo))/2d0
end if
if (shift_coord .eq. 6) then
s0=((coords(2,shift_atom)-shift_lo)+(coords(3,shift_atom)-shift2_lo))/2d0
end if
end if
!
! Calculate the actual Xi value:
! for usual umbrella sampling
!
if (mode .eq. 1) then
xi_act=s0/(s0-s1)
!
! for recrossing calculation
!
else if (mode .eq. 2) then
xi_act=xi_ideal*s1+(1-xi_ideal)*s0
! write(*,*) "xi_act",xi_act,xi_ideal,s0,s1
end if
!
! gradient of the TS dividing surface function:
!
ds1=0d0
if (shift_coord .lt. 4) then
ds1(shift_coord,shift_atom)=1d0
else
if (shift_coord .eq. 4) then
ds1(1,shift_atom)=0.5d0
ds1(2,shift_atom)=0.5d0
end if
if (shift_coord .eq. 5) then
ds1(1,shift_atom)=0.5d0
ds1(3,shift_atom)=0.5d0
end if
if (shift_coord .eq. 6) then
ds1(2,shift_atom)=0.5d0
ds1(3,shift_atom)=0.5d0
end if
end if
!
! gradient of the reactants dividing surface function:
!
ds0=0d0
if (shift_coord .lt. 4) then
ds0(shift_coord,shift_atom)=1d0
else
if (shift_coord .eq. 4) then
ds0(1,shift_atom)=0.5d0
ds0(2,shift_atom)=0.5d0
end if
if (shift_coord .eq. 5) then
ds0(1,shift_atom)=0.5d0
ds0(3,shift_atom)=0.5d0
end if
if (shift_coord .eq. 6) then
ds0(2,shift_atom)=0.5d0
ds0(3,shift_atom)=0.5d0
end if
end if
!
! calculate the actual Xi derivative:
!
!
! For usual umbrella sampling
!
if (mode .eq. 1) then
dxi_act=(s0*ds1-s1*ds0)/((s0-s1)*(s0-s1))
!
! For recrossing calculation
!
else if (mode .eq. 2) then
dxi_act=xi_ideal*ds1+(1-xi_ideal)*ds0
end if
!
! hession of reaction coordinate: both d2s0 and d2s1 are zero!
!
d2s0=0.d0
d2s1=0.d0
!
! Determine Hessian of the reaction coordinate from dividing surface
! hessians
!
! for usual umbrella sampling
!
if (mode .eq. 1) then
do i1 = 1, 3
do j1 = 1, Natoms
do i2 = 1, 3
do j2 = 1, Natoms
d2xi_act(i1,j1,i2,j2) = ((s0 * d2s1(i1,j1,i2,j2) + ds0(i2,j2) * ds1(i1,j1) &
& - ds1(i2,j2) * ds0(i1,j1) - s1 * d2s0(i1,j1,i2,j2)) * (s0 - s1) &
& - 2.0d0 * (s0 * ds1(i1,j1) - s1 * ds0(i1,j1)) &
& * (ds0(i2,j2) - ds1(i2,j2))) &
& / ((s0 - s1) * (s0 - s1) * (s0 - s1))
end do
end do
end do
end do
!
! For recrossing factor calculation
!
else if (mode .eq. 2) then
d2xi_act=xi_ideal*d2s1+(1-xi_ideal)*d2s0
end if
! #############################################################################
! 3 UNIMOLECULAR REACTIONS (GENERAL)
!
! Here, the s0 dividing surface is defined as the reactant structure. Therefore,
! both dividing surfaces are defined as a bunch of reference values for
! the forming and breaking bonds of interest
!
!
else if ((umbr_type .eq. "CYCLOREVER") .or. (umbr_type .eq. "REARRANGE") .or. &
& (umbr_type .eq. "DECOM_1BOND") .or. (umbr_type .eq. "ELIMINATION")) then
!
! STEP1: calculate the bondlengths and then the Xi-value
!
! a) the s1 surface: reference to the TS
!
! the forming bonds (in total form_num bonds)
!
! stop "hgpgu"
do i=1,form_num
atom1=bond_form(i,1)
atom2=bond_form(i,2)
R_f(1,i)=coords(1,atom1) - coords(1,atom2)
R_f(2,i)=coords(2,atom1) - coords(2,atom2)
R_f(3,i)=coords(3,atom1) - coords(3,atom2)
form_act(i)=sqrt(R_f(1,i)*R_f(1,i)+R_f(2,i)*R_f(2,i)+R_f(3,i)*R_f(3,i))
end do
!
! the breaking bonds (in total break_num bonds)
!
do i=1,break_num
atom1=bond_break(i,1)
atom2=bond_break(i,2)
R_b(1,i)=coords(1,atom1) - coords(1,atom2)
R_b(2,i)=coords(2,atom1) - coords(2,atom2)
R_b(3,i)=coords(3,atom1) - coords(3,atom2)
break_act(i)=sqrt(R_b(1,i)*R_b(1,i)+R_b(2,i)*R_b(2,i)+R_b(3,i)*R_b(3,i))
end do
!
! value of the TS dividing surface funtion: sum up all breaking
! bond differences and divide this through the total number of
! breaking and sum up all forming bond differences and divide this
! through the total numbe of forming
!
s1=0.d0
do i=1,break_num
s1=s1+(break_act(i)-break_ref(i))/real(break_num)
end do
do i=1,form_num
s1=s1-(form_act(i)-form_ref(i))/real(form_num)
end do
!
! value of the reactants dividing surface: analogous to TS dividing surface
!
s0=0.d0
do i=1,break_num
s0=s0+(break_act(i)-break_reac(i))/real(break_num)
end do
do i=1,form_num
s0=s0-(form_act(i)-form_reac(i))/real(form_num)
end do
!
! calculate Xi value with the RPMDrate formula
!
! for usual umbrella sampling
!
if (mode .eq. 1) then
xi_act=s0/(s0-s1)
!
! for recrossing calculation
!
else if (mode .eq. 2) then
xi_act=xi_ideal*s1+(1-xi_ideal)*s0
end if
!
! STEP2: calculate the gradient of reaction coordinate
!
!
! The transition state dividing surface
!
ds1=0.d0
!
! the forming bonds (in total, n_form forming bonds)
!
do i=1,form_num
atom1=bond_form(i,1)
atom2=bond_form(i,2)
Rinv=1.d0/form_act(i)
ds1(1,atom1) = ds1(1,atom1) - R_f(1,i) * Rinv/real(form_num)
ds1(2,atom1) = ds1(2,atom1) - R_f(2,i) * Rinv/real(form_num)
ds1(3,atom1) = ds1(3,atom1) - R_f(3,i) * Rinv/real(form_num)
ds1(1,atom2) = ds1(1,atom2) + R_f(1,i) * Rinv/real(form_num)
ds1(2,atom2) = ds1(2,atom2) + R_f(2,i) * Rinv/real(form_num)
ds1(3,atom2) = ds1(3,atom2) + R_f(3,i) * Rinv/real(form_num)
end do
!
! the breaking bonds (in total, n_break breaking bonds)
!
do i=1,break_num
atom1=bond_break(i,1)
atom2=bond_break(i,2)
Rinv=1.d0/break_act(i)
ds1(1,atom1) = ds1(1,atom1) + R_b(1,i) * Rinv/real(break_num)
ds1(2,atom1) = ds1(2,atom1) + R_b(2,i) * Rinv/real(break_num)
ds1(3,atom1) = ds1(3,atom1) + R_b(3,i) * Rinv/real(break_num)
ds1(1,atom2) = ds1(1,atom2) - R_b(1,i) * Rinv/real(break_num)
ds1(2,atom2) = ds1(2,atom2) - R_b(2,i) * Rinv/real(break_num)
ds1(3,atom2) = ds1(3,atom2) - R_b(3,i) * Rinv/real(break_num)
end do
!
! reactants dividing surface: derivatives are equal!
!
ds0=ds1
!
! Calculate the derivative of the Xi coordinate
!
! For usual umbrella sampling
!
if (mode .eq. 1) then
dxi_act=(s0*ds1-s1*ds0)/((s0-s1)*(s0-s1))
!
! For recrossing calculation
!
else if (mode .eq. 2) then
dxi_act=xi_ideal*ds1+(1-xi_ideal)*ds0
end if
!
! STEP3: calculate the hessian of the reaction coordinate
! (I don´t know why this is needed!)
!
!
! The transition state dividing surface
!
d2s1=0.d0
!
! the forming bonds (in total form_num forming bonds)
!
do i=1,form_num
atom1=bond_form(i,1)
atom2=bond_form(i,2)
Rinv=1.d0/form_act(i)
dxx = -(R_f(2,i) * R_f(2,i) + R_f(3,i) * R_f(3,i)) * (Rinv * Rinv * Rinv)
dyy = -(R_f(3,i) * R_f(3,i) + R_f(1,i) * R_f(1,i)) * (Rinv * Rinv * Rinv)
dzz = -(R_f(1,i) * R_f(1,i) + R_f(2,i) * R_f(2,i)) * (Rinv * Rinv * Rinv)
dxy = R_f(1,i) * R_f(2,i) * (Rinv * Rinv * Rinv)
dxz = R_f(1,i) * R_f(3,i) * (Rinv * Rinv * Rinv)
dyz = R_f(2,i) * R_f(3,i) * (Rinv * Rinv * Rinv)
d2s1(1,atom1,1,atom1) = d2s1(1,atom1,1,atom1) + dxx/real(form_num)
d2s1(1,atom1,2,atom1) = d2s1(1,atom1,2,atom1) + dxy/real(form_num)
d2s1(1,atom1,3,atom1) = d2s1(1,atom1,3,atom1) + dxz/real(form_num)
d2s1(2,atom1,1,atom1) = d2s1(2,atom1,1,atom1) + dxy/real(form_num)
d2s1(2,atom1,2,atom1) = d2s1(2,atom1,2,atom1) + dyy/real(form_num)
d2s1(2,atom1,3,atom1) = d2s1(2,atom1,3,atom1) + dyz/real(form_num)
d2s1(3,atom1,1,atom1) = d2s1(3,atom1,1,atom1) + dxz/real(form_num)
d2s1(3,atom1,2,atom1) = d2s1(3,atom1,2,atom1) + dyz/real(form_num)
d2s1(3,atom1,3,atom1) = d2s1(3,atom1,3,atom1) + dzz/real(form_num)
d2s1(1,atom1,1,atom2) = d2s1(1,atom1,1,atom2) - dxx/real(form_num)
d2s1(1,atom1,2,atom2) = d2s1(1,atom1,2,atom2) - dxy/real(form_num)
d2s1(1,atom1,3,atom2) = d2s1(1,atom1,3,atom2) - dxz/real(form_num)
d2s1(2,atom1,1,atom2) = d2s1(2,atom1,1,atom2) - dxy/real(form_num)
d2s1(2,atom1,2,atom2) = d2s1(2,atom1,2,atom2) - dyy/real(form_num)
d2s1(2,atom1,3,atom2) = d2s1(2,atom1,3,atom2) - dyz/real(form_num)
d2s1(3,atom1,1,atom2) = d2s1(3,atom1,1,atom2) - dxz/real(form_num)
d2s1(3,atom1,2,atom2) = d2s1(3,atom1,2,atom2) - dyz/real(form_num)
d2s1(3,atom1,3,atom2) = d2s1(3,atom1,3,atom2) - dzz/real(form_num)
d2s1(1,atom2,1,atom1) = d2s1(1,atom2,1,atom1) - dxx/real(form_num)
d2s1(1,atom2,2,atom1) = d2s1(1,atom2,2,atom1) - dxy/real(form_num)
d2s1(1,atom2,3,atom1) = d2s1(1,atom2,3,atom1) - dxz/real(form_num)
d2s1(2,atom2,1,atom1) = d2s1(2,atom2,1,atom1) - dxy/real(form_num)
d2s1(2,atom2,2,atom1) = d2s1(2,atom2,2,atom1) - dyy/real(form_num)
d2s1(2,atom2,3,atom1) = d2s1(2,atom2,3,atom1) - dyz/real(form_num)
d2s1(3,atom2,1,atom1) = d2s1(3,atom2,1,atom1) - dxz/real(form_num)
d2s1(3,atom2,2,atom1) = d2s1(3,atom2,2,atom1) - dyz/real(form_num)
d2s1(3,atom2,3,atom1) = d2s1(3,atom2,3,atom1) - dzz/real(form_num)
d2s1(1,atom2,1,atom2) = d2s1(1,atom2,1,atom2) + dxx/real(form_num)
d2s1(1,atom2,2,atom2) = d2s1(1,atom2,2,atom2) + dxy/real(form_num)
d2s1(1,atom2,3,atom2) = d2s1(1,atom2,3,atom2) + dxz/real(form_num)
d2s1(2,atom2,1,atom2) = d2s1(2,atom2,1,atom2) + dxy/real(form_num)
d2s1(2,atom2,2,atom2) = d2s1(2,atom2,2,atom2) + dyy/real(form_num)
d2s1(2,atom2,3,atom2) = d2s1(2,atom2,3,atom2) + dyz/real(form_num)
d2s1(3,atom2,1,atom2) = d2s1(3,atom2,1,atom2) + dxz/real(form_num)
d2s1(3,atom2,2,atom2) = d2s1(3,atom2,2,atom2) + dyz/real(form_num)
d2s1(3,atom2,3,atom2) = d2s1(3,atom2,3,atom2) + dzz/real(form_num)
end do
!
! the breaking bonds (in total break_num breaking bonds)
!
do i=1,break_num
atom1=bond_break(i,1)
atom2=bond_break(i,2)
Rinv=1.d0/break_act(i)
dxx = (R_b(2,i) * R_b(2,i) + R_b(3,i) * R_b(3,i)) * (Rinv * Rinv * Rinv)
dyy = (R_b(3,i) * R_b(3,i) + R_b(1,i) * R_b(1,i)) * (Rinv * Rinv * Rinv)
dzz = (R_b(1,i) * R_b(1,i) + R_b(2,i) * R_b(2,i)) * (Rinv * Rinv * Rinv)
dxy = -R_b(1,i) * R_b(2,i) * (Rinv * Rinv * Rinv)
dxz = -R_b(1,i) * R_b(3,i) * (Rinv * Rinv * Rinv)
dyz = -R_b(2,i) * R_b(3,i) * (Rinv * Rinv * Rinv)
d2s1(1,atom1,1,atom1) = d2s1(1,atom1,1,atom1) + dxx/real(break_num)
d2s1(1,atom1,2,atom1) = d2s1(1,atom1,2,atom1) + dxy/real(break_num)
d2s1(1,atom1,3,atom1) = d2s1(1,atom1,3,atom1) + dxz/real(break_num)
d2s1(2,atom1,1,atom1) = d2s1(2,atom1,1,atom1) + dxy/real(break_num)
d2s1(2,atom1,2,atom1) = d2s1(2,atom1,2,atom1) + dyy/real(break_num)
d2s1(2,atom1,3,atom1) = d2s1(2,atom1,3,atom1) + dyz/real(break_num)
d2s1(3,atom1,1,atom1) = d2s1(3,atom1,1,atom1) + dxz/real(break_num)
d2s1(3,atom1,2,atom1) = d2s1(3,atom1,2,atom1) + dyz/real(break_num)
d2s1(3,atom1,3,atom1) = d2s1(3,atom1,3,atom1) + dzz/real(break_num)
d2s1(1,atom1,1,atom2) = d2s1(1,atom1,1,atom2) - dxx/real(break_num)
d2s1(1,atom1,2,atom2) = d2s1(1,atom1,2,atom2) - dxy/real(break_num)
d2s1(1,atom1,3,atom2) = d2s1(1,atom1,3,atom2) - dxz/real(break_num)
d2s1(2,atom1,1,atom2) = d2s1(2,atom1,1,atom2) - dxy/real(break_num)
d2s1(2,atom1,2,atom2) = d2s1(2,atom1,2,atom2) - dyy/real(break_num)
d2s1(2,atom1,3,atom2) = d2s1(2,atom1,3,atom2) - dyz/real(break_num)
d2s1(3,atom1,1,atom2) = d2s1(3,atom1,1,atom2) - dxz/real(break_num)
d2s1(3,atom1,2,atom2) = d2s1(3,atom1,2,atom2) - dyz/real(break_num)
d2s1(3,atom1,3,atom2) = d2s1(3,atom1,3,atom2) - dzz/real(break_num)
d2s1(1,atom2,1,atom1) = d2s1(1,atom2,1,atom1) - dxx/real(break_num)
d2s1(1,atom2,2,atom1) = d2s1(1,atom2,2,atom1) - dxy/real(break_num)
d2s1(1,atom2,3,atom1) = d2s1(1,atom2,3,atom1) - dxz/real(break_num)
d2s1(2,atom2,1,atom1) = d2s1(2,atom2,1,atom1) - dxy/real(break_num)
d2s1(2,atom2,2,atom1) = d2s1(2,atom2,2,atom1) - dyy/real(break_num)
d2s1(2,atom2,3,atom1) = d2s1(2,atom2,3,atom1) - dyz/real(break_num)
d2s1(3,atom2,1,atom1) = d2s1(3,atom2,1,atom1) - dxz/real(break_num)
d2s1(3,atom2,2,atom1) = d2s1(3,atom2,2,atom1) - dyz/real(break_num)
d2s1(3,atom2,3,atom1) = d2s1(3,atom2,3,atom1) - dzz/real(break_num)
d2s1(1,atom2,1,atom2) = d2s1(1,atom2,1,atom2) + dxx/real(break_num)
d2s1(1,atom2,2,atom2) = d2s1(1,atom2,2,atom2) + dxy/real(break_num)
d2s1(1,atom2,3,atom2) = d2s1(1,atom2,3,atom2) + dxz/real(break_num)
d2s1(2,atom2,1,atom2) = d2s1(2,atom2,1,atom2) + dxy/real(break_num)
d2s1(2,atom2,2,atom2) = d2s1(2,atom2,2,atom2) + dyy/real(break_num)
d2s1(2,atom2,3,atom2) = d2s1(2,atom2,3,atom2) + dyz/real(break_num)
d2s1(3,atom2,1,atom2) = d2s1(3,atom2,1,atom2) + dxz/real(break_num)
d2s1(3,atom2,2,atom2) = d2s1(3,atom2,2,atom2) + dyz/real(break_num)
d2s1(3,atom2,3,atom2) = d2s1(3,atom2,3,atom2) + dzz/real(break_num)
end do
!
! The Hessian of the reactants dividing surface: equal to the TS one!
!
d2s0=d2s1
!
! Determine Hessian of the reaction coordinate from dividing surface
! hessians
!
! for usual umbrella sampling
!
if (mode .eq. 1) then
do i1 = 1, 3
do j1 = 1, Natoms
do i2 = 1, 3
do j2 = 1, Natoms
d2xi_act(i1,j1,i2,j2) = ((s0 * d2s1(i1,j1,i2,j2) + ds0(i2,j2) * ds1(i1,j1) &
& - ds1(i2,j2) * ds0(i1,j1) - s1 * d2s0(i1,j1,i2,j2)) * (s0 - s1) &
& - 2.0d0 * (s0 * ds1(i1,j1) - s1 * ds0(i1,j1)) &
& * (ds0(i2,j2) - ds1(i2,j2))) &
& / ((s0 - s1) * (s0 - s1) * (s0 - s1))
end do
end do
end do
end do
!
! For recrossing factor calculation
!
else if (mode .eq. 2) then
d2xi_act=xi_ideal*d2s1+(1-xi_ideal)*d2s0
end if
end if
return
end subroutine calc_xi