msg-byu / symlib

Spacegroup finder. Includes symmetry-related routines for cluster expansion and other codes that rely on symmetries of lattices and crystals.
MIT License
12 stars 15 forks source link

Question from symmetry.f90 #9

Closed wsmorgan closed 8 years ago

wsmorgan commented 8 years ago

In the bring_into_cell subroutine I found this: '''

! If a component >= 1, translate by subtracting a lattice vector
! If a component < 0, translate by adding a lattice vector
do while(any(v >= 1.0_dp - eps) .or. any(v < 0.0_dp - eps)) 
   c = c +1
   v = merge(v, v - 1.0_dp, v <  1.0_dp - eps) 
   v = merge(v, v + 1.0_dp, v >= 0.0_dp - eps)
   if (c>maxc) stop "ERROR: loop does not end in bring_into_cell. Probably compiler bug."
enddo

'''

From what the comment in the code says it looks like we have the conditions in the merges backwards, or am I seeing this wrong?

glwhart commented 8 years ago

You're seeing it wrong. This code has been in place since 1998 or so. Not likely to be wrong...

Maybe you don't know exactly what merge does? https://gcc.gnu.org/onlinedocs/gfortran/MERGE.html

On Wed, May 4, 2016 at 12:04 AM, Wiley Morgan notifications@github.com wrote:

In the bring_into_cell subroutine I found this: '''

! If a component >= 1, translate by subtracting a lattice vector ! If a component < 0, translate by adding a lattice vector do while(any(v >= 1.0_dp - eps) .or. any(v < 0.0_dp - eps)) c = c +1 v = merge(v, v - 1.0_dp, v < 1.0_dp - eps) v = merge(v, v + 1.0_dp, v >= 0.0_dp - eps) if (c>maxc) stop "ERROR: loop does not end in bring_into_cell. Probably compiler bug." enddo

'''

From what the comment in the code says it looks like we have the conditions in the merges backwards, or am I seeing this wrong?

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/msg-byu/symlib/issues/9

Gus Hart http://msg.byu.edu

wsmorgan commented 8 years ago

Oh, I see now. I'd looked at the merge documentation but got it all switched around in my head.