From: Dawid Jagiela Date: Wed, 20 Jun 2012 13:08:30 +0000 (+0200) Subject: added CMake build + fixed gfortran build X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=commitdiff_plain;h=17d0ca0cbba0334289e8ee313fd37ccf4788523d;p=unres.git added CMake build + fixed gfortran build --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 5180752..bb961d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -169,7 +169,7 @@ if(UNRES_NA_MMCE) add_subdirectory(source/cluster/unres/src) add_subdirectory(source/xdrfpdb/src) add_subdirectory(source/xdrfpdb/src-M) - + add_subdirectory(source/ga) else() add_subdirectory(source/unres/src_MD) @@ -185,6 +185,7 @@ else() add_subdirectory(source/cluster/unres/src) add_subdirectory(source/xdrfpdb/src) add_subdirectory(source/xdrfpdb/src-M) + add_subdirectory(source/ga) endif(UNRES_NA_MMCE) diff --git a/source/ga/CMakeLists.txt b/source/ga/CMakeLists.txt new file mode 100644 index 0000000..933a23c --- /dev/null +++ b/source/ga/CMakeLists.txt @@ -0,0 +1,16 @@ +# +# CMake file by D. Jagieła +# + +set(UNRES_GA_SRC + GA.f +) + + + +#========================================= +# Build the binaries +#========================================= +add_executable(unresga ${UNRES_GA_SRC} ) + + diff --git a/source/ga/GA.f b/source/ga/GA.f index aecaebc..3446217 100644 --- a/source/ga/GA.f +++ b/source/ga/GA.f @@ -4,7 +4,7 @@ include 'GA.inc' include 'common.inc' include 'io.inc' - real*16 :: WEIGHTS(18) + real*8 :: WEIGHTS(18) integer*4 :: i,j,m,n,iloc,pos,iter,maxiter,numarg,tmplen integer*4 :: WybierzOsobnika,Najlepszy,ZnajdzPodobnego,FindWorst integer*4 :: status @@ -109,16 +109,16 @@ c c Do we actual use a Genetic Algorithm? c - if (do_ga.eq..true.) then + if (do_ga.eqv..true.) then c Yes. This is only done when doing second pass with ZSCORE (without weight minimalizaton) c or with weight minimalization disabled (maxmin=0) just to obtain final score) -c \\---//================================================================ -c \\-// -c "// Genetic Algorithm code starts here -c //-\\ -c =//---\\=============================================================== +c \\---//================================================================c +c \\-// c +c "// Genetic Algorithm code starts here c +c //-\\ c +c =//---\\===============================================================c call ReadZEnergy(BANK_MULTIPLIER*banksize,populacja) do i=1,BANK_MULTIPLIER*banksize @@ -420,7 +420,7 @@ c call WritePopSum() c c Create the inputs c - write(tmptext,'(I)') generation+1 + write(tmptext,'(I3)') generation+1 call write2log("Preparing inputs for next generation ("//trim(adju& &stl(tmptext))//")") call CreateInputs(BANK_MULTIPLIER*banksize,populacja) @@ -519,7 +519,7 @@ c ---------------------------------------------------------------------- integer*4 function FindWorst(rozmiar,pop) integer*4 :: rozmiar, i, idx - real*16 :: pop,last + real*8 :: pop,last dimension pop(rozmiar,21) last=0.0 @@ -711,7 +711,7 @@ c ---------------------------------------------------------------------- include 'TEST.inc' real*8 :: osobnik(20) integer*4 :: i - FunkcjaCeluB = 20 + -exp(-abs(WLONG-osobnik(1))) & + FunkcjaCeluB = 20 -exp(-abs(WLONG-osobnik(1))) & & - exp(-abs(WSCP-osobnik(2))) & & - exp(-abs(WELEC-osobnik(3))) & & - exp(-abs(WBOND-osobnik(4))) & @@ -891,7 +891,7 @@ c GENERATIONS= select case (wiersz(1:12)) case('GENERATIONS=','generations=') tmp = wiersz(13:len_trim(wiersz)) - read(tmp,'(I)') maxgen + read(tmp,'(I4)') maxgen end select c CICUTOFF= @@ -923,7 +923,7 @@ c POPULATION= select case(wiersz(1:11)) case('POPULATION=','population=') tmp = wiersz(12:len_trim(wiersz)) - read(tmp,'(I)') banksize + read(tmp,'(I4)') banksize call write2log("Bank size is set to "//tmp) end select @@ -981,7 +981,7 @@ c MAXMIN= select case(wiersz(1:7)) case('MAXMIN=','maxmin=') tmp = wiersz(8:len_trim(wiersz)) - read(tmp,'(I)') maxminstep + read(tmp,'(I4)') maxminstep if (maxminstep.gt.0) then call write2log("ZSCORE weights minimalization set to "//tmp) do_optima=.true. @@ -1315,7 +1315,7 @@ c call write2log("Delta is "//tmp) if (delta.lt.mindelta) then mindelta=delta pozycja=i - write(tmp,'(F7.5,X,I)') delta,pozycja + write(tmp,'(F7.5,X,I4)') delta,pozycja call write2log("Delta is "//tmp) endif end do @@ -1688,7 +1688,7 @@ c ---------------------------------------------------------------------- include 'common.inc' real*8,dimension(banksize,21) :: b real*8 :: d,avgd - integer*4 :: nd + integer*4 :: nd,w d=0.0 ! distance nd = (banksize-1)*banksize/2 ! number of distances to calculate diff --git a/source/ga/GA.inc b/source/ga/GA.inc index 21e22b7..7c789f3 100644 --- a/source/ga/GA.inc +++ b/source/ga/GA.inc @@ -48,8 +48,8 @@ c -- UNRES weight-ranges values -- real*8, parameter :: WSCCOR_LOW = 0.00000 C -- UNRES weight values names -- - character*7, parameter :: WNAME(19) = (/ 'WLONG','WSCP','WELEC', & - &'WBOND','WANG','WSCLOC','WTOR','WTORD','WCORRH','WCORR4','WCORR5',& - &'WCORR6','WEL_LOC','WTURN3','WTURN4','WTURN6', 'WVDWPP','WHPB', & - &'WSCCOR' /) + character*7, parameter :: WNAME(19) = (/ 'WLONG ','WSCP ', & + &'WELEC ','WBOND ','WANG ','WSCLOC ','WTOR ','WTORD ', & + &'WCORRH ','WCORR4 ','WCORR5 ','WCORR6 ','WEL_LOC','WTURN3 ', & + &'WTURN4 ','WTURN6 ','WVDWPP ','WHPB ','WSCCOR ' /)