Skip to content

Commit

Permalink
Refactor: remove UnitCell_pseudo class (#1493)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongriTianqi committed Nov 11, 2022
1 parent ea06d9a commit 69c29e3
Show file tree
Hide file tree
Showing 103 changed files with 1,473 additions and 1,516 deletions.
1 change: 0 additions & 1 deletion source/Makefile.Objects
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ OBJS_CELL=atom_pseudo.o\
read_pp_blps.o\
read_pp_vwr.o\
unitcell.o\
unitcell_pseudo.o\
read_atoms.o\
read_cell_pseudopots.o\
setup_nonlocal.o\
Expand Down
1 change: 0 additions & 1 deletion source/module_cell/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ add_library(
read_pp_blps.cpp
read_pp_vwr.cpp
unitcell.cpp
unitcell_pseudo.cpp
read_atoms.cpp
read_cell_pseudopots.cpp
setup_nonlocal.cpp
Expand Down
1 change: 0 additions & 1 deletion source/module_cell/Makefile.Objects
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ read_pp_upf201.o\
read_pp_vwr.o\
read_pp_blps.o\
unitcell.o\
unitcell_pseudo.o\
read_atoms.o\
read_cell_pseudopots.o\
setup_nonlocal.o\
44 changes: 22 additions & 22 deletions source/module_cell/read_atoms.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "unitcell_pseudo.h"
#include "unitcell.h"
#ifdef __LCAO
#include "../module_orbital/ORB_read.h" // to use 'ORB' -- mohan 2021-01-30
#endif
Expand All @@ -11,12 +11,12 @@
#include <cstring> // Peize Lin fix bug about strcmp 2016-08-02

#ifdef __LCAO
int UnitCell_pseudo::read_atom_species(LCAO_Orbitals &orb, std::ifstream &ifa, std::ofstream &ofs_running)
int UnitCell::read_atom_species(LCAO_Orbitals &orb, std::ifstream &ifa, std::ofstream &ofs_running)
#else
int UnitCell_pseudo::read_atom_species(std::ifstream &ifa, std::ofstream &ofs_running)
int UnitCell::read_atom_species(std::ifstream &ifa, std::ofstream &ofs_running)
#endif
{
ModuleBase::TITLE("UnitCell_pseudo","read_atom_species");
ModuleBase::TITLE("UnitCell","read_atom_species");

int error = 0;//0 for correct, >0 for warning and quit

Expand Down Expand Up @@ -209,13 +209,13 @@ int UnitCell_pseudo::read_atom_species(std::ifstream &ifa, std::ofstream &ofs_ru
}
if( ModuleBase::GlobalFunc::SCAN_BEGIN(ifa, "LATTICE_PARAMETERS") )
{
ModuleBase::WARNING_QUIT("UnitCell_pseudo::read_atom_species","do not use LATTICE_PARAMETERS without explicit specification of lattice type");
ModuleBase::WARNING_QUIT("UnitCell::read_atom_species","do not use LATTICE_PARAMETERS without explicit specification of lattice type");
}
}//supply lattice vectors
else{
if( ModuleBase::GlobalFunc::SCAN_BEGIN(ifa, "LATTICE_VECTORS") )
{
ModuleBase::WARNING_QUIT("UnitCell_pseudo::read_atom_species","do not use LATTICE_VECTORS along with explicit specification of lattice type");
ModuleBase::WARNING_QUIT("UnitCell::read_atom_species","do not use LATTICE_VECTORS along with explicit specification of lattice type");
}
if(latName=="sc"){//simple-cubic, ibrav = 1
latvec.e11 = 1.0; latvec.e12 = 0.0; latvec.e13 = 0.0;
Expand Down Expand Up @@ -381,7 +381,7 @@ int UnitCell_pseudo::read_atom_species(std::ifstream &ifa, std::ofstream &ofs_ru
}
else{
std::cout << "latname is : " << latName << std::endl;
ModuleBase::WARNING_QUIT("UnitCell_pseudo::read_atom_species","latname not supported!");
ModuleBase::WARNING_QUIT("UnitCell::read_atom_species","latname not supported!");
}
}

Expand All @@ -405,12 +405,12 @@ int UnitCell_pseudo::read_atom_species(std::ifstream &ifa, std::ofstream &ofs_ru
// return 1: no problem.
// return 0: some problems.
#ifdef __LCAO
bool UnitCell_pseudo::read_atom_positions(LCAO_Orbitals &orb, std::ifstream &ifpos, std::ofstream &ofs_running, std::ofstream &ofs_warning)
bool UnitCell::read_atom_positions(LCAO_Orbitals &orb, std::ifstream &ifpos, std::ofstream &ofs_running, std::ofstream &ofs_warning)
#else
bool UnitCell_pseudo::read_atom_positions(std::ifstream &ifpos, std::ofstream &ofs_running, std::ofstream &ofs_warning)
bool UnitCell::read_atom_positions(std::ifstream &ifpos, std::ofstream &ofs_running, std::ofstream &ofs_warning)
#endif
{
ModuleBase::TITLE("UnitCell_pseudo","read_atom_positions");
ModuleBase::TITLE("UnitCell","read_atom_positions");

if( ModuleBase::GlobalFunc::SCAN_BEGIN(ifpos, "ATOMIC_POSITIONS"))
{
Expand Down Expand Up @@ -900,10 +900,10 @@ bool UnitCell_pseudo::read_atom_positions(std::ifstream &ifpos, std::ofstream &o
return 1;
}//end read_atom_positions

bool UnitCell_pseudo::check_tau(void)const
bool UnitCell::check_tau(void)const
{
ModuleBase::TITLE("UnitCell_pseudo","check_tau");
ModuleBase::timer::tick("UnitCell_pseudo","check_tau");
ModuleBase::TITLE("UnitCell","check_tau");
ModuleBase::timer::tick("UnitCell","check_tau");

ModuleBase::Vector3<double> diff = 0.0;
double norm = 0.0;
Expand Down Expand Up @@ -958,13 +958,13 @@ bool UnitCell_pseudo::check_tau(void)const
}
}

ModuleBase::timer::tick("UnitCell_pseudo","check_tau");
ModuleBase::timer::tick("UnitCell","check_tau");
return 1;
}

void UnitCell_pseudo::print_stru_file(const std::string &fn, const int &type, const int &level)const
void UnitCell::print_stru_file(const std::string &fn, const int &type, const int &level)const
{
ModuleBase::TITLE("UnitCell_pseudo","print_stru_file");
ModuleBase::TITLE("UnitCell","print_stru_file");

if(GlobalV::MY_RANK!=0) return;

Expand Down Expand Up @@ -1085,9 +1085,9 @@ void UnitCell_pseudo::print_stru_file(const std::string &fn, const int &type, co
}


void UnitCell_pseudo::print_tau(void)const
void UnitCell::print_tau(void)const
{
ModuleBase::TITLE("UnitCell_pseudo","print_tau");
ModuleBase::TITLE("UnitCell","print_tau");
if(Coordinate == "Cartesian" || Coordinate == "Cartesian_angstrom")
{
GlobalV::ofs_running << "\n CARTESIAN COORDINATES ( UNIT = " << lat0 << " Bohr )." << std::endl;
Expand Down Expand Up @@ -1190,9 +1190,9 @@ void UnitCell_pseudo::print_tau(void)const
}


int UnitCell_pseudo::find_type(const std::string &label)
int UnitCell::find_type(const std::string &label)
{
if(GlobalV::test_pseudo_cell) ModuleBase::TITLE("UnitCell_pseudo","find_type");
if(GlobalV::test_pseudo_cell) ModuleBase::TITLE("UnitCell","find_type");
assert(ntype>0);
for(int it=0;it<ntype;it++)
{
Expand All @@ -1201,12 +1201,12 @@ int UnitCell_pseudo::find_type(const std::string &label)
return it;
}
}
ModuleBase::WARNING_QUIT("UnitCell_pseudo::find_type","Can not find the atom type!");
ModuleBase::WARNING_QUIT("UnitCell::find_type","Can not find the atom type!");
return -1;
}


void UnitCell_pseudo::check_dtau(void)
void UnitCell::check_dtau(void)
{
for(int it=0; it<ntype; it++)
{
Expand Down
16 changes: 8 additions & 8 deletions source/module_cell/read_cell_pseudopots.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "unitcell_pseudo.h"
#include "unitcell.h"
#include "../src_parallel/parallel_common.h"
#include "../input.h"
#ifdef __LCAO
Expand All @@ -11,9 +11,9 @@
//==========================================================
// Read pseudopotential according to the dir
//==========================================================
void UnitCell_pseudo::read_cell_pseudopots(const std::string &pp_dir, std::ofstream &log)
void UnitCell::read_cell_pseudopots(const std::string &pp_dir, std::ofstream &log)
{
ModuleBase::TITLE("UnitCell_pseudo","read_cell_pseudopots");
ModuleBase::TITLE("UnitCell","read_cell_pseudopots");
// setup reading log for pseudopot_upf
std::stringstream ss;
ss << GlobalV::global_out_dir << "atom_pseudo.log";
Expand Down Expand Up @@ -51,7 +51,7 @@ void UnitCell_pseudo::read_cell_pseudopots(const std::string &pp_dir, std::ofstr

if(error_ap)
{
ModuleBase::WARNING_QUIT("UnitCell_pseudo::read_pseudopot","error when average the pseudopotential.");
ModuleBase::WARNING_QUIT("UnitCell::read_pseudopot","error when average the pseudopotential.");
}

if(error==1)
Expand Down Expand Up @@ -121,9 +121,9 @@ void UnitCell_pseudo::read_cell_pseudopots(const std::string &pp_dir, std::ofstr
}


void UnitCell_pseudo::print_unitcell_pseudo(const std::string &fn)
void UnitCell::print_unitcell_pseudo(const std::string &fn)
{
if(GlobalV::test_pseudo_cell) ModuleBase::TITLE("UnitCell_pseudo","print_unitcell_pseudo");
if(GlobalV::test_pseudo_cell) ModuleBase::TITLE("UnitCell","print_unitcell_pseudo");
std::ofstream ofs( fn.c_str() );

this->print_cell(ofs);
Expand All @@ -138,7 +138,7 @@ void UnitCell_pseudo::print_unitcell_pseudo(const std::string &fn)


#ifdef __MPI
void UnitCell_pseudo::bcast_unitcell_pseudo(void)
void UnitCell::bcast_unitcell_pseudo(void)
{
Parallel_Common::bcast_int( meshx );
Parallel_Common::bcast_int( natomwfc );
Expand All @@ -149,7 +149,7 @@ void UnitCell_pseudo::bcast_unitcell_pseudo(void)
bcast_unitcell();
}

void UnitCell_pseudo::bcast_unitcell_pseudo2(void)
void UnitCell::bcast_unitcell_pseudo2(void)
{
bcast_unitcell2();
}
Expand Down

0 comments on commit 69c29e3

Please sign in to comment.