From 3bbe70e61b849f1590734ab7792fa88d495916db Mon Sep 17 00:00:00 2001 From: Cezary Czaplewski Date: Fri, 25 Aug 2017 09:25:58 +0200 Subject: [PATCH] remd random start loop until low ene --- source/unres/src_MD-M/MD_A-MTS.F | 79 +++++++++++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 2 deletions(-) diff --git a/source/unres/src_MD-M/MD_A-MTS.F b/source/unres/src_MD-M/MD_A-MTS.F index ae11faf..070476d 100644 --- a/source/unres/src_MD-M/MD_A-MTS.F +++ b/source/unres/src_MD-M/MD_A-MTS.F @@ -1635,9 +1635,9 @@ c Removing the velocity of the center of mass endif c call chainbuild_cart write (iout,*) "PREMINIM ",preminim - if(iranconf.ne.0 .or. preminim) then + if(iranconf.eq.0 .and. preminim) then if (overlapsc) then - print *, 'Calling OVERLAP_SC' + write (iout,*) 'Calling OVERLAP_SC' call overlap_sc(fail) endif @@ -1664,6 +1664,81 @@ c call chainbuild_cart call enerprint(potEcomp) endif endif + if(iranconf.ne.0) then +c 8/22/17 AL Loop to produce a low-energy random conformation + DO iranmin=1,10 + if (overlapsc) then + if(me.eq.king.or..not.out1file) + & write (iout,*) 'Calling OVERLAP_SC' + call overlap_sc(fail) + endif + + 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.1.0d4) 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) +#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)') 'Processor:',me, + & ' failed to generate a low-energy random conformation.' + call flush(iout) +#ifdef MPI + call MPI_Abort(mpi_comm_world,error_msg,ierrcode) +#else + stop +#endif + 44 continue + endif endif call chainbuild_cart call kinetic(EK) -- 1.7.9.5