Commit 179e5ecf authored by Daniel Wortmann's avatar Daniel Wortmann

Modified treatment of displacements in relaxation from relative to absolute cooredinates

parent 9b043d6a
......@@ -37,7 +37,7 @@ CONTAINS
IF (mpi%irank==0) THEN
ALLOCATE(pos(3,atoms%ntype,1));
DO n=1,atoms%ntype
pos(:,n,1)=atoms%taual(:,SUM(atoms%neq(:n-1))+1)
pos(:,n,1)=atoms%pos(:,SUM(atoms%neq(:n-1))+1)
END DO
ALLOCATE(force(3,atoms%ntype,1)); force(:,:,1)=force_new
ALLOCATE(energies(1));energies(1)=energies_new
......@@ -62,7 +62,7 @@ CONTAINS
! this choice is based on a Debye temperature of 330K;
! modify as needed
!alpha = (250.0/(MAXVAL(atoms%zatom)*input%xa))*((330./input%thetad)**2)
CALL simple_step(input%forcealpha,force,displace)
CALL simple_step(input%forcealpha,0.25,force,displace)
ELSEIF (input%forcemix==1) THEN
CALL simple_cg(pos,force,displace)
ELSE
......@@ -73,7 +73,7 @@ CONTAINS
l_conv=.TRUE.
DO n=1,atoms%ntype
IF (DOT_PRODUCT(force(:,n,SIZE(force,3)),force(:,n,SIZE(force,3)))>input%epsforce**2) l_conv=.FALSE.
IF (DOT_PRODUCT(displace(:,n),displace(:,n))>input%epsforce**2) l_conv=.FALSE.
IF (DOT_PRODUCT(displace(:,n),displace(:,n))>input%epsdisp**2) l_conv=.FALSE.
ENDDO
!New displacements relative to positions in inp.xml
......@@ -98,15 +98,19 @@ CONTAINS
SUBROUTINE simple_step(alpha,force,displace)
SUBROUTINE simple_step(alpha,maxdisp,force,displace)
!-----------------------------------------------
IMPLICIT NONE
REAL,INTENT(in) :: alpha
REAL,INTENT(in) :: alpha,maxdisp
REAL,INTENT(in) :: force(:,:,:)
REAL,INTENT(OUT) :: displace(:,:)
real :: corr
displace = alpha*force(:,:,SIZE(force,3))
corr=maxdisp/maxval(abs(displace))
if (corr<1.0) displace = corr*alpha*force(:,:,size(force,3))
END SUBROUTINE simple_step
SUBROUTINE simple_bfgs(pos,force,shift)
......
......@@ -27,6 +27,7 @@ CONTAINS
CALL judft_error("BUG in relax_io")
ENDIF
OPEN(765,file="relax.xml",status="replace")
WRITE(765,*) "<!-- Attention, absolute coordinates used here -->"
WRITE(765,*) "<relaxation>"
!write current set of displacements
WRITE(765,*) " <displacements>"
......@@ -122,6 +123,7 @@ CONTAINS
SUBROUTINE apply_displacements(cell,input,vacuum,oneD,sym,noco,atoms)
USE m_types
USE m_chkmt
USE m_constants
USE m_mapatom
TYPE(t_input),INTENT(IN) :: input
TYPE(t_vacuum),INTENT(IN) :: vacuum
......@@ -137,6 +139,8 @@ CONTAINS
REAL :: disp(3,atoms%ntype),disp_all(3,atoms%nat),taual0(3,atoms%nat),overlap(0:atoms%ntype,atoms%ntype)
CALL read_displacements(atoms,disp)
!change displacements to internal coordinates
disp=MATMUL(cell%bmat,disp)/tpi_const
IF (ALL(ABS(disp)<1E-8)) RETURN
!Fist make sure original MT spheres do not overlap
CALL chkmt(atoms,input,vacuum,cell,oneD,.TRUE.,overlap=overlap)
......@@ -167,7 +171,7 @@ CONTAINS
WRITE(6,*) "Atomic positions including displacements:"
DO n=1,atoms%nat
WRITE(6,*) n,atoms%taual(:,n),atoms%pos(:,n)
WRITE(6,"(i4,6(1x,f12.5))") n,atoms%taual(:,n),atoms%pos(:,n)
ENDDO
END SUBROUTINE apply_displacements
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment