shankar1729 / jdftx

JDFTx: software for joint density functional theory
http://jdftx.org
79 stars 49 forks source link

grad_k Nan no matter how large Cold smearing is #329

Closed ColinBundschu closed 1 month ago

ColinBundschu commented 1 month ago

Regardless of the size of the smearing and the type, the grad_k is still coming back nan. Note how large I set the smearing to be to demonstrate that it is not simply too small:

*************** JDFTx 1.7.0 (git hash aa096dda) ***************

Start date and time: Mon May 20 22:35:03 2024
Executable /home/cbu/jdftx/build/jdftx_gpu with command-line: -i /home/cbu/dft_out/FeNC/clean/661.in -o /home/cbu/dft_out/FeNC/clean/661.out
Running on hosts (process indices):  x3207c0s7b1n0 (0-3)
Divided in process groups (process indices):  0 (0)  1 (1)  2 (2)  3 (3)
gpuInit: Found compatible cuda device 0 'NVIDIA A100-SXM4-40GB'
gpuInit: Found compatible cuda device 1 'NVIDIA A100-SXM4-40GB'
gpuInit: Found compatible cuda device 2 'NVIDIA A100-SXM4-40GB'
gpuInit: Found compatible cuda device 3 'NVIDIA A100-SXM4-40GB'
gpuInit: Selected device 0
Resource initialization completed at t[s]:      2.57
Run totals: 4 processes, 32 threads, 4 GPUs
Memory pool size: 38000 MB (per process)

Input parsed successfully to the following command list (including defaults):

add-U   Fe d 0.129
basis kpoint-dependent
coords-type Lattice
core-overlap-check vector
coulomb-interaction Periodic
davidson-band-ratio 1.1
dump End State Stress
dump Ionic IonicPositions Stress
dump-name $INPUT.$VAR
elec-cutoff 20 100
elec-eigen-algo Davidson
elec-ex-corr gga-PBE
elec-smearing Cold 0.2
electronic-minimize  \
        dirUpdateScheme      FletcherReeves \
        linminMethod         DirUpdateRecommended \
        nIterations          150 \
        history              15 \
        knormThreshold       0 \
        maxThreshold         no \
        energyDiffThreshold  1e-06 \
        nEnergyDiff          5 \
        alphaTstart          0.1 \
        alphaTmin            1e-10 \
        updateTestStepSize   yes \
        alphaTreduceFactor   0.1 \
        alphaTincreaseFactor 3 \
        nAlphaAdjustMax      3 \
        wolfeEnergy          0.0001 \
        wolfeGradient        0.9 \
        fdTest               no
exchange-regularization WignerSeitzTruncated
fluid None
fluid-ex-corr lda-TF lda-PZ
fluid-gummel-loop 10 1.000000e-05
fluid-minimize  \
        dirUpdateScheme      PolakRibiere \
        linminMethod         DirUpdateRecommended \
        nIterations          100 \
        history              15 \
        knormThreshold       0 \
        maxThreshold         no \
        energyDiffThreshold  0 \
        nEnergyDiff          2 \
        alphaTstart          1 \
        alphaTmin            1e-10 \
        updateTestStepSize   yes \
        alphaTreduceFactor   0.1 \
        alphaTincreaseFactor 3 \
        nAlphaAdjustMax      3 \
        wolfeEnergy          0.0001 \
        wolfeGradient        0.9 \
        fdTest               no
fluid-solvent H2O 55.338 ScalarEOS \
        epsBulk 78.4 \
        pMol 0.92466 \
        epsInf 1.77 \
        Pvap 1.06736e-10 \
        sigmaBulk 4.62e-05 \
        Rvdw 2.61727 \
        Res 1.42 \
        tauNuc 343133 \
        poleEl 15 7 1
forces-output-coords Positions
initial-state 661.$VAR
ion C   0.000000000000000   0.999700000000000   0.446000000000000 1
ion C   0.000000000000000   0.499800000000000   0.444300000000000 1
ion C   0.500000000000000   0.000300000000000   0.446200000000000 1
ion C   0.438100000000000   0.127400000000000   0.446100000000000 1
ion C   0.436200000000000   0.618500000000000   0.446400000000000 1
ion C   0.937400000000000   0.124500000000000   0.445400000000000 1
ion C   0.937700000000000   0.625100000000000   0.444700000000000 1
ion C   0.374700000000000   0.252500000000000   0.445900000000000 1
ion C   0.375400000000000   0.747600000000000   0.446100000000000 1
ion C   0.875300000000000   0.249400000000000   0.444800000000000 1
ion C   0.875000000000000   0.750100000000000   0.445300000000000 1
ion C   0.309600000000000   0.375000000000000   0.445400000000000 1
ion C   0.313200000000000   0.874300000000000   0.445900000000000 1
ion C   0.814000000000000   0.374500000000000   0.444600000000000 1
ion C   0.812100000000000   0.874900000000000   0.445600000000000 1
ion C   0.250700000000000   0.999900000000000   0.445700000000000 1
ion C   0.247500000000000   0.499500000000000   0.445100000000000 1
ion C   0.749300000000000   0.999900000000000   0.445600000000000 1
ion C   0.752400000000000   0.499500000000000   0.444900000000000 1
ion C   0.187600000000000   0.124600000000000   0.445300000000000 1
ion C   0.186700000000000   0.625000000000000   0.445100000000000 1
ion C   0.686900000000000   0.125700000000000   0.445700000000000 1
ion C   0.688800000000000   0.624300000000000   0.445600000000000 1
ion C   0.124600000000000   0.249400000000000   0.444800000000000 1
ion C   0.125000000000000   0.750100000000000   0.445500000000000 1
ion C   0.625200000000000   0.252500000000000   0.445900000000000 1
ion C   0.624500000000000   0.747600000000000   0.446000000000000 1
ion C   0.062000000000000   0.374500000000000   0.444400000000000 1
ion C   0.062600000000000   0.875000000000000   0.446000000000000 1
ion C   0.561900000000000   0.873300000000000   0.446100000000000 1
ion C   0.125200000000000   0.999700000000000   0.445800000000000 1
ion C   0.123900000000000   0.499800000000000   0.444500000000000 1
ion C   0.624200000000000   0.000200000000000   0.446000000000000 1
ion C   0.629100000000000   0.499800000000000   0.445900000000000 1
ion C   0.062500000000000   0.124500000000000   0.445400000000000 1
ion C   0.062200000000000   0.625100000000000   0.444900000000000 1
ion C   0.561800000000000   0.127400000000000   0.446100000000000 1
ion C   0.563800000000000   0.618500000000000   0.446300000000000 1
ion C   0.000000000000000   0.249300000000000   0.444800000000000 1
ion C   0.000000000000000   0.750100000000000   0.445500000000000 1
ion C   0.500000000000000   0.256700000000000   0.446300000000000 1
ion C   0.500000000000000   0.745000000000000   0.446300000000000 1
ion C   0.438000000000000   0.873300000000000   0.446200000000000 1
ion C   0.937900000000000   0.374500000000000   0.444300000000000 1
ion C   0.937300000000000   0.875000000000000   0.445900000000000 1
ion C   0.375800000000000   0.000200000000000   0.446000000000000 1
ion C   0.370800000000000   0.499800000000000   0.445900000000000 1
ion C   0.874700000000000   0.999700000000000   0.445700000000000 1
ion C   0.876000000000000   0.499800000000000   0.444400000000000 1
ion C   0.313000000000000   0.125700000000000   0.445700000000000 1
ion C   0.311200000000000   0.624300000000000   0.445700000000000 1
ion C   0.812300000000000   0.124600000000000   0.445300000000000 1
ion C   0.813300000000000   0.625000000000000   0.444900000000000 1
ion C   0.249300000000000   0.249700000000000   0.445200000000000 1
ion C   0.250000000000000   0.749700000000000   0.445700000000000 1
ion C   0.750600000000000   0.249700000000000   0.445200000000000 1
ion C   0.749900000000000   0.749700000000000   0.445500000000000 1
ion C   0.185900000000000   0.374500000000000   0.444700000000000 1
ion C   0.187900000000000   0.874900000000000   0.445700000000000 1
ion C   0.690300000000000   0.375000000000000   0.445400000000000 1
ion C   0.686800000000000   0.874300000000000   0.445800000000000 1
ion C   0.062600000000000   0.041200000000000   0.445800000000000 1
ion C   0.062000000000000   0.541700000000000   0.444500000000000 1
ion C   0.561900000000000   0.042900000000000   0.446100000000000 1
ion C   0.000000000000000   0.166100000000000   0.445200000000000 1
ion C   0.000000000000000   0.666900000000000   0.445000000000000 1
ion C   0.500000000000000   0.171200000000000   0.446200000000000 1
ion C   0.500000000000000   0.659500000000000   0.446400000000000 1
ion C   0.436200000000000   0.297700000000000   0.446200000000000 1
ion C   0.438100000000000   0.788800000000000   0.446300000000000 1
ion C   0.937700000000000   0.291100000000000   0.444600000000000 1
ion C   0.937400000000000   0.791700000000000   0.445600000000000 1
ion C   0.370800000000000   0.416400000000000   0.445900000000000 1
ion C   0.375800000000000   0.916000000000000   0.446000000000000 1
ion C   0.876000000000000   0.416400000000000   0.444400000000000 1
ion C   0.874700000000000   0.916500000000000   0.445800000000000 1
ion C   0.313200000000000   0.041900000000000   0.445800000000000 1
ion C   0.309600000000000   0.541200000000000   0.445500000000000 1
ion C   0.812100000000000   0.041300000000000   0.445500000000000 1
ion C   0.814000000000000   0.541700000000000   0.444700000000000 1
ion C   0.250000000000000   0.166500000000000   0.445400000000000 1
ion C   0.249300000000000   0.666500000000000   0.445500000000000 1
ion C   0.749900000000000   0.166500000000000   0.445400000000000 1
ion C   0.750600000000000   0.666500000000000   0.445300000000000 1
ion C   0.186700000000000   0.291200000000000   0.444800000000000 1
ion C   0.187600000000000   0.791600000000000   0.445700000000000 1
ion C   0.688800000000000   0.291900000000000   0.445500000000000 1
ion C   0.686900000000000   0.790500000000000   0.445800000000000 1
ion C   0.123900000000000   0.416400000000000   0.444500000000000 1
ion C   0.125200000000000   0.916500000000000   0.445800000000000 1
ion C   0.629100000000000   0.416400000000000   0.445800000000000 1
ion C   0.624200000000000   0.916000000000000   0.446000000000000 1
ion C   0.187900000000000   0.041300000000000   0.445500000000000 1
ion C   0.185900000000000   0.541700000000000   0.444900000000000 1
ion C   0.686800000000000   0.041900000000000   0.445700000000000 1
ion C   0.690300000000000   0.541200000000000   0.445400000000000 1
ion C   0.125000000000000   0.166100000000000   0.445200000000000 1
ion C   0.124600000000000   0.666800000000000   0.445200000000000 1
ion C   0.624500000000000   0.168600000000000   0.445900000000000 1
ion C   0.625200000000000   0.663700000000000   0.446000000000000 1
ion C   0.062200000000000   0.291100000000000   0.444600000000000 1
ion C   0.062500000000000   0.791700000000000   0.445700000000000 1
ion C   0.563800000000000   0.297700000000000   0.446200000000000 1
ion C   0.561800000000000   0.788800000000000   0.446200000000000 1
ion C   0.000000000000000   0.416400000000000   0.444300000000000 1
ion C   0.000000000000000   0.916500000000000   0.446100000000000 1
ion C   0.500000000000000   0.915900000000000   0.446200000000000 1
ion C   0.438000000000000   0.042900000000000   0.446100000000000 1
ion C   0.937300000000000   0.041200000000000   0.445800000000000 1
ion C   0.937900000000000   0.541700000000000   0.444400000000000 1
ion C   0.375400000000000   0.168600000000000   0.445900000000000 1
ion C   0.374700000000000   0.663700000000000   0.446100000000000 1
ion C   0.875000000000000   0.166100000000000   0.445200000000000 1
ion C   0.875300000000000   0.666800000000000   0.445000000000000 1
ion C   0.311200000000000   0.291900000000000   0.445500000000000 1
ion C   0.313000000000000   0.790500000000000   0.445900000000000 1
ion C   0.813300000000000   0.291200000000000   0.444800000000000 1
ion C   0.812300000000000   0.791600000000000   0.445500000000000 1
ion C   0.247500000000000   0.416700000000000   0.445000000000000 1
ion C   0.250700000000000   0.916300000000000   0.445800000000000 1
ion C   0.752400000000000   0.416700000000000   0.444900000000000 1
ion C   0.749300000000000   0.916300000000000   0.445700000000000 1
ion N   0.567200000000000   0.378800000000000   0.446300000000000 1
ion N   0.432700000000000   0.378800000000000   0.446300000000000 1
ion N   0.567200000000000   0.537400000000000   0.446300000000000 1
ion N   0.432700000000000   0.537400000000000   0.446400000000000 1
ion Fe   0.500000000000000   0.458100000000000   0.446600000000000 1
ion-species GBRV/$ID_pbe.uspp
ion-width 0
ionic-minimize  \
        dirUpdateScheme      L-BFGS \
        linminMethod         DirUpdateRecommended \
        nIterations          0 \
        history              15 \
        knormThreshold       0.0001 \
        maxThreshold         no \
        energyDiffThreshold  1e-06 \
        nEnergyDiff          2 \
        alphaTstart          1 \
        alphaTmin            1e-10 \
        updateTestStepSize   yes \
        alphaTreduceFactor   0.1 \
        alphaTincreaseFactor 3 \
        nAlphaAdjustMax      3 \
        wolfeEnergy          0.0001 \
        wolfeGradient        0.9 \
        fdTest               no
kpoint   0.500000000000   0.500000000000   0.000000000000  1.00000000000000
kpoint-folding 3 3 1
latt-move-scale 1 1 1
latt-scale 1 1 1
lattice Orthorhombic 37.2276 32.3143 41.574
lattice-minimize  \
        dirUpdateScheme      L-BFGS \
        linminMethod         DirUpdateRecommended \
        nIterations          0 \
        history              15 \
        knormThreshold       0 \
        maxThreshold         no \
        energyDiffThreshold  1e-06 \
        nEnergyDiff          2 \
        alphaTstart          1 \
        alphaTmin            1e-10 \
        updateTestStepSize   yes \
        alphaTreduceFactor   0.1 \
        alphaTincreaseFactor 3 \
        nAlphaAdjustMax      3 \
        wolfeEnergy          0.0001 \
        wolfeGradient        0.9 \
        fdTest               no
lcao-params 150 1e-06 0.2
pcm-variant GLSSA13
perturb-minimize  \
        nIterations            0 \
        algorithm              MINRES \
        residualTol            0.0001 \
        residualDiffThreshold  0.0001 \
        CGBypass               no \
        recomputeResidual      no
spintype z-spin
subspace-rotation-factor 1 yes
symmetries automatic
symmetry-threshold 0.0001

---------- Setting up symmetries ----------

Found 8 point-group symmetries of the bravais lattice
Found 1 space-group symmetries with basis
Applied RMS atom displacement 0 bohrs to make symmetries exact.

---------- Initializing the Grid ----------
R =
[      37.2276            0            0  ]
[            0      32.3143            0  ]
[            0            0       41.574  ]
unit cell volume = 50012.9
G =
[   0.168778          0          0  ]
[          0    0.19444          0  ]
[          0          0   0.151133  ]
Minimum fftbox size, Smin = [  168  148  188  ]
Chosen fftbox size, S = [  168  150  192  ]

---------- Initializing tighter grid for wavefunction operations ----------
R =
[      37.2276            0            0  ]
[            0      32.3143            0  ]
[            0            0       41.574  ]
unit cell volume = 50012.9
G =
[   0.168778          0          0  ]
[          0    0.19444          0  ]
[          0          0   0.151133  ]
Minimum fftbox size, Smin = [  152  132  168  ]
Chosen fftbox size, S = [  160  140  168  ]

---------- Exchange Correlation functional ----------
Initalized PBE GGA exchange.
Initalized PBE GGA correlation.

---------- Setting up pseudopotentials ----------
Width of ionic core gaussian charges (only for fluid interactions / plotting) set to 0

Reading pseudopotential file '/home/cbu/jdftx/build/pseudopotentials/GBRV/c_pbe.uspp':
  Title: C.  Created by USPP 7.3.6 on 3-2-2014
  Reference state energy: -5.406344.  4 valence electrons in orbitals:
    |200>  occupation: 2  eigenvalue: -0.504890
    |210>  occupation: 2  eigenvalue: -0.194356
  lMax: 1  lLocal: 2  QijEcut: 5
  4 projectors sampled on a log grid with 503 points:
    l: 0  eig: -0.504890  rCut: 1.3
    l: 0  eig: 0.000000  rCut: 1.3
    l: 1  eig: -0.194357  rCut: 1.3
    l: 1  eig: 0.000000  rCut: 1.3
  Partial core density with radius 1.1
  Transforming core density to a uniform radial grid of dG=0.02 with 1255 points.
  Transforming local potential to a uniform radial grid of dG=0.02 with 1255 points.
  Transforming nonlocal projectors to a uniform radial grid of dG=0.02 with 432 points.
  Transforming density augmentations to a uniform radial grid of dG=0.02 with 1255 points.
  Transforming atomic orbitals to a uniform radial grid of dG=0.02 with 432 points.
  Core radius for overlap checks: 1.30 bohrs.

Reading pseudopotential file '/home/cbu/jdftx/build/pseudopotentials/GBRV/n_pbe.uspp':
  Title: N.  Created by USPP 7.3.6 on 3-2-2014
  Reference state energy: -9.763716.  5 valence electrons in orbitals:
    |200>  occupation: 2  eigenvalue: -0.681964
    |210>  occupation: 3  eigenvalue: -0.260726
  lMax: 1  lLocal: 2  QijEcut: 6
  4 projectors sampled on a log grid with 491 points:
    l: 0  eig: -0.681964  rCut: 1.15
    l: 0  eig: 0.000000  rCut: 1.15
    l: 1  eig: -0.260729  rCut: 1.2
    l: 1  eig: 0.500000  rCut: 1.2
  Partial core density with radius 0.8
  Transforming core density to a uniform radial grid of dG=0.02 with 1255 points.
  Transforming local potential to a uniform radial grid of dG=0.02 with 1255 points.
  Transforming nonlocal projectors to a uniform radial grid of dG=0.02 with 432 points.
  Transforming density augmentations to a uniform radial grid of dG=0.02 with 1255 points.
  Transforming atomic orbitals to a uniform radial grid of dG=0.02 with 432 points.
  Core radius for overlap checks: 1.20 bohrs.

Reading pseudopotential file '/home/cbu/jdftx/build/pseudopotentials/GBRV/fe_pbe.uspp':
  Title: Fe.  Created by USPP 7.3.6 on 15-6-15
  Reference state energy: -124.316937.  16 valence electrons in orbitals:
    |300>  occupation: 2  eigenvalue: -4.008817
    |310>  occupation: 6  eigenvalue: -2.753096
    |320>  occupation: 5  eigenvalue: -0.791264
    |400>  occupation: 2  eigenvalue: -0.516384
    |410>  occupation: 0  eigenvalue: -0.312222
  lMax: 2  lLocal: 3  QijEcut: 6
  6 projectors sampled on a log grid with 607 points:
    l: 0  eig: -4.008819  rCut: 1.55
    l: 0  eig: -0.516386  rCut: 1.55
    l: 1  eig: -2.753096  rCut: 1.55
    l: 1  eig: -0.312226  rCut: 1.55
    l: 2  eig: -0.791264  rCut: 1.65
    l: 2  eig: -0.450000  rCut: 1.65
  Partial core density with radius 0.65
  Transforming core density to a uniform radial grid of dG=0.02 with 1255 points.
  Transforming local potential to a uniform radial grid of dG=0.02 with 1255 points.
  Transforming nonlocal projectors to a uniform radial grid of dG=0.02 with 432 points.
  Transforming density augmentations to a uniform radial grid of dG=0.02 with 1255 points.
  Transforming atomic orbitals to a uniform radial grid of dG=0.02 with 432 points.
  Core radius for overlap checks: 1.65 bohrs.

Initialized 3 species with 127 total atoms.

Folded 1 k-points by 3x3x1 to 9 k-points.

---------- Setting up k-points, bands, fillings ----------
Adding inversion symmetry to k-mesh for non-inversion-symmetric unit cell.
Reduced to 5 k-points under symmetry.
Computing the number of bands and number of electrons
Calculating initial fillings.
nElectrons: 524.000000   nBands: 517   nStates: 10

----- Setting up reduced wavefunction bases (one per k-point) -----
average nbasis = 213642.222 , ideal nbasis = 213658.714

---------- Setting up ewald sum ----------
Optimum gaussian width for ewald sums = 6.555965 bohr.
Real space sum over 343 unit cells with max indices [  3  3  3  ]
Reciprocal space sum over 9177 terms with max indices [  10  9  11  ]

---------- Allocating electronic variables ----------
Reading eigenvalues from '661.eigenvals'.
Initializing wave functions:  linear combination of atomic orbitals
C pseudo-atom occupations:   s ( 2 )  p ( 2 )
N pseudo-atom occupations:   s ( 2 )  p ( 3 )
Fe pseudo-atom occupations:   s ( 2 0 )  p ( 6 0 )  d ( 8 )
        FillingsUpdate:  mu: -0.063351830  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00582  Tot: +0.00000 ]
LCAOMinimize: Iter:   0  F: -828.5129872832608271  |grad|_K:  8.506e-03  alpha:  1.000e+00
        FillingsUpdate:  mu: -0.130466299  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00583  Tot: -0.00000 ]
LCAOMinimize: Iter:   1  F: -833.9895346241100924  |grad|_K:  8.248e-03  alpha:  1.286e-01  linmin:  6.629e-02  cgtest: -5.819e-01  t[s]:     37.25
        FillingsUpdate:  mu: -0.164598520  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00581  Tot: +0.00000 ]
LCAOMinimize: Iter:   2  F: -837.1039578565554393  |grad|_K:  9.302e-03  alpha:  1.789e-02  linmin: -1.434e-01  cgtest:  9.180e-01  t[s]:     42.32
LCAOMinimize:   Predicted alpha/alphaT>3.000000, increasing alphaT to 5.365663e-02.
        FillingsUpdate:  mu: -0.159043538  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00573  Tot: +0.00000 ]
LCAOMinimize: Iter:   3  F: -845.0231934968778660  |grad|_K:  6.465e-03  alpha:  6.177e-02  linmin:  1.601e-01  cgtest:  3.712e-01  t[s]:     48.50
        FillingsUpdate:  mu: -0.142548928  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00575  Tot: +0.00000 ]
LCAOMinimize: Iter:   4  F: -847.9150946583240511  |grad|_K:  2.686e-03  alpha:  5.807e-02  linmin:  2.842e-02  cgtest:  2.620e-01  t[s]:     53.54
        FillingsUpdate:  mu: -0.159176776  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00577  Tot: -0.00000 ]
LCAOMinimize: Iter:   5  F: -848.6758884625509154  |grad|_K:  7.801e-04  alpha:  7.914e-02  linmin:  3.812e-04  cgtest:  2.511e-02  t[s]:     58.61
        FillingsUpdate:  mu: -0.157630974  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00579  Tot: +0.00000 ]
LCAOMinimize: Iter:   6  F: -848.7618742209336915  |grad|_K:  4.224e-04  alpha:  1.053e-01  linmin:  7.037e-04  cgtest: -5.615e-03  t[s]:     63.67
        FillingsUpdate:  mu: -0.159499104  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00580  Tot: +0.00000 ]
LCAOMinimize: Iter:   7  F: -848.7859033245904357  |grad|_K:  2.184e-04  alpha:  1.004e-01  linmin:  4.342e-03  cgtest: -3.063e-03  t[s]:     68.77
        FillingsUpdate:  mu: -0.158719530  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00582  Tot: +0.00000 ]
LCAOMinimize: Iter:   8  F: -848.7919995357854077  |grad|_K:  1.330e-04  alpha:  9.557e-02  linmin:  2.000e-04  cgtest:  1.387e-02  t[s]:     73.83
        FillingsUpdate:  mu: -0.159125019  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00585  Tot: +0.00000 ]
LCAOMinimize: Iter:   9  F: -848.7956094427206608  |grad|_K:  8.341e-05  alpha:  1.522e-01  linmin:  8.507e-04  cgtest:  4.158e-04  t[s]:     78.90
        FillingsUpdate:  mu: -0.159742089  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00588  Tot: +0.00000 ]
LCAOMinimize: Iter:  10  F: -848.7975898091439149  |grad|_K:  6.052e-05  alpha:  2.123e-01  linmin: -1.015e-03  cgtest:  6.926e-03  t[s]:     83.94
        FillingsUpdate:  mu: -0.159454661  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00589  Tot: +0.00000 ]
LCAOMinimize: Iter:  11  F: -848.7980564717312291  |grad|_K:  4.510e-05  alpha:  9.484e-02  linmin:  1.665e-04  cgtest: -5.503e-03  t[s]:     89.00
        FillingsUpdate:  mu: -0.159681571  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00590  Tot: +0.00000 ]
LCAOMinimize: Iter:  12  F: -848.7984500269269574  |grad|_K:  1.644e-05  alpha:  1.442e-01  linmin: -6.360e-04  cgtest:  4.060e-03  t[s]:     94.06
        FillingsUpdate:  mu: -0.159701710  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00591  Tot: +0.00000 ]
LCAOMinimize: Iter:  13  F: -848.7984980092560363  |grad|_K:  1.085e-05  alpha:  1.323e-01  linmin: -1.191e-03  cgtest:  1.182e-03  t[s]:     99.16
        FillingsUpdate:  mu: -0.159685540  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00591  Tot: +0.00000 ]
LCAOMinimize: Iter:  14  F: -848.7985195612079679  |grad|_K:  7.748e-06  alpha:  1.364e-01  linmin:  2.284e-03  cgtest: -7.397e-03  t[s]:    104.22
        FillingsUpdate:  mu: -0.159758751  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00592  Tot: -0.00000 ]
LCAOMinimize: Iter:  15  F: -848.7985263556871587  |grad|_K:  3.814e-06  alpha:  8.466e-02  linmin:  2.026e-05  cgtest:  1.036e-02  t[s]:    109.28
        FillingsUpdate:  mu: -0.159778126  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00592  Tot: -0.00000 ]
LCAOMinimize: Iter:  16  F: -848.7985302687309286  |grad|_K:  3.428e-06  alpha:  2.004e-01  linmin: -2.806e-04  cgtest: -1.452e-03  t[s]:    114.33
        FillingsUpdate:  mu: -0.159782652  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00593  Tot: +0.00000 ]
LCAOMinimize: Iter:  17  F: -848.7985321293391507  |grad|_K:  2.014e-06  alpha:  1.226e-01  linmin: -5.562e-05  cgtest: -1.506e-03  t[s]:    119.39
        FillingsUpdate:  mu: -0.159817962  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00593  Tot: -0.00000 ]
LCAOMinimize: Iter:  18  F: -848.7985330595633968  |grad|_K:  1.786e-06  alpha:  1.896e-01  linmin:  5.517e-02  cgtest: -1.918e-01  t[s]:    124.46
        FillingsUpdate:  mu: -0.159817464  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00593  Tot: +0.00000 ]
LCAOMinimize: Iter:  19  F: -848.7985332340166451  |grad|_K:  1.068e-06  alpha:  7.310e-02  linmin: -8.362e-05  cgtest:  4.742e-01  t[s]:    129.52
LCAOMinimize: Converged (|Delta F|<1.000000e-06 for 2 iters).

---- Citations for features of the code used in this run ----

   Software package:
      R. Sundararaman, K. Letchworth-Weaver, K.A. Schwarz, D. Gunceler, Y. Ozhabes and T.A. Arias, 'JDFTx: software for joint density-functional theory', SoftwareX 6, 278 (2017)

   Simplified rotationally-invariant DFT+U:
      S. L. Dudarev et al., Phys. Rev. B 57, 1505 (1998)

   gga-PBE exchange-correlation functional:
      J.P. Perdew, K. Burke and M. Ernzerhof, Phys. Rev. Lett. 77, 3865 (1996)

   Pseudopotentials:
      KF Garrity, JW Bennett, KM Rabe and D Vanderbilt, Comput. Mater. Sci. 81, 446 (2014)

   Total energy minimization with Auxiliary Hamiltonian:
      C. Freysoldt, S. Boeck, and J. Neugebauer, Phys. Rev. B 79, 241103(R) (2009)

This list may not be complete. Please suggest additional citations or
report any other bugs at https://github.com/shankar1729/jdftx/issues

Initialization completed successfully at t[s]:    130.34

-------- Electronic minimization -----------
        FillingsUpdate:  mu: -0.159817128  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00593  Tot: -0.00000 ]
ElecMinimize: Iter:   0  F: -848.798496397487952  |grad|_K:       -nan  alpha:  1.000e-01
ElecMinimize:   Predicted alpha/alphaT>3.000000, increasing alphaT to 3.000000e-01.
        FillingsUpdate:  mu: -0.045688595  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00373  Tot: -0.00000 ]
        SubspaceRotationAdjust: set factor to 0.993
ElecMinimize: Iter:   1  F: -855.795935529994495  |grad|_K:       -nan  alpha:  7.117e-01  linmin: -1.157e-03  t[s]:    145.36
        FillingsUpdate:  mu: -0.033448730  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00375  Tot: -0.00000 ]
        SubspaceRotationAdjust: set factor to 0.684
ElecMinimize: Iter:   2  F: -856.096541837077211  |grad|_K:       -nan  alpha:  1.095e-01  linmin:  1.710e-04  t[s]:    153.10
        FillingsUpdate:  mu: -0.038291222  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00504  Tot: +0.00000 ]
        SubspaceRotationAdjust: set factor to 0.477
ElecMinimize: Iter:   3  F: -856.550112067157897  |grad|_K:       -nan  alpha:  2.121e-01  linmin:  3.963e-05  t[s]:    160.85
        FillingsUpdate:  mu: -0.053596226  nElectrons: 524.000000  magneticMoment: [ Abs: 0.00962  Tot: -0.00000 ]
        SubspaceRotationAdjust: set factor to 0.381
ElecMinimize: Iter:   4  F: -856.963552370408479  |grad|_K:       -nan  alpha:  2.081e-01  linmin:  2.380e-05  t[s]:    168.61
        FillingsUpdate:  mu: -0.055416718  nElectrons: 524.000000  magneticMoment: [ Abs: 0.01309  Tot: +0.00000 ]
        SubspaceRotationAdjust: set factor to 0.294
ElecMinimize: Iter:   5  F: -857.092185272710935  |grad|_K:       -nan  alpha:  2.357e-01  linmin:  2.283e-05  t[s]:    176.37
        FillingsUpdate:  mu: -0.061355609  nElectrons: 524.000000  magneticMoment: [ Abs: 0.01741  Tot: -0.00000 ]
        SubspaceRotationAdjust: set factor to 0.273
ElecMinimize: Iter:   6  F: -857.180031265955222  |grad|_K:       -nan  alpha:  3.082e-01  linmin:  4.449e-05  t[s]:    184.12
        FillingsUpdate:  mu: -0.064486045  nElectrons: 524.000000  magneticMoment: [ Abs: 0.02382  Tot: -0.00000 ]
        SubspaceRotationAdjust: set factor to 0.241
ElecMinimize: Iter:   7  F: -857.257857312545184  |grad|_K:       -nan  alpha:  3.934e-01  linmin:  8.435e-05  t[s]:    191.96
shankar1729 commented 1 month ago

Is this only happening with cold smearing? If so, this is an unavoidable consequence of the unphysical greater than 1 fillings in this scheme, which conflicts with the variational algorithm.

I missed that you were doing cold smearing previously.

ColinBundschu commented 1 month ago

I was not doing cold smearing previously. The same issue happens with Fermi and Gauss smearing.

ColinBundschu commented 1 month ago

331_nlpcm_fermi_02.txt Here is an example with fluid and Fermi 0.02

ColinBundschu commented 1 month ago

331_nlpcm_fermi_10.txt Same calculation but with Fermi 0.1

shankar1729 commented 1 month ago

This is likely than an artifact of the variational fillings algorithm as applied to semiconductors/semimetals with no/low DOS at the Fermi level. Specifically, the issue is that the only sensible preconditioner K that works happens to be an indefinite operator, and hence dagger(g) K g can be less than zero. Then, |grad|_K = sqrt(dagger(g) K g) = nan.

The CG algorithm still appears to chug along just fine, so this is essentially a logging issue rather than an algorithmic one. Will take a look at how to address this most sensibly.

ColinBundschu commented 1 month ago

So from my end should I stick with Fermi 0.02 and ignore the nans?

shankar1729 commented 1 month ago

I've pushed a fix to report the signed-sqrt so that these cases show up as a negative grad_K instead of nan. That way you can see the magnitude of grad_k and still use it to gauge convergence, even in the indefinite case. Please check and close if this looks good now.

ColinBundschu commented 1 month ago

grad_K is still nan, even with the latest changes

shankar1729 commented 1 month ago

I'm unable to reproduce the issue with the latest code: can you send me a minimal working example that still shows the nan grad_K. (Your log files above were reading a previous state etc., so make sure it is a clean example that I can run from scratch easily. It would also be good if you can find a smaller version of the same system that still has the same issue to ease debugging.)

ColinBundschu commented 1 month ago

I will make a minimal example and post back

shankar1729 commented 1 month ago

This turned out to be an overflow error in the number of dimensions of electronic minimize exceeding 2^32-1 (one variable was incorrectly int instead of size_t). Fixed in the latest commit.

(The minimal example would have been enormous :) due to the nature of the bug.)

ColinBundschu commented 1 month ago

I pulled latest, and I am still seeing issues with grad_k being Nan

shankar1729 commented 1 month ago

Very strange: I even tested your exact input file with an nvhpc build on Perlmutter and it wasn't NAN. Can you please double check the same input you sent below and confirm the code is compiled with the latest git hash (e155c65)?