1 subroutine w2x(nvarr,x,*)
4 include "DIMENSIONS.ZSCOPT"
5 include "COMMON.CONTROL"
6 include "COMMON.INTERACT"
7 include "COMMON.TORSION"
8 include "COMMON.WEIGHTS"
9 include "COMMON.ENERGIES"
10 include "COMMON.IOUNITS"
11 include "COMMON.NAMES"
13 include "COMMON.VMCPAR"
14 include "COMMON.CLASSES"
15 include "COMMON.WEIGHTDER"
16 include "COMMON.FFIELD"
17 include "COMMON.SCCOR"
18 integer itor2typ(-2:2) /-20,-20,10,9,20/
20 double precision x(max_paropt),xchuj,epsi
21 integer nvarr,i,ii,j,k,l,ll,iprot,iblock
26 if (imask(i).eq.1) then
35 c Change 9/21/07 AL Variables are epsilons and not the increments on epsilons
36 c to enable control on their deviations from original values.
37 c Single-body epsilons are now defined as epsilons of pairs of same type side
40 write (iout,*) "W2X: mod_side",mod_side," nsingle_sc",nsingle_sc,
41 & " npair_sc",npair_sc
46 eps_orig(i,j)=eps(i,j)
54 c write (iout,*) "ii",ii," x",x(ii)
57 c if (epss_up(i).eq.0.0d0) then
58 c x_up(ii)=dabs(epsi)*epss_low(i)
59 c x_low(ii)=epsi-x_up(ii)
60 c x_up(ii)=epsi+x_up(ii)
62 c x_low(ii)=epss_low(i)
72 if (ityp_ssc(j).eq.iti) then
73 write (iout,*) "Error - pair ",restyp(iti),"-",
75 & " specified in variable epsilon list but type defined",
76 & " in single-type list."
85 c if (epsp_up(i).eq.0.0d0) then
86 c x_up(ii)=dabs(epsi)*epsp_low(i)
87 c x_low(ii)=epsi-x_up(ii)
88 c x_up(ii)=epsi+x_up(ii)
90 c x_low(ii)=epsp_low(i)
93 c write (iout,*) "ii",ii," x",x(ii)
103 write (iout,*) "Indices of optimizable torsionals"
104 do i=-ntortyp+1,ntortyp-1
105 do j=-ntortyp+1,ntortyp-1
106 c write (iout,*) "mask",i,j,mask_tor(j,i)
108 if (tor_mode.eq.0) then
111 if (mask_tor(0,j,i,iblock).eq.1) then
114 x(ii)=weitor(0,j,i,iblock)
115 x_low(ii)=weitor_low(0,j,i,iblock)
116 x_up(ii)=weitor_up(0,j,i,iblock)
117 write (iout,'(2a4,2i4)') restyp(itor2typ(j)),
118 & restyp(itor2typ(i)),iblock,ii
119 else if (mask_tor(0,j,i,iblock).eq.2) then
120 do k=1,nterm(j,i,iblock)
123 x(ii)=v1(k,j,i,iblock)
124 x_low(ii)=weitor_low(0,j,i,iblock)
125 x_up(ii)=weitor_up(0,j,i,iblock)
126 write (iout,'(2a4,3i4)') restyp(itor2typ(j)),
127 & restyp(itor2typ(i)),iblock,k,ii
129 else if (mask_tor(0,j,i,iblock).gt.2) then
130 do k=1,nterm(j,i,iblock)
133 x(ii)=v1(k,j,i,iblock)
134 x_low(ii)=weitor_low(0,j,i,iblock)
135 x_up(ii)=weitor_up(0,j,i,iblock)
136 write (iout,'(2a4,3i4)') restyp(itor2typ(j)),
137 & restyp(itor2typ(i)),iblock,k,ii
139 do k=1,nterm(j,i,iblock)
142 x(ii)=v2(k,j,i,iblock)
143 x_low(ii)=weitor_low(0,j,i,iblock)
144 x_up(ii)=weitor_up(0,j,i,iblock)
145 write (iout,'(2a4,3i4)') restyp(itor2typ(j)),
146 & restyp(itor2typ(i)),ii,k,ii
151 else if (tor_mode.eq.1) then
153 if (mask_tor(0,j,i,1).eq.1) then
156 x(ii)=weitor(0,j,i,1)
157 x_low(ii)=weitor_low(0,j,i,1)
158 x_up(ii)=weitor_up(0,j,i,1)
159 write (iout,'(2a4,i4)') restyp(itor2typ(j)),
160 & restyp(itor2typ(i)),ii
161 else if (mask_tor(0,j,i,1).eq.2) then
162 do k=1,nterm_kcc(j,i)
163 do l=1,nterm_kcc_Tb(j,i)
164 do ll=1,nterm_kcc_Tb(j,i)
167 x(ii)=v1_kcc(ll,l,k,j,i)
168 x_low(ii)=weitor_low(0,j,i,1)
169 x_up(ii)=weitor_up(0,j,i,1)
170 write (iout,'(2a4,2i4)') restyp(itor2typ(j)),
171 & restyp(itor2typ(i)),k,ii
175 else if (mask_tor(0,j,i,1).gt.2) then
176 do k=1,nterm_kcc(j,i)
177 do l=1,nterm_kcc_Tb(j,i)
178 do ll=1,nterm_kcc_Tb(j,i)
181 x(ii)=v1_kcc(ll,l,k,j,i)
182 x_low(ii)=weitor_low(0,j,i,1)
183 x_up(ii)=weitor_up(0,j,i,1)
184 write (iout,'(2a4,2i4)') restyp(itor2typ(j)),
185 & restyp(itor2typ(i)),k,ii
189 do k=1,nterm_kcc(j,i)
190 do l=1,nterm_kcc_Tb(j,i)
191 do ll=1,nterm_kcc_Tb(j,i)
194 x(ii)=v2_kcc(ll,l,k,j,i)
195 x_low(ii)=weitor_low(0,j,i,1)
196 x_up(ii)=weitor_up(0,j,i,1)
197 write (iout,'(2a4,2i4)') restyp(itor2typ(j)),
198 & restyp(itor2typ(i)),k,ii
205 c Compute torsional coefficients from local energy surface expansion coeffs
206 if (mask_tor(0,j,i,1).eq.1) then
208 write (iout,*) "i",i," j",j," weitor",weitor(0,j,i,1)
209 x(ii)=weitor(0,j,i,1)
210 x_low(ii)=weitor_low(0,j,i,1)
211 x_up(ii)=weitor_up(0,j,i,1)
214 write (iout,*) "ERROR: TOR_MODE>1 ALLOWED ONLY WITH NEWCORR"
223 nbacktor_var=ntor_var
224 write (iout,*) "nbacktor_var",nbacktor_var
228 write (iout,*) "Indices of optimizable SCCOR torsionals"
229 do i=-nsccortyp,nsccortyp
230 do j=-nsccortyp,nsccortyp
232 c write (iout,*) "mask",i,j,mask_tor(j,i)
233 if (mask_tor(k,j,i,1).eq.1) then
236 x(ii)=weitor(k,j,i,1)
237 x_low(ii)=weitor_low(k,j,i,1)
238 x_up(ii)=weitor_up(k,j,i,1)
239 write (iout,'(i4,2a4,i4)') k,restyp(j),restyp(i),ii
240 else if (mask_tor(k,j,i,1).eq.2) then
241 do l=1,nterm_sccor(j,i)
244 x(ii)=v1sccor(l,k,j,i)
245 x_low(ii)=weitor_low(k,j,i,1)
246 x_up(ii)=weitor_up(k,j,i,1)
247 write (iout,'(i4,2a4,2i4)') k,restyp(j),restyp(i),l,ii
249 else if (mask_tor(k,j,i,1).gt.2) then
250 do l=1,nterm_sccor(j,i)
253 x(ii)=v1sccor(l,k,j,i)
254 x_low(ii)=weitor_low(k,j,i,1)
255 x_up(ii)=weitor_up(k,j,i,1)
256 write (iout,'(i4,2a4,2i4)') k,restyp(j),restyp(i),l,ii
258 do l=1,nterm_sccor(j,i)
261 x(ii)=v2sccor(l,k,j,i)
262 x_low(ii)=weitor_low(k,j,i,1)
263 x_up(ii)=weitor_up(k,j,i,1)
264 write (iout,'(i4,2a4,2i4)') k,restyp(j),restyp(i),l,ii
273 c Optimized cumulant coefficients
275 if (mod_fourier(nloctyp).gt.0) then
280 if (mod_fourier(i).gt.0) then
284 if (mask_bnew1(k,j,i).gt.0) then
287 x_low(ii)=bnew1_low(k,j,i)
288 x_up(ii)=bnew1_up(k,j,i)
295 if (mask_bnew2(k,j,i).gt.0) then
298 x_low(ii)=bnew2_low(k,j,i)
299 x_up(ii)=bnew2_up(k,j,i)
306 if (mask_ccnew(k,j,i).gt.0) then
309 x_low(ii)=ccnew_low(k,j,i)
310 x_up(ii)=ccnew_up(k,j,i)
317 if (mask_ddnew(k,j,i).gt.0) then
320 x_low(ii)=ddnew_low(k,j,i)
321 x_up(ii)=ddnew_up(k,j,i)
327 if (mask_e0new(j,i).gt.0) then
330 x_low(ii)=e0new_low(j,i)
331 x_up(ii)=e0new_up(j,i)
338 if (mask_eenew(l,k,j,i).gt.0) then
341 x_low(ii)=eenew_low(l,k,j,i)
342 x_up(ii)=eenew_up(l,k,j,i)
354 if (mod_fourier(i).gt.0) then
356 if (mask_fourier(j,i).gt.0) then
369 c Added SC sigmas and anisotropies
371 if (mod_side_other) then
373 if (mask_sigma(1,i).gt.0) then
376 x_low(ii)=sigma_low(1,i)
377 x_up(ii)=sigma_up(1,i)
378 c write (iout,*) "sig0",i,ii,x(ii), x_low(ii),x_up(ii)
380 if (mask_sigma(2,i).gt.0) then
383 x_low(ii)=sigma_low(2,i)
384 x_up(ii)=sigma_up(2,i)
385 c write (iout,*) "sigi",i,ii,x(ii), x_low(ii),x_up(ii)
387 if (mask_sigma(3,i).gt.0) then
390 x_low(ii)=sigma_low(3,i)
391 x_up(ii)=sigma_up(3,i)
392 c write (iout,*) "chi",i,ii,x(ii), x_low(ii),x_up(ii)
394 if (mask_sigma(4,i).gt.0) then
397 x_low(ii)=sigma_low(4,i)
398 x_up(ii)=sigma_up(4,i)
399 c write (iout,*) "alp",i,ii,x(ii), x_low(ii),x_up(ii)
409 if (mask_elec(i,j,1).gt.0) then
412 x_low(ii)=epp_low(i,j)
415 if (mask_elec(i,j,2).gt.0) then
418 x_low(ii)=rpp_low(i,j)
421 if (mask_elec(i,j,3).gt.0) then
424 x_low(ii)=elpp6_low(i,j)
425 x_up(ii)=elpp6_up(i,j)
427 if (mask_elec(i,j,4).gt.0) then
430 x_low(ii)=elpp3_low(i,j)
431 x_up(ii)=elpp3_up(i,j)
438 C Define the SC-p interaction constants
442 if (mask_scp(0,1,1)+mask_scp(0,2,1)+mask_scp(0,1,2)+
443 & mask_scp(0,2,2) .gt. 0) then
445 if (mask_scp(0,j,1).gt.0) then
448 x_low(ii)=epscp_low(0,j)
449 x_up(ii)=epscp_up(0,j)
451 if (mask_scp(0,j,2).gt.0) then
454 x_low(ii)=rscp_low(0,j)
455 x_up(ii)=rscp_up(0,j)
461 if (mask_scp(i,j,1).gt.0) then
464 x_low(ii)=epscp_low(i,j)
465 x_up(ii)=epscp_up(i,j)
467 if (mask_scp(i,j,2).gt.0) then
470 x_low(ii)=rscp_low(i,j)
471 x_up(ii)=rscp_up(i,j)
480 c Compute boundaries, if defined relative to starting values
482 write (iout,*) "i",i," x_low",x_low(i)," x_up",x_up(i)
483 if (x_up(i).eq.0.0d0 .and. x_low(i).gt.0.0d0) then
487 else if (x_up(i).eq.-1.0d0 .and. x_low(i).gt.0.0d0) then
489 if (x(i).gt.0.0d0) then
490 x_low(i)=x(i)*(1.0d0-xchuj)
491 x_up(i)=x(i)*(1.0d0+xchuj)
493 x_low(i)=x(i)*(1.0d0+xchuj)
494 x_up(i)=x(i)*(1.0d0-xchuj)
499 c Base of heat capacity
502 if (nbeta(2,iprot).gt.0) then
504 x(ii)=heatbase(iprot)
512 write (iout,*) "Number of optimizable parameters:",nvarr
514 write (iout,*) "Initial variables and boundaries:"
515 write (iout,'(3x,3a10)') "x","x_low","x_up"
517 write (iout,'(i3,3f10.5)') i,x(i),x_low(i),x_up(i)
522 c------------------------------------------------------------------------------
523 subroutine x2w(nvarr,x)
526 include "DIMENSIONS.ZSCOPT"
527 include "COMMON.CONTROL"
528 include "COMMON.NAMES"
529 include "COMMON.WEIGHTS"
530 include "COMMON.INTERACT"
531 include "COMMON.ENERGIES"
532 include "COMMON.FFIELD"
533 include "COMMON.TORSION"
534 include "COMMON.IOUNITS"
535 include "COMMON.VMCPAR"
536 include "COMMON.CLASSES"
537 include "COMMON.WEIGHTDER"
538 include "COMMON.SCCOR"
540 integer i,j,k,kk,l,ll,ii,nvarr,iti,itj,iprot,iblock
541 double precision rri,v0ij,si
542 double precision x(nvarr)
543 double precision epsij,rrij,sigeps,sigt1sq,sigt2sq,sigii1,sigii2,
544 & ratsig1,ratsig2,rsum_max,dwa16,r_augm
545 double precision eps_temp(ntyp,ntyp)
546 double precision ftune_eps,ftune_epsprim
547 logical in_sc_pair_list
548 external in_sc_pair_list
549 integer itor2typ(3) /10,9,20/
553 if (lprint) write (iout,*) "x2w: nvar",nvarr
554 if (lprint) write (iout,*) "x",(x(i),i=1,nvarr)
557 if (imask(i).eq.1) then
589 write (iout,*) "Weights:"
591 write (iout,'(a,f10.5)') wname(i),ww(i)
602 if (.not. in_sc_pair_list(iti,j)) then
603 eps(iti,j)=eps_orig(iti,j)
604 & +0.5d0*(x(ii)-eps_orig(iti,iti))
605 eps(j,iti)=eps(iti,j)
619 if (mod_tor .or. mod_fourier(nloctyp).gt.0) then
620 c write (iout,*) "w2x: mod_tor",mod_tor," mod_fourier",
621 c & mod_fourier(nloctyp)
625 do i=-ntortyp+1,ntortyp-1
626 do j=-ntortyp+1,ntortyp-1
627 if (tor_mode.eq.0) then
629 if (mask_tor(0,j,i,iblock).eq.1) then
631 weitor(0,j,i,iblock)=x(ii)
632 else if (mask_tor(0,j,i,iblock).eq.2) then
633 do k=1,nterm(j,i,iblock)
635 v1(k,j,i,iblock)=x(ii)
637 else if (mask_tor(0,j,i,iblock).gt.2) then
638 do k=1,nterm(j,i,iblock)
640 v1(k,j,i,iblock)=x(ii)
642 do k=1,nterm(j,i,iblock)
644 v2(k,j,i,iblock)=x(ii)
649 do k=1,nterm(i,j,iblock)
650 v1(k,-i,-j,iblock)=v1(k,i,j,iblock)
651 v2(k,-i,-j,iblock)=-v2(k,i,j,iblock)
652 v0ij=v0ij+si*v1(k,i,j,iblock)
655 do k=1,nlor(i,j,iblock)
656 v0ij=v0ij+vlor1(k,i,j)/(1+vlor3(k,i,j)**2)
659 v0(-i,-j,iblock)=v0ij
661 else if (tor_mode.eq.1) then
662 if (mask_tor(0,j,i,1).eq.1) then
664 weitor(0,j,i,1)=x(ii)
665 else if (mask_tor(0,j,i,1).eq.2) then
666 do k=1,nterm_kcc(j,i)
667 do l=1,nterm_kcc_Tb(j,i)
668 do ll=1,nterm_kcc_Tb(j,i)
670 v1_kcc(ll,l,k,j,i)=x(ii)
674 else if (mask_tor(0,j,i,1).gt.2) then
675 do k=1,nterm_kcc(j,i)
676 do l=1,nterm_kcc_Tb(j,i)
677 do ll=1,nterm_kcc_Tb(j,i)
679 v1_kcc(ll,l,k,j,i)=x(ii)
683 do k=1,nterm_kcc(j,i)
684 do l=1,nterm_kcc_Tb(j,i)
685 do ll=1,nterm_kcc_Tb(j,i)
687 v2_kcc(ll,l,k,j,i)=x(ii)
694 c Compute torsional coefficients from local energy surface expansion coeffs
695 if (mask_tor(0,j,i,1).eq.1) then
697 weitor(0,j,i,1)=x(ii)
698 c else if (mask_tor(0,j,i,1).eq.2) then
702 write (iout,*) "ERROR: TOR_MODE>1 ALLOWED ONLY WITH NEWCORR"
712 do i=-nsccortyp,nsccortyp
713 do j=-nsccortyp,nsccortyp
715 if (mask_tor(k,j,i,1).eq.1) then
717 weitor(k,j,i,1)=x(ii)
718 else if (mask_tor(k,j,i,1).eq.2) then
721 v1sccor(l,k,j,i)=x(ii)
723 else if (mask_tor(k,j,i,1).gt.2) then
724 do l=1,nterm_sccor(j,i)
726 v1sccor(l,k,j,i)=x(ii)
728 do l=1,nterm_sccor(j,i)
730 v2sccor(l,k,j,i)=x(ii)
739 if (mod_fourier(nloctyp).gt.0) then
744 if (mod_fourier(i).gt.0) then
748 if (mask_bnew1(k,j,i).gt.0) then
757 if (mask_bnew2(k,j,i).gt.0) then
766 if (mask_ccnew(k,j,i).gt.0) then
775 if (mask_ddnew(k,j,i).gt.0) then
783 if (mask_e0new(j,i).gt.0) then
792 if (mask_eenew(l,k,j,i).gt.0) then
806 bnew1(j,1,-i)= bnew1(j,1,i)
807 bnew1(j,2,-i)=-bnew1(j,2,i)
808 bnew2(j,1,-i)= bnew2(j,1,i)
809 bnew2(j,2,-i)=-bnew2(j,2,i)
812 c ccnew(j,1,i)=ccnew(j,1,i)/2
813 c ccnew(j,2,i)=ccnew(j,2,i)/2
814 c ddnew(j,1,i)=ddnew(j,1,i)/2
815 c ddnew(j,2,i)=ddnew(j,2,i)/2
816 ccnew(j,1,-i)=ccnew(j,1,i)
817 ccnew(j,2,-i)=-ccnew(j,2,i)
818 ddnew(j,1,-i)=ddnew(j,1,i)
819 ddnew(j,2,-i)=-ddnew(j,2,i)
821 e0new(1,-i)= e0new(1,i)
822 e0new(2,-i)=-e0new(2,i)
823 e0new(3,-i)=-e0new(3,i)
825 eenew(kk,1,1,-i)= eenew(kk,1,1,i)
826 eenew(kk,1,2,-i)=-eenew(kk,1,2,i)
827 eenew(kk,2,1,-i)=-eenew(kk,2,1,i)
828 eenew(kk,2,2,-i)= eenew(kk,2,2,i)
832 write (iout,'(a)') "Coefficients of the multibody terms"
833 do i=-nloctyp+1,nloctyp-1
834 write (iout,*) "Type: ",onelet(iloctyp(i))
835 write (iout,*) "Coefficients of the expansion of B1"
837 write (iout,'(3hB1(,i1,1h),3f10.5)') j,(bnew1(k,j,i),k=1,3)
839 write (iout,*) "Coefficients of the expansion of B2"
841 write (iout,'(3hB2(,i1,1h),3f10.5)') j,(bnew2(k,j,i),k=1,3)
843 write (iout,*) "Coefficients of the expansion of C"
844 write (iout,'(3hC11,3f10.5)') (ccnew(j,1,i),j=1,3)
845 write (iout,'(3hC12,3f10.5)') (ccnew(j,2,i),j=1,3)
846 write (iout,*) "Coefficients of the expansion of D"
847 write (iout,'(3hD11,3f10.5)') (ddnew(j,1,i),j=1,3)
848 write (iout,'(3hD12,3f10.5)') (ddnew(j,2,i),j=1,3)
849 write (iout,*) "Coefficients of the expansion of E"
850 write (iout,'(2hE0,3f10.5)') (e0new(j,i),j=1,3)
853 write (iout,'(1hE,2i1,2f10.5)') j,k,(eenew(l,j,k,i),l=1,2)
859 if (tor_mode.eq.2) then
860 c Recalculate new torsional potential coefficients
861 do i=-ntortyp+1,ntortyp-1
862 do j=-ntortyp+1,ntortyp-1
863 do k=1,nterm_kcc_Tb(j,i)
864 do l=1,nterm_kcc_Tb(j,i)
865 v1_kcc(k,l,1,i,j)=bnew1(k,1,i)*bnew2(l,1,j)
866 & +bnew1(k,2,i)*bnew2(l,2,j)
867 v2_kcc(k,l,1,i,j)=bnew1(k,1,i)*bnew2(l,2,j)
868 & +bnew1(k,2,i)*bnew2(l,1,j)
871 do k=1,nterm_kcc_Tb(j,i)
872 do l=1,nterm_kcc_Tb(j,i)
873 v1_kcc(k,l,2,i,j)=-0.25*(ccnew(k,1,i)*ddnew(l,1,j)
874 & -ccnew(k,2,i)*ddnew(l,2,j))
875 v2_kcc(k,l,2,i,j)=-0.25*(ccnew(k,2,i)*ddnew(l,1,j)
876 & +ccnew(k,1,i)*ddnew(l,2,j))
885 if (mod_fourier(i).gt.0) then
888 if (mask_fourier(j,i).gt.0) then
895 write (iout,*) "Fourier coefficients of cumulants"
896 write (iout,*) 'Type',i
897 write (iout,'(a,i2,a,f10.5)') ('b(',j,')=',b(j,i),j=1,13)
908 c B1tilde(1,i) = b(3,i)
909 c B1tilde(2,i) =-b(5,i)
916 CCold(1,1,-i)= b(7,i)
917 CCold(2,2,-i)=-b(7,i)
918 CCold(2,1,-i)=-b(9,i)
919 CCold(1,2,-i)=-b(9,i)
920 c Ctilde(1,1,i)=b(7,i)
921 c Ctilde(1,2,i)=b(9,i)
922 c Ctilde(2,1,i)=-b(9,i)
923 c Ctilde(2,2,i)=b(7,i)
928 DDold(1,1,-i)= b(6,i)
929 DDold(2,2,-i)=-b(6,i)
930 DDold(2,1,-i)=-b(8,i)
931 DDold(1,2,-i)=-b(8,i)
932 c Dtilde(1,1,i)=b(6,i)
933 c Dtilde(1,2,i)=b(8,i)
934 c Dtilde(2,1,i)=-b(8,i)
935 c Dtilde(2,2,i)=b(6,i)
936 EEold(1,1,i)= b(10,i)+b(11,i)
937 EEold(2,2,i)=-b(10,i)+b(11,i)
938 EEold(2,1,i)= b(12,i)-b(13,i)
939 EEold(1,2,i)= b(12,i)+b(13,i)
940 EEold(1,1,i)= b(10,i)+b(11,i)
941 EEold(2,2,i)=-b(10,i)+b(11,i)
942 EEold(2,1,i)= b(12,i)-b(13,i)
943 EEold(1,2,i)= b(12,i)+b(13,i)
944 EEold(1,1,-i)= b(10,i)+b(11,i)
945 EEold(2,2,-i)=-b(10,i)+b(11,i)
946 EEold(2,1,-i)=-b(12,i)+b(13,i)
947 EEold(1,2,-i)=-b(12,i)-b(13,i)
955 &"Coefficients of the cumulants (independent of valence angles)"
956 do i=-nloctyp+1,nloctyp-1
957 write (iout,*) 'Type ',onelet(iloctyp(i))
959 write(iout,'(2f10.5)') B(3,i),B(5,i)
961 write(iout,'(2f10.5)') B(2,i),B(4,i)
964 write (iout,'(2f10.5)') CCold(j,1,i),CCold(j,2,i)
968 write (iout,'(2f10.5)') DDold(j,1,i),DDold(j,2,i)
972 write (iout,'(2f10.5)') EEold(j,1,i),EEold(j,2,i)
979 c SC sigmas and anisotropies as parameters
980 if (mod_side_other) then
982 c write (iout,*) "mask",i,(mask_sigma(k,i),k=1,4)
985 if (mask_sigma(1,i).gt.0) then
988 c write(iout,*) "sig0",i,ii,x(ii)
990 if (mask_sigma(2,i).gt.0) then
993 c write(iout,*) "sigi",i,ii,x(ii)
995 if (mask_sigma(3,i).gt.0) then
998 c write(iout,*) "chip",i,ii,x(ii)
1000 if (mask_sigma(4,i).gt.0) then
1003 c write(iout,*) "alp",i,ii,x(ii)
1008 if (mod_side.or.mod_side_other) then
1009 if (lprint) write(iout,'(/3a,2i3)') 'Potential is ',
1010 & potname(ipot),', exponents are ',expon,2*expon
1011 C-----------------------------------------------------------------------
1012 C Calculate the "working" parameters of SC interactions.
1013 dwa16=2.0d0**(1.0d0/6.0d0)
1016 chip(i)=(chip0(i)-1.0D0)/(chip0(i)+1.0D0)
1021 sigma(i,j)=dsqrt(sigma0(i)**2+sigma0(j)**2)
1022 sigma(j,i)=sigma(i,j)
1023 rs0(i,j)=dwa16*sigma(i,j)
1027 if (lprint) call printmat(ntyp,ntyp,ntyp,iout,restyp,eps)
1028 if (lprint) write (iout,'(/a/10x,7a/72(1h-))')
1029 & 'Working parameters of the SC interactions:',
1030 & ' a ',' b ',' augm ',' sigma ',' r0 ',
1035 if (ipot.eq.1 .or. ipot.eq.3 .or. ipot.eq.4) then
1044 c sigeps=dsign(1.0D0,epsij)
1045 aa(i,j)=ftune_eps(epsij)*rrij*rrij
1050 sigt1sq=sigma0(i)**2
1051 sigt2sq=sigma0(j)**2
1054 ratsig1=sigt2sq/sigt1sq
1055 ratsig2=1.0D0/ratsig1
1056 chi(i,j)=(sigii1-1.0D0)/(sigii1+ratsig1)
1057 if (j.gt.i) chi(j,i)=(sigii2-1.0D0)/(sigii2+ratsig2)
1058 rsum_max=dsqrt(sigii1*sigt1sq+sigii2*sigt2sq)
1062 sigmaii(i,j)=rsum_max
1063 sigmaii(j,i)=rsum_max
1064 if ((ipot.eq.2 .or. ipot.eq.5) .and. r0(i,j).gt.rsum_max)
1066 r_augm=sigma(i,j)*(rrij-sigma(i,j))/rrij
1067 augm(i,j)=epsij*r_augm**(2*expon)
1068 c augm(i,j)=0.5D0**(2*expon)*aa(i,j)
1075 write (iout,'(2(a3,2x),3(1pe10.3),5(0pf8.3))')
1076 & restyp(i),restyp(j),aa(i,j),bb(i,j),augm(i,j),
1077 & sigma(i,j),r0(i,j),chi(i,j),chi(j,i)
1088 if (mask_elec(i,j,1).gt.0) then
1091 if (epp(i,j).lt.0.0d0) epp(i,j)=0.0d0
1094 if (mask_elec(i,j,2).gt.0) then
1096 rpp(i,j)=dabs(x(ii))
1097 rpp(j,i)=dabs(x(ii))
1099 if (mask_elec(i,j,3).gt.0) then
1102 if (elpp6(i,j).gt.0.0d0) elpp6(i,j)=0.0d0
1103 elpp6(j,i)=elpp6(i,j)
1105 if (mask_elec(i,j,4).gt.0) then
1111 app (i,j)=epp(i,j)*rri*rri
1112 app (j,i)=epp(j,i)*rri*rri
1113 bpp (i,j)=-2.0D0*epp(i,j)*rri
1114 bpp (j,i)=-2.0D0*epp(i,j)*rri
1115 ael6(i,j)=elpp6(i,j)*4.2D0**6
1116 ael6(j,i)=elpp6(i,j)*4.2D0**6
1117 ael3(i,j)=elpp3(i,j)*4.2D0**3
1118 ael3(j,i)=elpp3(i,j)*4.2D0**3
1122 write (iout,'(/a)') 'Electrostatic interaction constants:'
1123 write (iout,'(1x,a,1x,a,10x,a,11x,a,11x,a,11x,a)')
1124 & 'IT','JT','APP','BPP','AEL6','AEL3'
1127 write(iout,'(2i3,4(1pe15.4))')i,j,app(i,j),bpp(i,j),
1128 & ael6(i,j),ael3(i,j)
1135 C Define the SC-p interaction constants
1139 if (mask_scp(0,1,1)+mask_scp(0,2,1)+mask_scp(0,1,2)+
1140 & mask_scp(0,2,2) .gt. 0) then
1142 if (mask_scp(0,j,1).gt.0) then
1148 if (mask_scp(0,j,2).gt.0) then
1158 if (mask_scp(i,j,1).gt.0) then
1162 if (mask_scp(i,j,2).gt.0) then
1170 aad(i,1)=dabs(eps_scp(i,1))*rscp(i,1)**12
1171 aad(i,2)=dabs(eps_scp(i,2))*rscp(i,2)**12
1172 bad(i,1)=-2*eps_scp(i,1)*rscp(i,1)**6
1173 bad(i,2)=-2*eps_scp(i,2)*rscp(i,2)**6
1177 write (iout,*) "Parameters of SC-p interactions:"
1179 write (iout,'(4f8.3,4e12.4)') eps_scp(i,1),rscp(i,1),
1180 & eps_scp(i,2),rscp(i,2),aad(i,1),bad(i,1),aad(i,2),bad(i,2)
1187 c write (iout,*) "x2w: nvar",nvarr
1189 c Base of heat capacity
1192 if (nbeta(2,iprot).gt.0) then
1194 heatbase(iprot)=x(ii)
1198 if (ii.ne.nvarr) then
1199 write (iout,*) "!!!!! SEVERE ERROR IN X2W !!!!! (chuj nastapil)"
1200 write (iout,*) "NVAR=",nvarr," LAST VARIABLE INDEX=",ii
1201 stop "CHUJ ABSOLUTNY!!!!"
1206 c---------------------------------------------------------------------------
1207 double precision function ftune_eps(x)
1209 double precision x,y
1210 double precision delta /1.0d-5/
1211 if (dabs(x).lt.delta) then
1213 ftune_eps=delta*(3.0d0+6.0d0*y**2-y**4)/8
1219 c---------------------------------------------------------------------------
1220 double precision function ftune_epsprim(x)
1222 double precision x,y
1223 double precision delta /1.0d-5/
1224 if (dabs(x).lt.delta) then
1226 ftune_epsprim=1.5d0*y-0.5*y**3
1228 ftune_epsprim=dsign(1.0d0,x)
1232 c---------------------------------------------------------------------------
1233 double precision function ftune_epsbis(x)
1235 double precision x,y
1236 double precision delta /1.0d-5/
1237 if (dabs(x).lt.delta) then
1239 ftune_epsbis=(1.5d0-1.5d0*y**3)/delta
1245 c---------------------------------------------------------------------------
1246 logical function in_sc_pair_list(iti,itj)
1248 include "DIMENSIONS"
1249 include "DIMENSIONS.ZSCOPT"
1250 include "COMMON.WEIGHTS"
1253 if (ityp_psc(1,i).eq.iti .and. ityp_psc(2,i).eq.itj .or.
1254 & ityp_psc(1,i).eq.itj .and. ityp_psc(2,i).eq.iti) then
1255 in_sc_pair_list=.true.
1259 in_sc_pair_list=.false.