update new files
[unres.git] / source / analysis / src-M-prop / cx2property.F
1 C
2 C Program to compute average properties from MREMD/WHAM results
3 C
4       implicit none
5       include 'DIMENSIONS'
6       include 'sizesclu.dat'
7 #ifdef MPI
8       include "mpif.h"
9       integer IERROR,ERRCODE,STATUS(MPI_STATUS_SIZE)
10       include "COMMON.MPI"
11 #endif
12       include 'COMMON.TIME1'
13       include 'COMMON.INTERACT'
14       include 'COMMON.NAMES'
15       include 'COMMON.GEO'
16       include 'COMMON.HEADER'
17       include 'COMMON.CONTROL'
18       include 'COMMON.CHAIN'
19       include 'COMMON.VAR'
20       include 'COMMON.CLUSTER'
21       include 'COMMON.IOUNITS'
22       include 'COMMON.FREE'
23       include 'COMMON.CONTACTS'
24       logical printang(max_cut)
25       integer printpdb(max_cut)
26       integer printmol2(max_cut)
27       character*240 lineh
28       REAL CRIT(maxconf),MEMBR(maxconf)
29       REAL CRITVAL(maxconf-1)
30       INTEGER IA(maxconf),IB(maxconf)
31       INTEGER ICLASS(maxconf,maxconf-1),HVALS(maxconf-1)
32       INTEGER IORDER(maxconf-1),HEIGHT(maxconf-1)
33       integer nn,ndis
34       integer i,j,k,l,m,n,len,lev,idum,ii,ind,ioffset,jj,icut,ncon,
35      & it,ncon_work,ind1,kkk
36       double precision t1,t2,tcpu,difconf
37       
38       double precision varia(maxvar)
39       double precision hrtime,mintime,sectime
40       logical eof
41 #ifdef MPI
42       call MPI_Init( IERROR )
43       call MPI_Comm_rank( MPI_COMM_WORLD, me, IERROR )
44       call MPI_Comm_size( MPI_COMM_WORLD, nprocs, IERROR )
45       Master = 0
46       if (ierror.gt.0) then
47         write(iout,*) "SEVERE ERROR - Can't initialize MPI."
48         call mpi_finalize(ierror)
49         stop
50       endif
51       if (nprocs.gt.MaxProcs+1) then
52         write (2,*) "Error - too many processors",
53      &   nprocs,MaxProcs+1
54         write (2,*) "Increase MaxProcs and recompile"
55         call MPI_Finalize(IERROR)
56         stop
57       endif
58 #endif
59       call initialize
60       call openunits
61       call parmread
62       call read_control
63       call molread
64       call promienie
65       if (refstr) then
66         call read_ref_structure(*30)
67         call contact(.true.,ncont_ref,icont_ref,nnt,nct)
68       endif
69       write (iout,*) 'MAIN: nnt=',nnt,' nct=',nct
70       call flush(iout)
71       call permut(symetr)
72       write (iout,*) 'MAIN: nnt=',nnt,' nct=',nct
73       call flush(iout)
74       call read_coords(ncon,*20)
75       write (iout,*) 'from read_coords: ncon',ncon
76       call flush(iout) 
77 #ifdef MPI
78       call work_partition(.true.,ncon)
79 #endif
80
81       call ave_property(ncon,*20)
82
83       t2=tcpu()
84       WRITE (iout,'(/a,1pe14.5,a/)') 
85      & 'Time for energy/property calculation:',T2-T1,' sec.'
86       t1=tcpu()
87       PRINT '(a)','End of energy/property computation'
88       call flush(iout)
89       close(icbase,status="delete")
90       write (iout,*) "icbase closed"
91       call flush(iout)
92 #ifdef MPI
93       call MPI_Finalize(MPI_COMM_WORLD,IERROR)
94       write (iout,*) "MPI finalized"
95       call flush(iout)
96 #endif
97       stop '********** Program terminated normally.'
98    20 write (iout,*) "Error reading coordinates"
99 #ifdef MPI
100       call MPI_Finalize(MPI_COMM_WORLD,IERROR)
101 #endif
102       stop
103    30 write (iout,*) "Error reading reference structure"
104 #ifdef MPI
105       call MPI_Finalize(MPI_COMM_WORLD,IERROR)
106 #endif
107       stop
108       end