Fix Born-Oppenheimer dynamics with "AbsorbingBoundaries=mask"
When running Born-Oppenheimer dynamics, if the "AbsorbingBoundaries" is set to "mask", a fatal error occurs in the TD propagation.
Please see the following input:
CalculationMode = td
ExperimentalFeatures = yes
UnitsXYZFiles = atomic
UnitsOutput = atomic
Spacing = 0.5
BoxShape=parallelepiped
%Lsize
12 | 12 | 12
%
%Coordinates
'H' | 0.0000 | 0.0000 | 1.2
'H' | 0.0000 | 0.0000 | -1.2
%
%Velocities
'H' | 0.0000 | 0.0000 | 0.0000
'H' | 0.0000 | 0.0000 | 0.0000
%
%Occupations
1
1
%
SpinComponents = spin_polarized
TDDynamics = bo
TDTimeStep=0.005
TDMaxSteps = 10
AbsorbingBoundaries=mask
ABWidth=2
When running octopus-10.4, a fatal error happens at the beginning of the TD propagation:
Info: Reading states: gs. 2021/05/11 at 20:27:37
ETA: .......1......2.......3......4......5.......6......7.......8......9......0
Info: States reading done. 2021/05/11 at 20:27:37
Info: Finished reading information from 'restart/gs'.
Info: Time-dependent restart information will be written to 'restart/td'.
********************* Time-Dependent Simulation **********************
Iter Time Energy SC Steps Elapsed Time
********************************** **********************************
Info: Starting SCF iteration.
ETA: .......1......2.......3......4......5.......6......7.......8......9......0
iter 1 : etot -1.07452162E+00 : abs_dens 2.20E-07 : etime 0.0s
ETA: .......1......2.......3......4......5.......6......7.......8......9......0
iter 2 : etot -1.07452163E+00 : abs_dens 4.37E-09 : etime 0.0s
Info: SCF converged in 2 iterations
** Warning:
** Some of the states are not fully converged!
**************************** FATAL ERROR *****************************
*** Fatal Error (description follows)
*--------------------------------------------------------------------
* From node = 0
*--------------------------------------------------------------------
* Node 0:
* Assertion "this%type() /= TYPE_FLOAT"
* failed in line 637 of file "grid/batch_ops_inc.F90".
**********************************************************************
application called MPI_Abort(MPI_COMM_WORLD, 999) - process 0
This bug locates in the subroutine td_run in the file "src/td/td.F90". Please see the following codes in the file "src/td/td.F90":
!Apply mask absorbing boundaries
if (hm%bc%abtype == MASK_ABSORBING) call zvmask(gr%mesh, hm, st)
When one sets the option AbsorbingBoundaries=mask
, octopus will call the function zvmask(gr%mesh, hm, st)
. However, this zvmask(gr%mesh, hm, st)
works well only if the KS wavefunctions are complex. When one performs Born-Oppenheimer dynamics with TDDynamics = bo
, octopus will generate real KS wavefuncions, in conflict with the function types of zvmask(gr%mesh, hm, st)
.
This bug can also be found in the newest develop version.