From: Dawid Jagiela Date: Fri, 9 Mar 2012 13:58:22 +0000 (+0100) Subject: 1) code cleanup 2) added CalcAvgDist function X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=commitdiff_plain;h=5292ed5bd4e5f8929fd456d3497b8695eb6d2c60;p=unres.git 1) code cleanup 2) added CalcAvgDist function --- diff --git a/source/ga/GA.f b/source/ga/GA.f index 13af8fe..8d5b1aa 100644 --- a/source/ga/GA.f +++ b/source/ga/GA.f @@ -11,11 +11,10 @@ integer*4 :: mnoznik = 10 character*16 :: mode,argn,argi,dir_nam character*15 :: filename - real*8 :: loc,fc,sumfitness,sump,avrp,maxfc + real*8 :: loc,fc,sumfitness,sump,avrp,maxfc,avrd real :: rand, r real*8 :: maxfcever real*8 :: FunkcjaCeluB, FunkcjaCeluB2, FunkcjaCeluR -c character*500 :: Weights2Str character(80),dimension(5) :: wagi logical :: searching = .false. logical :: logdata = .true. @@ -25,9 +24,6 @@ c character*500 :: Weights2Str logical :: debug = .true. character*200 :: text, tmptext,tmptext2 character(len=*), parameter :: FMT = "(19F10.5,E15.7,F10.5)" -c character(len=*), parameter :: FMT = "(F10.5,F10.5,F10.5,F10.5,F10& -c &.5,F10.5,F10.5,F10.5,F10.5,F10.5,F10.5,F10.5,F10.5,F10.5,F10.5,F10& -c &.5,F10.5,F10.5,F10.5,F10.5,F10.5)" c ======================================================================= c Main program @@ -187,7 +183,10 @@ c --- debug begin --- c --- debug end --- call ReadBank(bank) - + call CalcAvgDist(bank,avrd) + write(tmptext,'(F7.5)') avrd + call write2log("Average distance in bank is "//trim(tmptext)) + do i=1,BANK_MULTIPLIER*banksize write(tmptext,'(I4)') i call write2log("Checking ind "//tmptext) @@ -579,7 +578,6 @@ c ---------------------------------------------------------------------- real*8 :: ind1(19),ind2(19),temp(19) integer*4 :: loc loc = 1 + int(rand(0)/(1/18.0)) -c write (*,*) "Krzyzowanie pomiedzy pozycja ",(loc-1),"a",loc temp = ind2 do i=(loc),19 ind2(i)=ind1(i) @@ -810,7 +808,6 @@ c ====================================================================== integer :: stat integer*4 :: status character*100 :: wiersz,tmp - !character*500 :: wiersze = '' inquire(FILE=inpfn,EXIST=ex) if (ex) then status = 0 @@ -1240,30 +1237,6 @@ c &(i,13),pop(i,14),pop(i,15),pop(i,16),pop(i,17),pop(i,18),pop(i,19) c enddo c close(ow) -c ========================================== -c Testcode before WHAM+ZSCORE integration -c ========================================== -c -c plik=trim(prefix)//"/"//trim(opopsumfn) -c !print *,trim(plik) -c open(opopsum, file = plik) -c write(opopsum,'(200A)') "# WLONG WSCP WELEC WBOND WANG -c & WSCLOC WTOR WTORD WCORRH WCORR4 WCORR5 WCORR6 WEL_LOC& -c & WTURN3 WTURN4 WTURN6 WVDWPP WHPB WSCCOR SCORE" -c do I=1,rozmiar -c write(opopsum,FMT) pop(i,1),pop(i,2),pop(i,3),pop(i,4), pop(i,5)& -c &,pop(i,6),pop(i,7),pop(i,8),pop(i,9),pop(i,10),pop(i,11),pop(i,12)& -c &,pop(i,13),pop(i,14),pop(i,15),pop(i,16),pop(i,17),pop(i,18),pop(i& -c &,19),pop(i,20) -c end do -c close(opopsum) -c ========================================== - - -c command="mkdir zscore" -c call system(command) - - end subroutine CreateInputs @@ -1660,6 +1633,30 @@ c b(i,21)=b(i,20)/fitn fitn=sumfitn end subroutine +c ====================================================================== +c CalcAvgDist subroutine +c ====================================================================== +c Calculates average distance between individuals in the bank +c ---------------------------------------------------------------------- + subroutine CalcAvgDist(b,avgd) + include 'common.inc' + real*8,dimension(banksize,21) :: b + real*8 :: d,avgd + integer*4 :: nd + + d=0.0 ! distance + nd = (banksize-1)*banksize/2 ! number of distances to calculate + + do i=1,banksize-1 + do j=i+1,banksize + do w=1,19 + d=d+(b(i,w)-b(j,w))**2 + end do + end do + end do + avgd=sqrt(d)/nd + end subroutine + c ----------------------------------------------------------------------- diff --git a/source/ga/common.inc b/source/ga/common.inc index 11f004a..c484ece 100644 --- a/source/ga/common.inc +++ b/source/ga/common.inc @@ -24,6 +24,6 @@ &off,csacutoff,alg,pdbfiles,scripts,whamtemplate,mremdtemplate,gene& &ration,maxminstep,do_optima, do_ga character*7 :: version = "1.1.1" - character*50 :: info = "= Last modified by Lightnir 09/01/2012" + character*50 :: info = "= Last modified by Lightnir 09/03/2012" real*8,allocatable :: bank(:,:),populacja(:,:),temppopulacja(:,:) integer*4, allocatable :: pairs(:) diff --git a/source/ga/input-templates/matrix/start_all.pbs b/source/ga/input-templates/matrix/start_all.pbs index 83d4130..3a7a92c 100755 --- a/source/ga/input-templates/matrix/start_all.pbs +++ b/source/ga/input-templates/matrix/start_all.pbs @@ -1,4 +1,4 @@ -#PBS -N single-test +#PBS -N 1LE1-1LY2 #PBS -q dque #PBS -l nodes=32:ppn=8 #PBS -l walltime=1:00:00