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
20 changes: 7 additions & 13 deletions examples/21_deepks/02_lcao_H2O/jle.orb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Number of Dorbitals--> 2
---------------------------------------------------------------------------
SUMMARY END

Mesh 205
Mesh 201
dr 0.01
Type L N
0 0 0
Expand Down Expand Up @@ -62,8 +62,7 @@ dr 0.01
6.345247331791e-02 5.791188607588e-02 5.241540711817e-02 4.696361790712e-02
4.155709094895e-02 3.619638971392e-02 3.088206855820e-02 2.561467264749e-02
2.039473788254e-02 1.522279082639e-02 1.009934863353e-02 5.024918980770e-03
8.824636488425e-14 -4.974919786756e-03 -9.899361531700e-03 -1.477285612199e-02
-1.959494423991e-02
8.824636488425e-14
Type L N
0 0 1
1.000000000000e+00 9.998355147105e-01 9.993421562398e-01 9.985202167122e-01
Expand Down Expand Up @@ -116,8 +115,7 @@ dr 0.01
-6.232855556732e-02 -5.704953906849e-02 -5.177008647810e-02 -4.649509277994e-02
-4.122940087424e-02 -3.597779810401e-02 -3.074501284474e-02 -2.553571116011e-02
-2.035449352599e-02 -1.520589162508e-02 -1.009436521457e-02 -5.024299068919e-03
-2.180811153812e-14 4.974306043314e-03 9.894476794432e-03 1.475645640459e-02
1.955627809356e-02
-2.180811153812e-14
Type L N
0 1 0
0.000000000000e+00 7.488637748270e-03 1.497500757073e-02 2.245684235920e-02
Expand Down Expand Up @@ -170,8 +168,7 @@ dr 0.01
6.163241347987e-02 5.629489953858e-02 5.098844044591e-02 4.571475520896e-02
4.047554347042e-02 3.527248491362e-02 3.010723867693e-02 2.498144277778e-02
1.989671354647e-02 1.485464507002e-02 9.856808646282e-03 4.904752248416e-03
8.084377910810e-14 -4.855948338613e-03 -9.661617874115e-03 -1.441555907126e-02
-1.911634823371e-02
8.084377910810e-14
Type L N
0 1 1
0.000000000000e+00 1.287349883354e-02 2.573547475531e-02 3.857441713205e-02
Expand Down Expand Up @@ -224,8 +221,7 @@ dr 0.01
-6.113827004858e-02 -5.605889221235e-02 -5.095291481399e-02 -4.582759735266e-02
-4.069015817980e-02 -3.554776565875e-02 -3.040752943992e-02 -2.527649186198e-02
-2.016161948939e-02 -1.506979479638e-02 -1.000780800721e-02 -4.982349102379e-03
-6.437579797176e-15 4.932773078295e-03 9.809627048423e-03 1.462434920303e-02
1.937086424077e-02
-6.437579797176e-15
Type L N
0 2 0
0.000000000000e+00 5.535915211195e-05 2.213972080154e-04 4.979959858820e-04
Expand Down Expand Up @@ -278,8 +274,7 @@ dr 0.01
5.992574581769e-02 5.478191562228e-02 4.965613429040e-02 4.455121891443e-02
3.946996773718e-02 3.441515831428e-02 2.938954569414e-02 2.439586061649e-02
1.943680773090e-02 1.451506383641e-02 9.633276143556e-03 4.794060559853e-03
4.131818525851e-15 -4.746357278055e-03 -9.442499310155e-03 -1.408595203483e-02
-1.867428087307e-02
4.131818525851e-15
Type L N
0 2 1
0.000000000000e+00 1.378450216078e-04 5.511357836611e-04 1.239139794773e-03
Expand Down Expand Up @@ -332,5 +327,4 @@ dr 0.01
-5.983213508908e-02 -5.496252350283e-02 -5.004030907345e-02 -4.507498543086e-02
-4.007604502571e-02 -3.505296252697e-02 -3.001517833094e-02 -2.497208221092e-02
-1.993299713613e-02 -1.490716328841e-02 -9.903722304457e-03 -4.931701771028e-03
4.773444701199e-14 4.882628890872e-03 9.707589564902e-03 1.446645969794e-02
1.915100382853e-02
4.773444701199e-14
137 changes: 46 additions & 91 deletions examples/21_deepks/03_lcao_CsPbI3/jle.orb

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions source/source_basis/module_ao/ORB_read.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring> // Peize Lin fix bug about strcmp 2016-08-02
#include <iostream>

//==============================
// Define an object here!
Expand Down Expand Up @@ -378,6 +380,7 @@ void LCAO_Orbitals::read_orb_file(std::ofstream& ofs_in, // GlobalV::ofs_running
ModuleBase::TITLE("LCAO_Orbitals", "read_orb_file");
char word[80];
std::string orb_label;
double declared_rcut = -1.0;
if (my_rank == 0)
{
while (ifs.good())
Expand All @@ -388,6 +391,15 @@ void LCAO_Orbitals::read_orb_file(std::ofstream& ofs_in, // GlobalV::ofs_running
ifs >> orb_label;
continue;
}
if (std::strcmp(word, "Radius") == 0)
{
ifs >> word;
if (std::strcmp(word, "Cutoff(a.u.)") == 0)
{
ifs >> declared_rcut;
}
continue;
}
if (std::strcmp(word, "Lmax") == 0)
{
ifs >> lmax;
Expand Down Expand Up @@ -448,6 +460,18 @@ void LCAO_Orbitals::read_orb_file(std::ofstream& ofs_in, // GlobalV::ofs_running
}
ModuleBase::CHECK_NAME(ifs, "dr");
ifs >> dr;

if (declared_rcut >= 0.0 && meshr_read > 0)
{
const double mesh_rcut = (meshr_read - 1) * dr;
const double tolerance = 1.0e-10 * std::max(1.0, std::abs(declared_rcut));
if (std::abs(mesh_rcut - declared_rcut) > tolerance)
{
std::cout << " WARNING: The orbital file declares a cutoff radius of " << declared_rcut
<< " Bohr, but (Mesh - 1) * dr is " << mesh_rcut
<< " Bohr. The file will be read without modification." << std::endl;
}
}
}

#ifdef __MPI
Expand Down
6 changes: 2 additions & 4 deletions source/source_basis/module_ao/test/ORB_read_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,12 @@ TEST_F(LcaoOrbitalsTest, ReadOrbitals) {
EXPECT_EQ(aod.PhiLN(L,N).getType(), 0);
EXPECT_EQ(aod.PhiLN(L,N).getL(), L);
EXPECT_EQ(aod.PhiLN(L,N).getChi(), N);
EXPECT_EQ(aod.PhiLN(L,N).getNr(), 205);
EXPECT_EQ(aod.PhiLN(L,N).getNr(), 201);
EXPECT_EQ(aod.PhiLN(L,N).getNk(), lcao_.kmesh);
EXPECT_EQ(aod.PhiLN(L,N).getDk(), lcao_.dk);
EXPECT_EQ(aod.PhiLN(L,N).getDruniform(), lcao_.dr_uniform);

for (int ir = 0; ir != 205; ++ir) {
for (int ir = 0; ir != 201; ++ir) {
EXPECT_DOUBLE_EQ(aod.PhiLN(L,N).getRab(ir), 0.01);
EXPECT_DOUBLE_EQ(aod.PhiLN(L,N).getRadial(ir), 0.01*ir);
}
Expand Down Expand Up @@ -340,5 +340,3 @@ int main(int argc, char **argv)

return result;
}


20 changes: 7 additions & 13 deletions source/source_basis/module_ao/test/lcao_H2O/jle.orb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Number of Dorbitals--> 2
---------------------------------------------------------------------------
SUMMARY END

Mesh 205
Mesh 201
dr 0.01
Type L N
0 0 0
Expand Down Expand Up @@ -62,8 +62,7 @@ dr 0.01
6.345247331791e-02 5.791188607588e-02 5.241540711817e-02 4.696361790712e-02
4.155709094895e-02 3.619638971392e-02 3.088206855820e-02 2.561467264749e-02
2.039473788254e-02 1.522279082639e-02 1.009934863353e-02 5.024918980770e-03
8.824636488425e-14 -4.974919786756e-03 -9.899361531700e-03 -1.477285612199e-02
-1.959494423991e-02
8.824636488425e-14
Type L N
0 0 1
1.000000000000e+00 9.998355147105e-01 9.993421562398e-01 9.985202167122e-01
Expand Down Expand Up @@ -116,8 +115,7 @@ dr 0.01
-6.232855556732e-02 -5.704953906849e-02 -5.177008647810e-02 -4.649509277994e-02
-4.122940087424e-02 -3.597779810401e-02 -3.074501284474e-02 -2.553571116011e-02
-2.035449352599e-02 -1.520589162508e-02 -1.009436521457e-02 -5.024299068919e-03
-2.180811153812e-14 4.974306043314e-03 9.894476794432e-03 1.475645640459e-02
1.955627809356e-02
-2.180811153812e-14
Type L N
0 1 0
0.000000000000e+00 7.488637748270e-03 1.497500757073e-02 2.245684235920e-02
Expand Down Expand Up @@ -170,8 +168,7 @@ dr 0.01
6.163241347987e-02 5.629489953858e-02 5.098844044591e-02 4.571475520896e-02
4.047554347042e-02 3.527248491362e-02 3.010723867693e-02 2.498144277778e-02
1.989671354647e-02 1.485464507002e-02 9.856808646282e-03 4.904752248416e-03
8.084377910810e-14 -4.855948338613e-03 -9.661617874115e-03 -1.441555907126e-02
-1.911634823371e-02
8.084377910810e-14
Type L N
0 1 1
0.000000000000e+00 1.287349883354e-02 2.573547475531e-02 3.857441713205e-02
Expand Down Expand Up @@ -224,8 +221,7 @@ dr 0.01
-6.113827004858e-02 -5.605889221235e-02 -5.095291481399e-02 -4.582759735266e-02
-4.069015817980e-02 -3.554776565875e-02 -3.040752943992e-02 -2.527649186198e-02
-2.016161948939e-02 -1.506979479638e-02 -1.000780800721e-02 -4.982349102379e-03
-6.437579797176e-15 4.932773078295e-03 9.809627048423e-03 1.462434920303e-02
1.937086424077e-02
-6.437579797176e-15
Type L N
0 2 0
0.000000000000e+00 5.535915211195e-05 2.213972080154e-04 4.979959858820e-04
Expand Down Expand Up @@ -278,8 +274,7 @@ dr 0.01
5.992574581769e-02 5.478191562228e-02 4.965613429040e-02 4.455121891443e-02
3.946996773718e-02 3.441515831428e-02 2.938954569414e-02 2.439586061649e-02
1.943680773090e-02 1.451506383641e-02 9.633276143556e-03 4.794060559853e-03
4.131818525851e-15 -4.746357278055e-03 -9.442499310155e-03 -1.408595203483e-02
-1.867428087307e-02
4.131818525851e-15
Type L N
0 2 1
0.000000000000e+00 1.378450216078e-04 5.511357836611e-04 1.239139794773e-03
Expand Down Expand Up @@ -332,5 +327,4 @@ dr 0.01
-5.983213508908e-02 -5.496252350283e-02 -5.004030907345e-02 -4.507498543086e-02
-4.007604502571e-02 -3.505296252697e-02 -3.001517833094e-02 -2.497208221092e-02
-1.993299713613e-02 -1.490716328841e-02 -9.903722304457e-03 -4.931701771028e-03
4.773444701199e-14 4.882628890872e-03 9.707589564902e-03 1.446645969794e-02
1.915100382853e-02
4.773444701199e-14
22 changes: 22 additions & 0 deletions source/source_basis/module_nao/atomic_radials.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "source_base/projgen.h"

#include <cmath>
#include <fstream>
#include <iostream>
#include <string>
Expand Down Expand Up @@ -119,6 +120,7 @@ void AtomicRadials::read_abacus_orb(std::ifstream& ifs, std::ofstream* ptr_log,
* */
int ngrid = 0; // number of grid points
double dr = 0; // grid spacing
double declared_rcut = -1.0;
std::string tmp;

if (rank == 0)
Expand All @@ -143,6 +145,14 @@ void AtomicRadials::read_abacus_orb(std::ifstream& ifs, std::ofstream* ptr_log,
{
ifs >> orb_ecut_;
}
else if (tmp == "Radius")
{
ifs >> tmp;
if (tmp == "Cutoff(a.u.)")
{
ifs >> declared_rcut;
}
}
else if (tmp == "Lmax")
{
ifs >> lmax_;
Expand All @@ -167,6 +177,18 @@ void AtomicRadials::read_abacus_orb(std::ifstream& ifs, std::ofstream* ptr_log,
}
}

if (declared_rcut >= 0.0 && ngrid > 0)
{
const double mesh_rcut = (ngrid - 1) * dr;
const double tolerance = 1.0e-10 * std::max(1.0, std::abs(declared_rcut));
if (std::abs(mesh_rcut - declared_rcut) > tolerance)
{
std::cout << " WARNING: The orbital file declares a cutoff radius of " << declared_rcut
<< " Bohr, but (Mesh - 1) * dr is " << mesh_rcut
<< " Bohr. The file will be read without modification." << std::endl;
}
}

/*
* calculate:
*
Expand Down
Loading
Loading