Skip to content

Commit

Permalink
dipole update TB (minor, still problems with PBC) (#1473)
Browse files Browse the repository at this point in the history
* dipole update TB (minor, still problems with PBC)

* Pretty
  • Loading branch information
juerghutter committed Apr 16, 2021
1 parent 41f9c21 commit 913c70a
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions src/efield_tb_methods.F
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ SUBROUTINE efield_tb_berry(qs_env, ks_matrix, rho, mcharge, energy, calculate_fo
INTEGER, DIMENSION(:, :, :), POINTER :: cell_to_index
LOGICAL :: found, use_virial
REAL(KIND=dp) :: charge, dd, dr, fdir, fi
REAL(KIND=dp), DIMENSION(3) :: aqi, fieldpol, fij, forcea, fpolvec, &
kvec, qi, rab, ria, rib, rij
REAL(KIND=dp), DIMENSION(3) :: fieldpol, fij, forcea, fpolvec, kvec, &
qi, rab, ria, rib, rij
REAL(KIND=dp), DIMENSION(3, 3) :: hmat
REAL(KIND=dp), DIMENSION(:, :), POINTER :: ds_block, ks_block, p_block, s_block
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: dsint
Expand Down Expand Up @@ -349,27 +349,6 @@ SUBROUTINE efield_tb_berry(qs_env, ks_matrix, rho, mcharge, energy, calculate_fo
END DO
qi = AIMAG(LOG(zi))
energy%efield = -SUM(fpolvec(:)*qi(:))
!deb
aqi = ATAN2(AIMAG(zi), REAL(zi, KIND=dp))
WRITE (60, *) "AIMAG-LOG ", qi
WRITE (60, *) "ATAN2 ", aqi
! ener_field = 0.0_dp
! ti = 0.0_dp
! DO idir = 1, 3
! ! make sure the total normalized polarization is within [-1:1]
! IF (qi(idir) > pi) qi(idir) = qi(idir) - twopi
! IF (qi(idir) < -pi) qi(idir) = qi(idir) + twopi
! ! now check for log branch
! IF (ABS(efield%polarisation(idir) - qi(idir)) > pi) THEN
! ti(idir) = (efield%polarisation(idir) - qi(idir))/pi
! DO i = 1, 10
! qi(idir) = cqi(idir) + SIGN(1.0_dp, ti(idir))*twopi
! IF (ABS(efield%polarisation(idir) - qi(idir)) < pi) EXIT
! END DO
! END IF
! ener_field = ener_field + fpolvec(idir)*qi(idir)
! END DO
!deb

IF (.NOT. just_energy) THEN
CALL get_qs_env(qs_env=qs_env, matrix_s_kp=matrix_s)
Expand Down

0 comments on commit 913c70a

Please sign in to comment.