DipoleCorrection is always true for slab

Bug #1630827 reported by Chao Lian
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Siesta
Fix Released
Wishlist
Nick Papior
4.0
Fix Released
Wishlist
Nick Papior
4.1
Fix Released
Wishlist
Nick Papior

Bug Description

if ( nbcell == 2 ) then
         ! Note that we enable the correction if there is an
         ! external field
         dipole_correction = fdf_boolean("SlabDipoleCorrection",
     & .false.)
         if (acting_efield .and. (.not. dipole_correction)) then
            if (ionode) write(6,'(/,(a))')
     . 'efield: SlabDipoleCorrection turned on automatically',
     . 'efield: when an external electric field is applied.',
     . 'efield: For backward compatibility, set if to .false.'
            dipole_correction = .true.
         endif
      else
         dipole_correction = .false.
      end if

This code in m_efield.F always use True to overwrite the dipole_correction, no matter what user set, making it impossible to set it to false.

Version 4.1

Chao Lian (charleslian)
description: updated
summary: - DipoleCorrection not working for slab
+ DipoleCorrection is always true for slab
description: updated
Revision history for this message
Nick Papior (nickpapior) wrote :

Thanks for the report.

First, this always turns on the dipole-correction when there is a user-defined E-field.
This is required for the correct physics.
So as for physical correctness there is no problem.

However, this was not the case for previous siesta versions (4.0 and before).
See https://bugs.launchpad.net/siesta/+bug/1593725

I have attached a patch that defaults to true, but allows the user to specify false.
In the latter case siesta prints an error:

efield: WARNING!
efield: SlabDipoleCorrection is .false. with an external efield.
efield: For correct physics SlabDipoleCorrection should be .true.
efield: This is only for backwards compatibility!

Changed in siesta:
status: New → Triaged
importance: Undecided → Wishlist
Revision history for this message
Nick Papior (nickpapior) wrote :

Oh, sorry i should have written

"However, this was not the case for previous siesta versions (3.2 and before)."

Revision history for this message
Chao Lian (charleslian) wrote :

Thanks, Nick. Sometimes I need to turn it off for comparison.

Revision history for this message
Nick Papior (nickpapior) wrote :

Great, ok. That is the sole purpose :)

Then the patch should do you good.

The patch has been committed.

Thanks.

Nick Papior (nickpapior)
no longer affects: siesta/trunk
Nick Papior (nickpapior)
Changed in siesta:
milestone: none → 4.0.1
Nick Papior (nickpapior)
Changed in siesta:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.