Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions source/source_cell/read_pp_upf100.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ int Pseudopot_upf::read_pseudo_upf(std::ifstream& ifs, Atom_pseudo& pp)
pp.has_so = false;
this->q_with_l = false;
this->mesh_changed = false;
this->nqf = 0;
this->nd = 0;

// addinfo_loop
ifs.rdstate();
Expand Down Expand Up @@ -217,6 +219,12 @@ void Pseudopot_upf::read_pseudo_header(std::ifstream& ifs, Atom_pseudo& pp)
pp.lmax = 0;
this->lloc = 0;
}
else if (pp.nbeta == 0 && pp.lmax < 0)
{
// Some legacy UPF100 files use lmax = -1 when no projectors exist.
// Normalize to 0 to avoid negative-size propagation in downstream code.
pp.lmax = 0;
}
return;
}

Expand Down Expand Up @@ -330,8 +338,13 @@ void Pseudopot_upf::read_pseudo_nl(std::ifstream& ifs, Atom_pseudo& pp)
ifs >> nb >> mb >> swap;
nb--;
mb--;
assert(nb >= 0); // mohan add 2011-03-10
assert(mb >= 0);
if (nb < 0 || mb < 0 || nb >= pp.nbeta || mb >= pp.nbeta)
{
ModuleBase::WARNING_QUIT(
"Pseudopot_upf::read_pseudo_nl",
"PP_DIJ index out of range: nb=" + std::to_string(nb) + ", mb=" + std::to_string(mb)
+ ", nbeta=" + std::to_string(pp.nbeta));
}
pp.dion(mb, nb) = swap; // nl_5
pp.dion(nb, mb) = swap;
}
Expand Down
1 change: 1 addition & 0 deletions tests/02_NAO_Gamma/CASES_CPU.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ scf_out_wf
#scf_out_wf_spin2
scf_solvation
scf_u_spin2
scf_upf100
test.sum
13 changes: 13 additions & 0 deletions tests/02_NAO_Gamma/scf_upf100/INPUT
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
INPUT_PARAMETERS
calculation scf
suffix autotest
pseudo_dir ../../PP_ORB
orbital_dir ../../PP_ORB
basis_type lcao
gamma_only 1

ecutwfc 8

scf_thr 1e-7

device cpu
4 changes: 4 additions & 0 deletions tests/02_NAO_Gamma/scf_upf100/KPT
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
K_POINTS
0
Gamma
1 1 1 0 0 0
1 change: 1 addition & 0 deletions tests/02_NAO_Gamma/scf_upf100/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Test upf100 pseudopotential for C6H6
38 changes: 38 additions & 0 deletions tests/02_NAO_Gamma/scf_upf100/STRU
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
ATOMIC_SPECIES
H 1.008 H.pz-vbc.UPF
C 12.011 C.pz-vbc.UPF

NUMERICAL_ORBITAL
H_gga_8au_100Ry_2s1p.orb
C_gga_8au_100Ry_2s2p1d.orb

LATTICE_CONSTANT
1.889726

LATTICE_VECTORS
12.940005000 0.0000000000 0.0000000000
0.0000000000 12.940005000 0.0000000000
0.0000000000 0.0000000000 10.352004000

ATOMIC_POSITIONS
Direct

H
0.0000000000
6
0.3075730000 0.3863990000 0.3380990000 0 0 0 mag 0.0
0.4037870000 0.5530450000 0.3380990000 0 0 0 mag 0.0
0.4037870000 0.2197520000 0.3380990000 0 0 0 mag 0.0
0.5962130000 0.5530450000 0.3380990000 0 0 0 mag 0.0
0.5962130000 0.2197520000 0.3380990000 0 0 0 mag 0.0
0.6924260000 0.3863990000 0.3380990000 0 0 0 mag 0.0

C
0.0000000000
6
0.3925810000 0.3863990000 0.3380990000 0 0 0 mag 0.0
0.4462900000 0.4794260000 0.3380990000 0 0 0 mag 0.0
0.4462900000 0.2933710000 0.3380990000 0 0 0 mag 0.0
0.5537090000 0.4794260000 0.3380990000 0 0 0 mag 0.0
0.5537090000 0.2933710000 0.3380990000 0 0 0 mag 0.0
0.6074190000 0.3863990000 0.3380990000 0 0 0 mag 0.0
3 changes: 3 additions & 0 deletions tests/02_NAO_Gamma/scf_upf100/result.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
etotref -1026.849669039083
etotperatomref -85.5708057533
totaltimeref 2.05
Loading