X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=blobdiff_plain;f=source%2Funres%2FMD.F90;h=a03ce09fa0e1c14eb9c7bf460914581ec49896c4;hb=e9af9725daa77c2cfbf1c689b24ed86b01e59f4a;hp=0acdaf70f8e810e8f7a669c905749cda7ef0da27;hpb=8cd7afe8e87106d4cdd4b6361171845086971607;p=unres4.git diff --git a/source/unres/MD.F90 b/source/unres/MD.F90 index 0acdaf7..a03ce09 100644 --- a/source/unres/MD.F90 +++ b/source/unres/MD.F90 @@ -2320,6 +2320,7 @@ character(len=16) :: form integer :: IERROR,ERRCODE #endif + integer :: iranmin,itrial,itmp ! include 'COMMON.SETUP' ! include 'COMMON.CONTROL' ! include 'COMMON.VAR' @@ -2513,8 +2514,10 @@ if (overlapsc) then print *, 'Calling OVERLAP_SC' call overlap_sc(fail) + print *,'after OVERLAP' endif if (searchsc) then + print *,'call SC_MOVE' call sc_move(2,nres-1,10,1d10,nft_sc,etot) print *,'SC_move',nft_sc,etot if(me.eq.king.or..not.out1file) & @@ -2533,6 +2536,84 @@ if(me.eq.king.or..not.out1file) & write(iout,*) 'SUMSL return code is',iretcode,' eval ',nfun endif + if(iranconf.ne.0) then +!c 8/22/17 AL Loop to produce a low-energy random conformation + DO iranmin=1,40 + if (overlapsc) then + if(me.eq.king.or..not.out1file) & + write (iout,*) 'Calling OVERLAP_SC' + call overlap_sc(fail) + endif !endif overlap + + if (searchsc) then + call sc_move(2,nres-1,10,1d10,nft_sc,etot) + print *,'SC_move',nft_sc,etot + if(me.eq.king.or..not.out1file) & + write(iout,*) 'SC_move',nft_sc,etot + endif + + if(dccart)then + print *, 'Calling MINIM_DC' + call minim_dc(etot,iretcode,nfun) + else + call geom_to_var(nvar,varia) + print *,'Calling MINIMIZE.' + call minimize(etot,varia,iretcode,nfun) + call var_to_geom(nvar,varia) + endif + if(me.eq.king.or..not.out1file) & + write(iout,*) 'SUMSL return code is',iretcode,' eval ',nfun + + if (isnan(etot) .or. etot.gt.4.0d6) then + write (iout,*) "Energy too large",etot, & + " trying another random conformation" + do itrial=1,100 + itmp=1 + call gen_rand_conf(itmp,*30) + goto 40 + 30 write (iout,*) 'Failed to generate random conformation', & + ', itrial=',itrial + write (*,*) 'Processor:',me, & + ' Failed to generate random conformation',& + ' itrial=',itrial + call intout +#ifdef AIX + call flush_(iout) +#else + call flush(iout) +#endif + enddo + write (iout,'(a,i3,a)') 'Processor:',me, & + ' error in generating random conformation.' + write (*,'(a,i3,a)') 'Processor:',me, & + ' error in generating random conformation.' + call flush(iout) +#ifdef MPI +! call MPI_Abort(mpi_comm_world,error_msg,ierrcode) + call MPI_Abort(MPI_COMM_WORLD,IERROR,ERRCODE) +#else + stop +#endif + 40 continue + else + goto 44 + endif + ENDDO + + write (iout,'(a,i3,a)') 'Processor:',me, & + ' failed to generate a low-energy random conformation.' + write (*,'(a,i3,a,f10.3)') 'Processor:',me, & + ' failed to generate a low-energy random conformation.',etot + call flush(iout) + call intout +#ifdef MPI +! call MPI_Abort(mpi_comm_world,error_msg,ierrcode) + call MPI_Abort(MPI_COMM_WORLD,IERROR,ERRCODE) +#else + stop +#endif + 44 continue + endif endif call chainbuild_cart call kinetic(EK)