electronic-structure / SIRIUS

Domain specific library for electronic structure calculations
BSD 3-Clause "New" or "Revised" License
125 stars 40 forks source link

[json.exception.type_error.302] type must be string, but is null #974

Closed svandenhaute closed 4 months ago

svandenhaute commented 6 months ago

I'm trying to use SIRIUS with CP2K. I'm using the 2024.1 generic docker image with the following input file:

&FORCE_EVAL
  METHOD SIRIUS
  &DFT
    &XC
      &XC_FUNCTIONAL PBE
      &END XC_FUNCTIONAL
      &VDW_POTENTIAL
        POTENTIAL_TYPE PAIR_POTENTIAL
        &PAIR_POTENTIAL
          TYPE DFTD3(BJ)
          REFERENCE_FUNCTIONAL PBE
          PARAMETER_FILE_NAME dftd3.dat
        &END PAIR_POTENTIAL
      &END VDW_POTENTIAL
    &END XC
  &END DFT
  &PW_DFT
    &CONTROL
      GEN_EVP_SOLVER_NAME lapack
      PROCESSING_UNIT cpu
      STD_EVP_SOLVER_NAME lapack
      VERBOSITY 2
    &END CONTROL
    &ITERATIVE_SOLVER
      CONVERGE_BY_ENERGY 0
      ENERGY_TOLERANCE 1e-4
      NUM_STEPS 8
      RESIDUAL_TOLERANCE 1e-5
      SUBSPACE_SIZE 8
      TYPE davidson
    &END ITERATIVE_SOLVER
    &MIXER
      BETA 0.95
      MAX_HISTORY 8
      TYPE anderson
    &END MIXER
    &PARAMETERS
      AUTO_RMT 0
      AW_CUTOFF 8.0
      CORE_RELATIVITY none
      DENSITY_TOL 1e-7
      ELECTRONIC_STRUCTURE_METHOD full_potential_lapwlo
      ENERGY_TOL 1e-7
      LMAX_APW 8
      LMAX_POT 8
      LMAX_RHO 8
      MOLECULE true
      NGRIDK 1 1 1
      NUM_DFT_ITER 20
      NUM_FV_STATES 10
      PW_CUTOFF 20.00
      SMEARING_WIDTH 0.05
      USE_SYMMETRY true
      VALENCE_RELATIVITY none
    &END PARAMETERS
    &SETTINGS
      MIN_OCCUPANCY 0
    &END SETTINGS
  &END PW_DFT
  &SUBSYS
    &CELL
      PERIODIC XYZ
      A 13.8265086916544 0.0 0.0
      B -6.9048358329934905 11.98413275119124 0.0
      C 0.005690772697070114 -0.03874528665254199 14.935328829635935
    &END CELL
    &TOPOLOGY
      COORD_FILE_NAME   /mnt/state.xyz
      COORD_FILE_FORMAT XYZ
    &END TOPOLOGY
    &KIND O
    POTENTIAL UPF /mnt/O.json
    &END KIND
    &KIND Si
    POTENTIAL UPF /mnt/Si.json
    &END KIND
    &KIND Al
    POTENTIAL UPF /mnt/Al.json
    &END KIND
    &KIND H
    POTENTIAL UPF /mnt/H.json
    &END KIND
    &KIND C
    POTENTIAL UPF /mnt/C.json
    &END KIND
  &END SUBSYS
&END FORCE_EVAL
&GLOBAL
  PROJECT     md
  RUN_TYPE    ENERGY
  PREFERRED_DIAG_LIBRARY SL
  PRINT_LEVEL MEDIUM
&END GLOBAL

The .json files are bound into the /mnt folder in the container upon execution, and they were taken from the SIRIUS species repository so they should be good. Somehow, I get a bunch of the following exceptions without any additional info:

SIRIUS: exception
[json.exception.type_error.302] type must be string, but is null

What's going on?

svandenhaute commented 6 months ago
      ELECTRONIC_STRUCTURE_METHOD full_potential_lapwlo

of course had to be

      ELECTRONIC_STRUCTURE_METHOD pseudopotential

Changing that fixed the issue.

On that note: how would I perform LAPW calculations, i.e. all-electron, without pseudopotentials?

toxa81 commented 6 months ago

@svandenhaute you need to provide json files of LAPW species. That's the only difference.

mtaillefumier commented 6 months ago

Oh that's probably a sign that the potential you took are pseudo-potentials not all-electron one.

svandenhaute commented 6 months ago

Ah, OK! Do those other settings look reasonable or are there particular things I need to benchmark? Gamma point only calculation, about 150 atoms, insulator, and it's important that the energies and forces are well-converged.

In terms of OMP/MPI parallelization, what does SIRIUS typically prefer?

toxa81 commented 6 months ago

@svandenhaute I porpose to change DFT section as following

  &PW_DFT
    &CONTROL
      GEN_EVP_SOLVER_NAME lapack
      PROCESSING_UNIT cpu
      STD_EVP_SOLVER_NAME lapack
      VERBOSITY 2
    &END CONTROL
    &MIXER
      BETA 0.95
      MAX_HISTORY 8
      TYPE anderson
    &END MIXER
    &PARAMETERS
      DENSITY_TOL 1e-7
      ELECTRONIC_STRUCTURE_METHOD full_potential_lapwlo
      ENERGY_TOL 1e-7
      MOLECULE true
      NGRIDK 1 1 1
      NUM_DFT_ITER 20
      PW_CUTOFF 20.00
      GK_CUTOFF 8
      SMEARING_WIDTH 0.05
      USE_SYMMETRY true
    &END PARAMETERS
  &END PW_DFT

You might need to change mixing parameter beta in case of poor convergence. Paramaters PW_CUTOFF and GK_CUTOFF control density/potential and wave-functions correspondingly. Units are inverse atomic units, not energy.

toxa81 commented 6 months ago

@svandenhaute I forgot to mention: with single k-point band parallelisation is the only opption. In control section you need to specify mpi_grid_dims variable (https://manual.cp2k.org/trunk/CP2K_INPUT/FORCE_EVAL/PW_DFT/CONTROL.html#CP2K_INPUT.FORCE_EVAL.PW_DFT.CONTROL.MPI_GRID_DIMS). It's a pair of integers that controls how MPI ranks will be split. For the beginning, you can set it to 1, N (N is the total number of MPI ranks in your calculation).