working martini
[unres4.git] / source / unres / data / energy_data.F90
1       module energy_data
2 !-----------------------------------------------------------------------------
3       use names
4 !-----------------------------------------------------------------------------
5 ! Max. number of energy intervals
6       integer,parameter :: max_ene=57 !10
7 !-----------------------------------------------------------------------------
8 ! Maximum number of terms in SC bond-stretching potential
9       integer,parameter :: maxbondterm=3
10 !-----------------------------------------------------------------------------
11 ! Max. number of derivatives of virtual-bond and side-chain vectors in theta
12 ! or phi.
13       integer :: maxdim
14 !-----------------------------------------------------------------------------
15 ! Max. number of contacts per residue
16       integer :: maxconts
17       integer,parameter :: maxcontsshi=50
18 !-----------------------------------------------------------------------------
19 ! Max. number of SC contacts
20       integer :: maxcont
21 ! Maximum number of valence and torsional in rigorous approach
22       integer,parameter :: maxtor_kcc=6
23       integer,parameter :: maxval_kcc=6
24       integer,parameter :: maxang_kcc=36
25
26 !-----------------------------------------------------------------------------
27 ! commom.contacts
28 !      common /contacts/
29       integer :: ncont,ncont_ref
30       integer,dimension(:,:),allocatable :: icont,icont_ref !(2,maxcont)
31 !#ifdef WHAM_RUN
32 !      integer,dimension(:),allocatable :: nsccont_frag_ref !(mmaxfrag) !wham
33 !      integer,dimension(:,:,:),allocatable :: isccont_frag_ref !(2,maxcont,mmaxfrag) !wham
34 !#endif
35 ! 12/13/2008 (again Poland-Jaruzel war anniversary)
36 !   RE: Parallelization of 4th and higher order loc-el correlations
37 !      common /contdistrib/
38       integer,dimension(:),allocatable :: iat_sent !(maxres)
39 ! iat_sent - zainicjowane w initialize_p.F;
40       integer,dimension(:,:,:),allocatable :: iint_sent,iint_sent_local !(4,maxres,maxres)
41       integer,dimension(:,:),allocatable :: iturn3_sent,iturn4_sent,&
42        iturn3_sent_local,iturn4_sent_local      !(4,maxres),
43       integer,dimension(:),allocatable :: itask_cont_from,itask_cont_to !(0:max_fg_procs-1),
44       integer :: nat_sent,ntask_cont_from,ntask_cont_to
45 !-----------------------------------------------------------------------------
46 ! commom.deriv;
47 !      common /derivat/ 
48       real(kind=8),dimension(:,:),allocatable :: dcdv,dxdv !(6,maxdim)
49       real(kind=8),dimension(:,:),allocatable :: dxds !(6,maxres)
50       real(kind=8),dimension(:,:,:),allocatable :: gradx,gradc !(3,maxres,2)
51       real(kind=8),dimension(:,:),allocatable :: gvdwx !(3,maxres)
52       real(kind=8),dimension(:,:),allocatable :: gloc,gloc_x !(maxvar,2)   ,gloc_x  !!! nie używane
53       real(kind=8),dimension(:,:,:),allocatable :: dtheta       !(3,2,maxres)
54       real(kind=8),dimension(:,:,:),allocatable :: dphi,dalpha,domega !(3,3,maxres)
55       integer :: nfl,icg
56
57 !      common /derivat/   wham
58       logical :: calc_grad
59 !      common /mpgrad/
60       integer :: igrad_start,igrad_end
61       integer,dimension(:),allocatable :: jgrad_start,jgrad_end !(maxres)
62 !-----------------------------------------------------------------------------
63 ! The following COMMON block selects the type of the force field used in
64 ! calculations and defines weights of various energy terms.
65 ! 12/1/95 wcorr added
66 !-----------------------------------------------------------------------------
67 ! common.ffield
68 !      common /ffield/
69       integer :: n_ene_comp
70       integer :: rescale_mode
71       real(kind=8) :: wsc,wscp,welec,wbond,wstrain,wtor,wtor_d,wang,&
72        wscloc,wcorr,wcorr4,wcorr5,wcorr6,wsccor,wel_loc,wturn3,wturn4,&
73        wturn6,wvdwpp,wliptran,wshield,lipscale,wtube, &
74        wbond_nucl,wang_nucl,wcorr_nucl,wcorr3_nucl,welpp,wtor_nucl,&
75        wtor_d_nucl,welsb,wsbloc,wvdwsb,welpsb,wvdwpp_nucl,wvdwpsb,wcatprot,&
76        wcatcat,wscbase,wpepbase,wscpho,wpeppho,wdihc,wcatnucl,wcat_tran,wcat_ang,&
77        wlip_prot,wmartini
78 #ifdef CLUSTER
79       real(kind=8) :: scalscp
80 #endif
81       real(kind=8),dimension(:),allocatable :: weights !(n_ene)
82       real(kind=8) :: temp0,scal14,cutoff_corr,delt_corr,r0_corr
83       integer :: ipot,ipot_nucl
84 !      common /potentials/
85       character(len=3),dimension(5) :: potname = &
86         (/'LJ ','LJK','BP ','GB ','GBV'/)
87 !-----------------------------------------------------------------------------
88 ! wlong,welec,wtor,wang,wscloc are the weight of the energy terms 
89 ! corresponding to side-chain, electrostatic, torsional, valence-angle,
90 ! and local side-chain terms.
91 !
92 ! IPOT determines which SC...SC interaction potential will be used:
93 ! 1 - LJ:  2n-n Lennard-Jones
94 ! 2 - LJK: 2n-n Kihara type (shifted Lennard-Jones) 
95 ! 3 - BP;  Berne-Pechukas (angular dependence)
96 ! 4 - GB;  Gay-Berne (angular dependence)
97 ! 5 - GBV; Gay-Berne-Vorobjev; angularly-dependent Kihara potential
98 !-----------------------------------------------------------------------------
99 ! common.interact
100 !      common /interact/
101       real(kind=8),dimension(:,:),allocatable :: aa_aq,bb_aq,augm,aa_lip,bb_lip !(ntyp,ntyp)
102       real(kind=8),dimension(:),allocatable :: sc_aa_tube_par,sc_bb_tube_par,&
103        acavtub,bcavtub,ccavtub,dcavtub,tubetranene
104       real(kind=8),dimension(:,:),allocatable :: aa_nucl,bb_nucl
105       real(kind=8) :: acavtubpep,bcavtubpep,ccavtubpep,dcavtubpep, &
106       tubetranenepep,pep_aa_tube,pep_bb_tube,tubeR0
107       real(kind=8),dimension(3) :: tubecenter
108       real(kind=8),dimension(:,:),allocatable :: aad,bad !(ntyp,2)
109       real(kind=8),dimension(2,2) :: app,bpp,ael6,ael3
110       real(kind=8),dimension(:),allocatable :: aad_nucl,bad_nucl !(ntyp,2)
111       real(kind=8),dimension(2,2) :: app_nucl,bpp_nucl
112       real(kind=8),dimension(:,:),allocatable :: ael6_nucl,&
113         ael3_nucl,ael32_nucl,ael63_nucl
114       integer :: expon,expon2, nnt,nct,itypro
115       integer,dimension(5) :: nnt_molec,nct_molec
116       integer,dimension(:,:),allocatable :: istart,iend !(maxres,maxint_gr)
117       integer,dimension(:),allocatable :: nint_gr,itel,&
118        ielstart,ielend,ielstart_vdw,ielend_vdw,nscp_gr !(maxres)
119       integer,dimension(:,:),allocatable :: istart_nucl,iend_nucl !(maxres,maxint_gr)
120       integer,dimension(:),allocatable :: nint_gr_nucl,itel_nucl,&
121        ielstart_nucl,ielend_nucl,ielstart_vdw_nucl,ielend_vdw_nucl,nscp_gr_nucl !(maxres)
122       integer,dimension(:,:),allocatable :: iscpstart_nucl,iscpend_nucl !(maxres,maxint_gr)
123
124       integer,dimension(:),allocatable :: istype,molnum
125       integer,dimension(:,:),allocatable :: itype ! now itype has more molecule types
126       integer,dimension(:,:),allocatable :: iscpstart,iscpend !(maxres,maxint_gr)
127       integer :: iatsc_s,iatsc_e,iatel_s,iatel_e,iatel_s_vdw,&
128        iatel_e_vdw,iatscp_s,iatscp_e,ispp,iscp
129       integer :: iatsc_s_nucl,iatsc_e_nucl,iatel_s_nucl,iatel_e_nucl,&
130        iatel_s_vdw_nucl,iatel_e_vdw_nucl,iatscp_s_nucl,iatscp_e_nucl,&
131        ispp_nucl,iscp_nucl
132       
133 ! 12/1/95 Array EPS included in the COMMON block.
134 !      common /body/
135       real(kind=8),dimension(:,:),allocatable :: sigma !(0:ntyp1,0:ntyp1)
136       real(kind=8),dimension(:,:),allocatable :: eps,epslip,sigmaii,&
137        rs0,chi,r0,r0e   !(ntyp,ntyp) r0e !!! nie używane
138       real(kind=8),dimension(:),allocatable :: chip,alp,sigma0,&
139        sigii,rr0        !(ntyp)
140       real(kind=8),dimension(2,2) :: rpp,epp,elpp6,elpp3
141       real(kind=8),dimension(:,:),allocatable :: sigma_nucl !(0:ntyp1,0:ntyp1)
142       real(kind=8),dimension(:,:),allocatable :: eps_nucl,sigmaii_nucl,&
143        chi_nucl,r0_nucl, chip_nucl   !(ntyp,ntyp) r0e !!! nie używane
144       real(kind=8),dimension(:),allocatable :: alp_nucl,sigma0_nucl,&
145        sigii_nucl,rr0_nucl        !(ntyp)
146       real(kind=8),dimension(2,2) :: rpp_nucl,epp_nucl
147       real(kind=8),dimension(:,:),allocatable ::elpp6_nucl,&
148        elpp3_nucl,elpp32_nucl,elpp63_nucl
149       real(kind=8):: r0pp,epspp,AEES,BEES
150
151       real(kind=8),dimension(:,:),allocatable :: r0d,eps_scp,rscp !(ntyp,2)  r0d  !!! nie używane
152       real(kind=8),dimension(:),allocatable :: eps_scp_nucl,rscp_nucl!(ntyp,2)  r0d  !!! nie używane
153
154 ! 12/5/03 modified 09/18/03 Bond stretching parameters.
155 !      common /stretch/
156       real(kind=8) :: vbldp0,akp,distchainmax,vbldpDUM
157       real(kind=8),dimension(:,:),allocatable :: vbldsc0,aksc,abond0 !(maxbondterm,ntyp)
158       real(kind=8) :: vbldp0_nucl,akp_nucl
159       real(kind=8),dimension(:,:),allocatable :: vbldsc0_nucl,&
160        aksc_nucl,abond0_nucl !(maxbondterm,ntyp)
161
162       integer,dimension(:),allocatable :: nbondterm     !(ntyp)
163       integer,dimension(:),allocatable :: nbondterm_nucl     !(ntyp)
164
165
166
167       integer,dimension(:,:),allocatable :: nterm_scend     !(ntyp)
168       real(kind=8),dimension(:,:,:),allocatable:: arotam_end
169 !-----------------------------------------------------------------------------
170 ! common.local
171 ! Parameters of ab initio-derived potential of virtual-bond-angle bending
172 !      common /theta_abinitio/
173       integer :: nthetyp,ntheterm,ntheterm2,ntheterm3,nsingle,&
174        ndouble,nntheterm
175       integer,dimension(:),allocatable :: ithetyp !(-ntyp1:ntyp1)
176       integer,dimension(:,:),allocatable :: nstate !(-ntyp1:ntyp1)
177       real(kind=8),dimension(:,:,:,:),allocatable :: aa0thet
178 !(-maxthetyp1:maxthetyp1,-maxthetyp1:maxthetyp1,-maxthetyp1:maxthetyp1,2)
179       real(kind=8),dimension(:,:,:,:,:),allocatable :: aathet
180       real(kind=8),dimension(:,:,:,:,:,:),allocatable :: bbthet,&
181        ccthet,ddthet,eethet
182 !(maxsingle,maxtheterm2,-maxthetyp1:maxthetyp1,-maxthetyp1:maxthetyp1,-maxthetyp1:maxthetyp1,2)
183       real(kind=8),dimension(:,:,:,:,:,:,:),allocatable :: ffthet,ggthet
184
185 !-----------nucleic acid parameters--------------------------
186       integer :: nthetyp_nucl,ntheterm_nucl,ntheterm2_nucl,&
187       ntheterm3_nucl,nsingle_nucl,&
188        ndouble_nucl,nntheterm_nucl
189       integer,dimension(:),allocatable :: ithetyp_nucl !(-ntyp1:ntyp1)
190       real(kind=8),dimension(:,:,:),allocatable :: aa0thet_nucl
191 !(-maxthetyp1:maxthetyp1,-maxthetyp1:maxthetyp1,-maxthetyp1:maxthetyp1,2)
192       real(kind=8),dimension(:,:,:,:),allocatable :: aathet_nucl
193       real(kind=8),dimension(:,:,:,:,:),allocatable :: bbthet_nucl,&
194        ccthet_nucl,ddthet_nucl,eethet_nucl
195 !(maxsingle,maxtheterm2,-maxthetyp1:maxthetyp1,-maxthetyp1:maxthetyp1,-maxthetyp1:maxthetyp1,2)
196       real(kind=8),dimension(:,:,:,:,:,:),allocatable :: ffthet_nucl,ggthet_nucl
197
198 !(maxdouble,maxdouble,maxtheterm3,-maxthetyp1:maxthetyp1,-maxthetyp1:maxthetyp1,-maxthetyp1:maxthetyp1,2)
199 ! Parameters of the virtual-bond-angle probability distribution
200 !      common /thetas/ 
201       real(kind=8),dimension(:),allocatable :: a0thet,theta0,&
202        sig0,sigc0       !(-ntyp:ntyp)
203       real(kind=8),dimension(:,:,:,:),allocatable :: athet,bthet !(2,-ntyp:ntyp,-1:1,-1:1)
204       real(kind=8),dimension(:,:),allocatable :: polthet        !(0:3,-ntyp:ntyp)
205       real(kind=8),dimension(:,:),allocatable :: gthet  !(3,-ntyp:ntyp)
206 ! Parameters of the side-chain probability distribution
207 !      common /sclocal/
208       real(kind=8),dimension(:),allocatable :: dsc,dsc_inv,dsc0 !(ntyp1)
209       real(kind=8),dimension(:,:),allocatable :: bsc !(maxlob,ntyp)
210       real(kind=8),dimension(:,:,:),allocatable :: censc !(3,maxlob,-ntyp:ntyp)
211       real(kind=8),dimension(:,:,:,:),allocatable :: gaussc !(3,3,maxlob,-ntyp:ntyp)
212       integer,dimension(:),allocatable :: nlob !(ntyp1)
213 ! Virtual-bond lenghts
214 !      common /peptbond/
215       real(kind=8) :: vbl,vblinv,vblinv2,vbl_cis,vbl0
216 !      common /indices/
217       integer :: loc_start,loc_end,ithet_start,ithet_end,iphi_start,&
218        iphi_end,iphid_start,iphid_end,ibond_start,ibond_end,&
219        ibondp_start,ibondp_end,ivec_start,ivec_end,iset_start,iset_end,&
220        iturn3_start,iturn3_end,iturn4_start,iturn4_end,iint_start,&
221        iint_end,iphi1_start,iphi1_end,itau_start,itau_end,&
222        ilip_start,ilip_end,itube_start,itube_end
223       integer :: ibond_nucl_start,ibond_nucl_end,iphi_nucl_start,&
224        iphi_nucl_end,iphid_nucl_start,iphid_nucl_end,& 
225        ibondp_nucl_start,ibondp_nucl_end,ithet_nucl_start,ithet_nucl_end,&
226         loc_start_nucl,loc_end_nucl
227       integer :: icatb_start,icatb_end
228       integer,dimension(:),allocatable :: ibond_displ,ibond_count,&
229        ithet_displ,ithet_count,iphi_displ,iphi_count,iphi1_displ,&
230        iphi1_count,ivec_displ,ivec_count,iset_displ,iset_count,&
231        iint_count,iint_displ    !(0:max_fg_procs-1)
232 !-----------------------------------------------------------------------------
233 ! common.MD
234 !      common /mdgrad/
235       real(kind=8),dimension(:,:),allocatable :: gcart,gxcart !(3,0:MAXRES)
236       real(kind=8),dimension(:,:),allocatable :: gradcag,gradxag !(3,MAXRES)  !!! nie używane
237 !      common /back_constr/
238       integer :: nfrag_back
239       real(kind=8) :: uconst_back
240       real(kind=8),dimension(:),allocatable :: utheta,ugamma,uscdiff !(maxfrag_back)
241       real(kind=8),dimension(:,:,:),allocatable :: wfrag_back !(3,maxfrag_back,maxprocs/20)
242       integer,dimension(:,:,:),allocatable :: ifrag_back !(3,maxfrag_back,maxprocs/20)
243 !      common /qmeas/ in module geometry
244 !-----------------------------------------------------------------------------
245 ! common.sbridge
246 !      common /sbridge/
247       real(kind=8) :: ss_depth,ebr,d0cm,akcm,akth,akct,v1ss,v2ss,v3ss
248       integer :: ns,nss,nfree
249       integer,dimension(:),allocatable :: iss   !(maxss)
250 !      common /links/
251       real(kind=8),dimension(:),allocatable :: dhpb,forcon,dhpb1,fordepth !(maxdim) !el dhpb1 !!! nie używane
252       integer :: nhpb
253       integer,dimension(:),allocatable :: ihpb,jhpb,ibecarb !(maxdim) !el ibecarb !!! nie używane
254 !      common /restraints/
255       real(kind=8) :: weidis
256 !      common /links_split/
257       integer :: link_start,link_end
258 !      common /dyn_ssbond/
259       real(kind=8) :: Ht,atriss,btriss,ctriss,dtriss
260       integer,dimension(:),allocatable :: idssb,jdssb !(maxdim)
261       logical :: dyn_ss
262       logical,dimension(:),allocatable :: dyn_ss_mask !(maxres)
263 !-----------------------------------------------------------------------------
264 ! common.sccor
265 ! Parameters of the SCCOR term
266 !      common/sccor/
267       real(kind=8),dimension(:,:,:,:),allocatable :: v1sccor,v2sccor !(maxterm_sccor,3,-ntyp:ntyp,-ntyp:ntyp)
268       real(kind=8),dimension(:,:,:),allocatable :: v0sccor !(maxterm_sccor,-ntyp:ntyp,-ntyp:ntyp)
269       integer :: nsccortyp
270       integer,dimension(:),allocatable :: isccortyp !(-ntyp:ntyp)
271       integer,dimension(:,:),allocatable :: nterm_sccor,nlor_sccor !(-ntyp:ntyp,-ntyp:ntyp)
272       real(kind=8),dimension(:,:,:),allocatable :: vlor1sccor,&
273        vlor2sccor,vlor3sccor    !(maxterm_sccor,20,20)
274       real(kind=8),dimension(:,:,:),allocatable :: gloc_sc !(3,0:maxres2,10)
275       real(kind=8),dimension(:,:,:,:),allocatable :: dtauangle !(3,3,3,maxres2)
276 !-----------------------------------------------------------------------------
277 ! common.scrot
278 ! Parameters of the SC rotamers (local) term
279 !      common/scrot/
280       real(kind=8),dimension(:,:),allocatable :: sc_parmin !(maxsccoef,ntyp)
281       real(kind=8),dimension(:,:),allocatable :: sc_parmin_nucl !(maxsccoef,ntyp)
282
283 !-----------------------------------------------------------------------------
284 ! common.torcnstr
285 !      common /torcnstr/
286       integer :: ndih_constr,ndih_nconstr,ntheta_constr
287       integer,dimension(:),allocatable :: idih_constr,idih_nconstr,itheta_constr !(maxdih_constr)
288       integer :: idihconstr_start,idihconstr_end, &
289        ithetaconstr_start,ithetaconstr_end
290 !      real(kind=8) :: ftors
291       real(kind=8),dimension(:),allocatable :: drange,theta_constr0,theta_drange !(maxdih_constr)
292       real(kind=8),dimension(:),allocatable :: phi0,ftors !(maxdih_constr)
293       real(kind=8),dimension(:),allocatable :: for_thet_constr !(maxdih_constr)
294
295 !-----------------------------------------------------------------------------
296 ! common.torsion
297 ! Torsional constants of the rotation about virtual-bond dihedral angles
298 !      common/torsion/
299       real(kind=8),dimension(:,:,:),allocatable :: v0 !(-maxtor:maxtor,-maxtor:maxtor,2)
300 #ifdef CRYST_TOR
301       real(kind=8),dimension(:,:,:),allocatable :: v1,v2 !(maxterm,-maxtor:maxtor,-maxtor:maxtor)
302 #else
303       real(kind=8),dimension(:,:,:,:),allocatable :: v1,v2 !(maxterm,-maxtor:maxtor,-maxtor:maxtor,2)
304 #endif
305       real(kind=8),dimension(:,:,:),allocatable :: vlor1 !(maxlor,-maxtor:maxtor,-maxtor:maxtor)
306       real(kind=8),dimension(:,:,:),allocatable :: vlor2,vlor3 !(maxlor,maxtor,maxtor)
307       integer,dimension(:),allocatable :: itortyp !(-ntyp1:ntyp1)
308       integer,dimension(:,:,:),allocatable :: nterm,nlor !(-maxtor:maxtor,-maxtor:maxtor,2)
309 ! ---- for rigorous approach
310       integer :: ntortyp,nterm_old
311 !      integer nloctyp
312       integer,dimension(:,:),allocatable :: nterm_kcc_Tb,nterm_kcc
313       integer,dimension(:),allocatable :: iloctyp,itype2loc
314       real(kind=8),dimension(:,:,:,:,:),allocatable :: v1_kcc,v2_kcc
315       real(kind=8),dimension(:,:),allocatable :: v1bend_chyb
316       integer,dimension(:),allocatable :: nbend_kcc_Tb
317 !------torsion nucleic
318       real(kind=8),dimension(:,:),allocatable :: v0_nucl !(-maxtor:maxtor,-maxtor:maxtor,2)
319       real(kind=8),dimension(:,:,:),allocatable :: v1_nucl,v2_nucl !(maxterm,-maxtor:maxtor,-maxtor:maxtor)
320       real(kind=8),dimension(:,:,:),allocatable :: vlor1_nucl !(maxlor,-maxtor:maxtor,-maxtor:maxtor)
321       real(kind=8),dimension(:,:,:),allocatable :: vlor2_nucl,vlor3_nucl !(maxlor,maxtor,maxtor)
322       integer,dimension(:),allocatable :: itortyp_nucl !(-ntyp1:ntyp1)
323       integer,dimension(:,:),allocatable :: nterm_nucl,nlor_nucl !(-maxtor:maxtor,-maxtor:maxtor,2)
324       integer :: ntortyp_nucl,nterm_old_nucl
325
326 ! 6/23/01 - constants for double torsionals
327 !      common /torsiond/ 
328       real(kind=8),dimension(:,:,:,:,:,:),allocatable :: v1c,v1s 
329         !(2,maxtermd_1,-maxtor:maxtor,-maxtor:maxtor,-maxtor:maxtor,2)
330       real(kind=8),dimension(:,:,:,:,:,:),allocatable :: v2c,v2s
331         !(maxtermd_2,maxtermd_2,-maxtor:maxtor,-maxtor:maxtor,-maxtor:maxtor,2)
332       integer,dimension(:,:,:,:),allocatable :: ntermd_1,ntermd_2
333         !(-maxtor:maxtor,-maxtor:maxtor,-maxtor:maxtor,2)
334 ! 9/18/99 - added Fourier coeffficients of the expansion of local energy 
335 !           surfacecommon
336 !      common/fourier/
337       real(kind=8),dimension(:,:),allocatable :: b1,b2,&
338        b1tilde,b2tilde,gtb1,gtb2!(2,-maxtor:maxtor),
339       real(kind=8),dimension(:,:,:),allocatable :: cc,dd,ee,&
340        ctilde,dtilde,bnew1,bnew2,ccnew,ddnew,bnew1tor,&
341        bnew2tor,ccnewtor,ddnewtor,ccold,ddold,eeold,&
342        gtCC,gtDD,gtEE,gtEUg
343       real(kind=8),dimension(:,:,:,:),allocatable :: eenew,eenewtor
344       real(kind=8),dimension(:,:),allocatable :: e0new,e0newtor
345       integer :: nloctyp
346 !      common/fourier/  z wham
347       real(kind=8),dimension(:,:),allocatable :: b !(13,0:maxtor)
348 !---------------MOMO---------------------------------------------------
349         integer,dimension(:),allocatable :: icharge
350         real(kind=8),dimension(:,:),allocatable :: alphapol,epshead,&
351            sig0head,sigiso1,sigiso2,rborn,sigmap1,sigmap2,chis,wquad,chipp,&
352            epsintab,debaykap
353         real(kind=8),dimension(:,:,:),allocatable :: alphasur,alphiso,&
354            wqdip,wstate,dtail
355          real(kind=8),dimension(:,:,:,:),allocatable :: dhead
356 !-----------------------------------------------------------------------------
357 ! 24 Apr 2017 
358 ! Varibles for cutoff on electorstatic
359       real(kind=8) sss_ele_cut,sss_ele_grad
360       integer xshift,yshift,zshift
361 !2 Jul 2017 lipidc parameters -----------------------------------------------------
362       real(kind=8),dimension(:), allocatable :: liptranene
363       real(kind=8) :: pepliptran
364
365 ! 4 Jul 2017 parameters for shieliding 
366       real(kind=8),dimension(:), allocatable :: long_r_sidechain, &
367         short_r_sidechain
368       real(kind=8) :: VSolvSphere,VSolvSphere_div,buff_shield
369 ! AFM
370        real(kind=8) :: distafminit,forceAFMconst,velAFMconst,&
371        velnanoconst,distnanoinit,forcenanoconst,inanomove,vecsim,vectrue
372       real(kind=8),dimension(1000) :: inanotab
373       integer :: afmend,afmbeg,nbegafmmat,nendafmmat
374       integer, dimension(1000) :: afmendcentr,afmbegcentr
375       real(kind=8),dimension(:,:), allocatable :: catprm
376       real(kind=8),dimension(:,:,:), allocatable :: catnuclprm
377
378
379          real(kind=8),dimension(:,:), allocatable ::  eps_scbase, &
380         sigma_scbase,                         &
381         sigmap1_scbase,sigmap2_scbase,        &
382         dhead_scbasei, dhead_scbasej, epshead_scbase,&
383         sig0head_scbase,  rborn_scbasei,rborn_scbasej,alphapol_scbase,epsintab_scbase,&
384         aa_scbase,bb_scbase
385          real(kind=8),dimension(:,:,:), allocatable :: alphasur_scbase, &
386         wdipdip_scbase,wqdip_scbase,chi_scbase,chipp_scbase,chis_scbase
387
388         real(kind=8),dimension(:), allocatable ::  eps_pepbase, &
389         sigma_pepbase,                         &
390         sigmap1_pepbase,sigmap2_pepbase,&
391         aa_pepbase,bb_pepbase
392
393          real(kind=8),dimension(:,:), allocatable :: alphasur_pepbase, &
394         wdipdip_pepbase,chi_pepbase,chipp_pepbase,chis_pepbase
395
396         real(kind=8),dimension(:), allocatable ::  eps_scpho, &
397         sigma_scpho,                         &
398         sigmap1_scpho,sigmap2_scpho,&
399         aa_scpho,bb_scpho,wqq_scpho,epsintab_scpho,alphapol_scpho,&
400         rborn_scphoi,rborn_scphoj,dhead_scphoi,alphi_scpho
401
402          real(kind=8),dimension(:,:), allocatable :: alphasur_scpho, &
403         chi_scpho,chipp_scpho,chis_scpho,              &
404         wqdip_scpho
405          real(kind=8) ,dimension(4) :: alphasur_peppho
406          real(kind=8) ,dimension(2) :: wqdip_peppho
407          real(kind=8) :: eps_peppho,sigma_peppho,sigmap1_peppho,sigmap2_peppho, &
408          aa_peppho,bb_peppho
409 !------------- for psi prec constraints
410          real(kind=8),dimension(:,:), allocatable :: vpsipred,sdihed
411
412 !23 Jul 2019 ions parameters by Agnieszka Lipska (Ca, K, Na, Mg, Cl)--------------------
413 !        real(kind=8),dimension(:,:),allocatable :: alphapolcat,&
414 !           epsheadcat,sig0headcat,sigiso1cat,sigiso2cat,sigmap1cat,&
415 !           sigmap2cat,wquadcat,chicat,chiscat,chippcat,&
416 !           epsintabcat,debaykapcat
417         integer,dimension(:),allocatable :: ichargecat
418 !        integer oldion
419
420         real(kind=8),dimension(:,:),allocatable :: alphapolcat, alphapolcat2, &
421            epsheadcat,sig0headcat,sigiso1cat,sigiso2cat,rborn1cat,rborn2cat,&
422            sigmap1cat,sigmap2cat,chis1cat,chis2cat,wquadcat,chipp1cat,chipp2cat,&
423            epsintabcat,debaykapcat,chi1cat,chi2cat,sigmacat, nstatecat, epscat,&
424            aa_aq_cat,bb_aq_cat
425
426         real(kind=8),dimension(:,:,:),allocatable :: alphasurcat,&
427            alphisocat,wqdipcat,dtailcat,wstatecat
428          real(kind=8),dimension(:,:,:,:),allocatable :: dheadcat
429
430
431         real(kind=8),dimension(:,:),allocatable :: alphapolmart, alphapolmart2, &
432            epsheadmart,sig0headmart,sigiso1mart,sigiso2mart,rborn1mart,rborn2mart,&
433            sigmap1mart,sigmap2mart,chis1mart,chis2mart,wquadmart,chipp1mart,chipp2mart,&
434            epsintabmart,debaykapmart,chi1mart,chi2mart,sigmamart, nstatemart, epsmart,&
435            aa_aq_mart,bb_aq_mart
436
437         real(kind=8),dimension(:,:,:),allocatable :: alphasurmart,&
438            alphisomart,wqdipmart,dtailmart,wstatemart
439          real(kind=8),dimension(:,:,:,:),allocatable :: dheadmart
440
441
442           integer,dimension(60000) :: contlistscpi_f,contlistscpj_f
443 !         integer :: ifirstrun,ilist_scp_first
444 !        real(kind=8),dimension(:,:),allocatable :: alphapol,epshead,&
445 !           sig0head,sigiso1,sigiso2,rborn,sigmap1,sigmap2,chis,wquad,chipp,&
446 !           epsintab,debaykap
447
448
449 !end of ions parameters by Agnieszka Lipska (Ca, K, Na, Mg, Cl)-----------------------
450 !
451
452 ! Parameters for transistion ions
453        real(kind=8),dimension(:,:,:),allocatable:: agamacattran,&
454        athetacattran
455        real(kind=8),dimension(:,:),allocatable::acatshiftdsc,&
456        bcatshiftdsc,demorsecat,alphamorsecat,x0catleft,x0catright,&
457        x0cattrans,aomicattr
458        real(kind=8),dimension(:),allocatable::ntrantyp
459
460 ! FRAGMENT FOR INTERACTION LIST
461         integer,dimension(:),allocatable :: newcontlistppi,newcontlistppj,&
462         newcontlisti,newcontlistj,  newcontlistscpi,newcontlistscpj,&
463         newcontlistcatscnormi,newcontlistcatscnormj,&
464         newcontlistcatpnormi,newcontlistcatpnormj,&
465         newcontlistcatsctrani,newcontlistcatsctranj,&
466         newcontlistcatptrani,newcontlistcatptranj,&
467         newcontlistcatscangi,newcontlistcatscangj,&
468         newcontlistcatscangfi,newcontlistcatscangfj,&
469         newcontlistcatscangfk,&
470         newcontlistcatscangti,newcontlistcatscangtj,&
471         newcontlistcatscangtk,newcontlistcatscangtl,&
472         newcontlistcatcatnormi,newcontlistcatcatnormj,&
473         newcontlistmartsci,newcontlistmartscj,&
474         newcontlistmartpi,newcontlistmartpj
475
476
477
478
479
480         integer :: g_listpp_start,g_listpp_end,g_listscp_start,g_listscp_end,&
481         g_listscsc_start,g_listscsc_end, &
482         g_listcatsctran_start,g_listcatsctran_end,&
483         g_listcatscnorm_start,g_listcatscnorm_end,&
484         g_listcatptran_start,g_listcatptran_end,&
485         g_listcatpnorm_start,g_listcatpnorm_end,&
486         g_ilist_catscnorm,g_ilist_catsctran,g_ilist_catpnorm,&
487         g_ilist_catptran,g_ilist_catscang,g_ilist_catscangf,g_ilist_catscangt,&
488         g_listcatscang_start,g_listcatscang_end,&
489         g_listcatscangf_start,g_listcatscangf_end,&
490         g_listcatscangt_start,g_listcatscangt_end,&
491         g_listcatcatnorm_start,g_listcatcatnorm_end,g_ilist_catcatnorm,&
492         g_ilist_martp,g_ilist_martsc,&
493         g_listmartsc_start,g_listmartsc_end,&
494         g_listmartp_start,g_listmartp_end
495
496
497
498 ! MARTINI FORCE FIELD
499         integer :: ilipbond_start,ilipbond_end,ilipang_start,ilipang_end, &
500         maxelecliplist,ilip_elec_start,ilipelec_end,maxljliplist,iliplj_start,iliplj_end,&
501         ilipbond_start_tub,ilipbond_end_tub
502         integer,dimension(:),allocatable :: mlipljlisti,mlipljlistj,&
503         mlipeleclisti,mlipeleclistj
504         real(kind=8),dimension(:,:,:),allocatable :: lip_angle_force,lip_angle_angle
505         real(kind=8),dimension(:,:),allocatable :: lip_bond,lip_eps,lip_sig
506         integer,dimension(:),allocatable :: ichargelipid     
507         real(kind=8) :: kjtokcal,krad,k_coulomb_lip,kbondlip 
508 !homology
509       integer ::  inprint,npermut,&
510        tubelog,constr_homology,homol_nset
511       logical :: mremd_dec,out_cart,&
512        out_int,gmatout,&
513        with_dihed_constr,read2sigma,start_from_model,read_homol_frag,&
514        out_template_coord,out_template_restr,loc_qlike,adaptive
515       real(kind=8) :: aincr,waga_dist,waga_angle,waga_theta,&
516        waga_d,dist2_cut
517       real(kind=8),dimension(:),allocatable :: waga_homology
518       real(kind=8),dimension(:,:),allocatable :: odl,&
519        sigma_odl,dih,sigma_dih, sigma_odlir, xxtpl,&
520        yytpl,zztpl,thetatpl,sigma_theta,sigma_d
521       integer,dimension(:),allocatable :: ires_homo,jres_homo
522       integer,dimension(:,:),allocatable :: idomain,tabpermchain,iequiv,&
523                   chain_border,chain_border1
524       integer :: lim_odl,lim_dih,link_start_homo,&
525        link_end_homo,idihconstr_start_homo,idihconstr_end_homo
526       logical,dimension(:,:),allocatable :: l_homo
527       integer ::nchain,iprzes,&
528         npermchain,&
529         nchain_group,&
530         nmodel_start,nran_start
531 !      real(kind=8),dimension(:,:),allocatable :: c,dc,dc_old,xloc,xrot,&
532 !                 dc_norm,dc_norm2,cref,crefjlee
533 !      real(kind=8),dimension(:),allocatable :: d_c_work
534       real(kind=8),dimension(:,:,:),allocatable :: chomo
535 !      real(kind=8) :: totTafm
536       character(len=256),dimension(:),allocatable:: pdbfiles_chomo
537       integer,dimension(:),allocatable :: chain_length,ireschain,&
538        nequiv,mapchain, nres_chomo
539       real(kind=8) :: enecut,sscut,sss,sssgrad
540 ! waterwater
541        real(kind=8),dimension(:),allocatable :: awaterenta,bwaterenta,&
542            cwaterenta,dwaterenta,awaterentro,bwaterentro,cwaterentro,&
543            dwaterentro
544 !       buflipbot, bufliptop,bordlipbot,bordliptop,lipbufthick,lipthick
545 !-------------------------------------------------------------------------
546         real(kind=8),dimension(3,70000) :: ea
547 #ifdef LBFGS 
548       character*9 statusbf
549       integer niter,nfun,ncalls
550 #endif
551 !      real(kind=8) :: buftubebot, buftubetop,bordtubebot,bordtubetop,tubebufthick
552       end module energy_data