Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that metadynamics uses slightly different initial geometry #807

Merged
merged 5 commits into from
Apr 26, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions src/dynamic.f90
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,11 @@ subroutine md(env,mol,chk,calc, &

real(wp) :: step,eel1,tstep,taut,xlam2,accu,driftthr
real(wp) :: Ekin,tmass,f,mintime
real(wp) :: Tinit,Tav,T,epav,ekav,dav,cma(3),bave,bavt,dum2
real(wp) :: Tinit,Tav,T,epav,ekav,dav,cma(3),bave,bavt
real(wp) :: dum,edum,eerror,xx(10),molmass,slope,maxtime
real(wp) :: tstep0,tmax,nfreedom,t0,w0,t1,w1,ep_prec,rege(4)
real(wp) :: tors(mol%n),be(3),b0(3),tor,dip(3)
real(wp) :: rcoord(3), rnorm
logical :: ex,thermostat,restart,confdump,equi,gmd,ldum

integer :: i,j,k,ic,jc,ia,ja,ii,jj,ndum,cdump,nmax,ibin
Expand All @@ -200,13 +201,14 @@ subroutine md(env,mol,chk,calc, &
integer :: ich,trj,pdb,imdl
logical :: exist

! Displace reference geometry by 1e-6
real(wp), parameter :: atom_displacement = 1.0e-6_wp

type(metadyn_setvar) :: metasetlocal
real(wp) :: emtd
real(wp) :: metatime
metatime = 0.0_wp



call delete_file('xtbmdok')

if(icall.eq.0)then
Expand Down Expand Up @@ -342,10 +344,23 @@ subroutine md(env,mol,chk,calc, &
endif
if (metasetlocal%nstruc.eq.0) then
do i = 1, mol%n
do j = 1, 3
call random_number(dum2)
metasetlocal%xyz(j,i,1) = mol%xyz(j,i) + 1.0e-6_wp*dum2
! Generate randomly displaced geometry
do while(.true.)
susilehtola marked this conversation as resolved.
Show resolved Hide resolved
rnorm = 0.0_wp
do j = 1, 3
call random_number(rcoord(j))
susilehtola marked this conversation as resolved.
Show resolved Hide resolved
rnorm = rnorm + rcoord(j)**2
enddo
! Ensure that displacement is large enough so that it
! can be normalized to the unit sphere
if(rnorm .ge. 1e-8) then
susilehtola marked this conversation as resolved.
Show resolved Hide resolved
exit
endif
enddo
! Normalize displacement to the unit sphere
rcoord = rcoord/sqrt(rnorm)
! Assign displaced geometry
metasetlocal%xyz(j,i,1) = mol%xyz(j,i) + atom_displacement*rcoord(j)
awvwgk marked this conversation as resolved.
Show resolved Hide resolved
enddo
metasetlocal%nstruc = 1
else
Expand Down