Mesh init stage2 fails for the following input
This input leads to a failure of the code
CalculationMode = gs
ExperimentalFeatures = yes
FromScratch = yes
PeriodicDimensions = 1
Dimensions = 1
Spacing = 0.3
a = 1.
%LatticeParameters
a
%
%Species
"Hydrogen1D" | species_soft_coulomb| softening | 1 | valence | 1
%
%Coordinates
"Hydrogen1D" | 0
%
%KPointsGrid
100
%
Smearing = 0.01*eV
SmearingFunction = fermi_dirac
ExtraStates = 3
SpinComponents = spinors
GuessMagnetDensity = user_defined
%AtomsMagnetDirection
0 | 0 | 1
%
The reported error is
At line 281 of file grid/mesh_init.F90
Fortran runtime error: Index '1' of dimension 1 of array 'grid_to_spatial' above upper bound of 0
Error termination. Backtrace:
#0 0x7f7f71e1fbd0 in ???
#1 0x7f7f71e20685 in ???
#2 0x7f7f71e20c76 in ???
#3 0x562500c07eca in __mesh_init_oct_m_MOD_mesh_init_stage_2
at grid/mesh_init.F90:281
#4 0x562500b637f1 in __grid_oct_m_MOD_grid_init_stage_1
at grid/grid.F90:203
#5 0x56250058ab4b in __electrons_oct_m_MOD_electrons_constructor
at electrons/electrons.F90:196
#6 0x56250041a687 in __run_oct_m_MOD_run
at main/run.F90:169
#7 0x562500419b87 in octopus
at main/main.F90:140
#8 0x562500419628 in main
at main/main.F90:26
We should add an assert to avoid that this gets unnoticed in the future and fix the code.