Dear all,
I have written a code for PBC for a cubic system, however, I need to implement PBC for a crystal lattice with different geometry (not cubic). I read that the cshift function might help, however, i feel lost regarding how to implement PBC using cshift function. My code for the cubic system is the following:
do i=1,4 !Ti - 4 atomos
n=0
do j=5,12
if (i.ne.j) then
dx=crd(1,i)-crd(1,j)
if (dx.gt.sx/2.0) dx=dx-sx
if (dx.lt.-sx/2.0) dx=dx+sx
dy=crd(2,i)-crd(2,j)
if (dy.gt.sy/2.0) dy=dy-sy
if (dy.lt.-sy/2.0) dy=dy+sy
dz=crd(3,i)-crd(3,j)
if (dz.gt.sz/2.0) dz=dz-sz
if (dz.lt.-sz/2.0) dz=dz+sz
dist=sqrt(dx**2+dy**2+dz**2)
if (dist.lt.3.2) then
! bv=exp((1.985-dist)/0.37)
! sum_bv_moc(i)=sum_bv_moc(i)+bv
n=n+1
!write(111,*)i,(j-32)
endif
endif
endif
enddo
enddo stop
These are the lattice parameters for the required geometry:
a = 6.14400 Å α = 90.0000°
b = 6.14400 Å β = 90.0000°
c = 18.72999 Å γ =120.0000°
I would like to know if someone has an idea of how to use cshift function and how implement it for PBC...
Many thanks and kind regards,
Ignacio Borge
I have written a code for PBC for a cubic system, however, I need to implement PBC for a crystal lattice with different geometry (not cubic). I read that the cshift function might help, however, i feel lost regarding how to implement PBC using cshift function. My code for the cubic system is the following:
do i=1,4 !Ti - 4 atomos
n=0
do j=5,12
if (i.ne.j) then
dx=crd(1,i)-crd(1,j)
if (dx.gt.sx/2.0) dx=dx-sx
if (dx.lt.-sx/2.0) dx=dx+sx
dy=crd(2,i)-crd(2,j)
if (dy.gt.sy/2.0) dy=dy-sy
if (dy.lt.-sy/2.0) dy=dy+sy
dz=crd(3,i)-crd(3,j)
if (dz.gt.sz/2.0) dz=dz-sz
if (dz.lt.-sz/2.0) dz=dz+sz
dist=sqrt(dx**2+dy**2+dz**2)
if (dist.lt.3.2) then
! bv=exp((1.985-dist)/0.37)
! sum_bv_moc(i)=sum_bv_moc(i)+bv
n=n+1
!write(111,*)i,(j-32)
endif
endif
endif
enddo
enddo stop
These are the lattice parameters for the required geometry:
a = 6.14400 Å α = 90.0000°
b = 6.14400 Å β = 90.0000°
c = 18.72999 Å γ =120.0000°
I would like to know if someone has an idea of how to use cshift function and how implement it for PBC...
Many thanks and kind regards,
Ignacio Borge