Skip to content

Commit e0230bf

Browse files
authored
Refactor: trim some unused codes (#1679)
1 parent 5087854 commit e0230bf

File tree

3 files changed

+15
-144
lines changed

3 files changed

+15
-144
lines changed

source/input.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,9 @@ void Input::Default(void)
407407
//---------------------------------------------------------- //Fuxiang He add 2016-10-26
408408
// constrained DFT
409409
//----------------------------------------------------------
410-
GlobalV::ocp = 0;
410+
// GlobalV::ocp = 0;
411411
// ocp_n = 0;
412-
GlobalV::ocp_set = "none";
412+
// GlobalV::ocp_set = "none";
413413
// for(int i=0; i<10000; i++)
414414
// {
415415
// GlobalV::ocp_kb[i] = 0.0;
@@ -3257,4 +3257,4 @@ int Input::count_ntype(const std::string &fn)
32573257
}
32583258
}
32593259
return ntype_stru;
3260-
}
3260+
}

source/src_lcao/FORCE_STRESS.cpp

Lines changed: 2 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,8 @@ void Force_Stress_LCAO::getForceStress(
453453
//caoyu add 2021-06-03
454454
if (GlobalV::deepks_scf)
455455
{
456-
this->print_force("DeePKS FORCE", GlobalC::ld.F_delta, 1, ry);
456+
f_pw.print("DeePKS FORCE", GlobalC::ld.F_delta, 1);
457+
//this->print_force("DeePKS FORCE", GlobalC::ld.F_delta, 1, ry);
457458
}
458459
#endif
459460
}
@@ -623,143 +624,6 @@ void Force_Stress_LCAO::getForceStress(
623624
return;
624625
}
625626

626-
//print force term for test
627-
void Force_Stress_LCAO::print_force(const std::string &name, ModuleBase::matrix& f, const bool screen, bool ry)const
628-
{
629-
GlobalV::ofs_running << " --------------------------- " << name << " ----------------------------" << std::endl;
630-
GlobalV::ofs_running << " " << std::setw(8) << "atom" << std::setw(15) << "x" << std::setw(15) << "y" << std::setw(15) << "z" << std::endl;
631-
632-
double fac = 1.0;
633-
634-
if(!ry)
635-
{
636-
fac = ModuleBase::Ry_to_eV / 0.529177;
637-
}
638-
639-
std::cout << std::setprecision(5);
640-
std::cout << std::setiosflags(ios::showpos);
641-
642-
if(screen)
643-
{
644-
std::cout << " ------------------- " << name << " --------------------" << std::endl;
645-
std::cout << " " << std::setw(8) << "atom" << std::setw(15) << "x" << std::setw(15) << "y" << std::setw(15) << "z" << std::endl;
646-
}
647-
648-
int iat = 0;
649-
for (int it = 0;it < GlobalC::ucell.ntype;it++)
650-
{
651-
for (int ia = 0;ia < GlobalC::ucell.atoms[it].na;ia++)
652-
{
653-
std::stringstream ss;
654-
ss << GlobalC::ucell.atoms[it].label << ia+1;
655-
656-
GlobalV::ofs_running << " " << std::setw(8) << ss.str();
657-
if( abs(f(iat,0)) >output_acc) GlobalV::ofs_running << std::setw(15) << f(iat,0)*fac;
658-
else GlobalV::ofs_running << std::setw(15) << "0";
659-
if( abs(f(iat,1)) >output_acc) GlobalV::ofs_running << std::setw(15) << f(iat,1)*fac;
660-
else GlobalV::ofs_running << std::setw(15) << "0";
661-
if( abs(f(iat,2)) >output_acc) GlobalV::ofs_running << std::setw(15) << f(iat,2)*fac;
662-
else GlobalV::ofs_running << std::setw(15) << "0";
663-
GlobalV::ofs_running << std::endl;
664-
665-
if(screen)
666-
{
667-
std::cout << " " << std::setw(8) << ss.str();
668-
if( abs(f(iat,0)) >output_acc) std::cout << std::setw(15) << f(iat,0)*fac;
669-
else std::cout << std::setw(15) << "0";
670-
if( abs(f(iat,1)) >output_acc) std::cout << std::setw(15) << f(iat,1)*fac;
671-
else std::cout << std::setw(15) << "0";
672-
if( abs(f(iat,2)) >output_acc) std::cout << std::setw(15) << f(iat,2)*fac;
673-
else std::cout << std::setw(15) << "0";
674-
std::cout << std::endl;
675-
}
676-
677-
iat++;
678-
}
679-
}
680-
681-
682-
std::cout << std::resetiosflags(ios::showpos);
683-
684-
return;
685-
}
686-
687-
688-
void Force_Stress_LCAO::printforce_total (const bool ry, const bool istestf, ModuleBase::matrix& fcs)
689-
{
690-
ModuleBase::TITLE("Force_Stress_LCAO","printforce_total");
691-
double unit_transform = 1;
692-
693-
if(!ry)
694-
{
695-
unit_transform = ModuleBase::Ry_to_eV / 0.529177;
696-
}
697-
// std::cout.setf(ios::fixed);
698-
699-
int iat=0;
700-
701-
//GlobalV::ofs_running << std::setiosflags(ios::right);
702-
GlobalV::ofs_running << std::setprecision(6) << std::setiosflags(ios::showpos) << std::setiosflags(ios::fixed) << std::endl;
703-
ModuleBase::GlobalFunc::NEW_PART("TOTAL-FORCE (eV/Angstrom)");
704-
705-
// print out forces
706-
if(INPUT.out_force == 1)
707-
{
708-
std::ofstream ofs("FORCE.dat");
709-
if(!ofs)
710-
{
711-
std::cout << "open FORCE.dat error !" <<std::endl;
712-
}
713-
714-
for(int iat=0; iat<GlobalC::ucell.nat; iat++)
715-
{
716-
ofs << " " << fcs(iat,0)*ModuleBase::Ry_to_eV / 0.529177
717-
<< " " << fcs(iat,1)*ModuleBase::Ry_to_eV / 0.529177
718-
<< " " << fcs(iat,2)*ModuleBase::Ry_to_eV / 0.529177 << std::endl;
719-
}
720-
ofs.close();
721-
}
722-
723-
if(istestf)
724-
{
725-
cout << setprecision(6);
726-
//cout << setiosflags(ios::showpos);
727-
//cout << setiosflags(ios::fixed) << endl;
728-
cout << " ------------------- TOTAL FORCE --------------------" << endl;
729-
cout << " " << setw(8) << "Atom" << setw(15) << "x" << setw(15) << "y" << setw(15) << "z" << endl;
730-
GlobalV::ofs_running << " " << setw(12) << "Atom" << setw(15) << "x" << setw(15) << "y" << setw(15) << "z" << endl;
731-
}
732-
733-
iat=0;
734-
for (int it=0; it<GlobalC::ucell.ntype; it++)
735-
{
736-
for (int ia = 0; ia < GlobalC::ucell.atoms[it].na; ia++)
737-
{
738-
std::stringstream ss;
739-
ss << GlobalC::ucell.atoms[it].label << ia+1;
740-
741-
if(istestf)
742-
{
743-
std::cout << " " << std::setw(8) << ss.str()
744-
<< std::setw(15) << fcs(iat,0)*unit_transform
745-
<< std::setw(15) << fcs(iat,1)*unit_transform
746-
<< std::setw(15) << fcs(iat,2)*unit_transform << std::endl;
747-
}
748-
749-
GlobalV::ofs_running << " " << std::setw(12) << ss.str()
750-
<< std::setw(15) << fcs(iat,0)*unit_transform
751-
<< std::setw(15) << fcs(iat,1)*unit_transform
752-
<< std::setw(15) << fcs(iat,2)*unit_transform << std::endl;
753-
754-
++iat;
755-
}
756-
}
757-
GlobalV::ofs_running << std::setiosflags(ios::left);
758-
std::cout << std::resetiosflags(ios::showpos);
759-
760-
return;
761-
}
762-
763627
//local pseudopotential, ewald, core correction, scc terms in force
764628
void Force_Stress_LCAO::calForcePwPart(
765629
ModuleBase::matrix &fvl_dvl,

source/src_pw/occupy.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ double Occupy::w1gauss(const double &x,const int n)
580580
return w1;
581581
} // end function w1gauss
582582

583-
583+
/*
584584
void Occupy::tweights(const int nks,const int nspin,const int nband,const double &nelec,
585585
const int ntetra,const ModuleBase::matrix &tetra, double **ekb, double &ef, ModuleBase::matrix &wg)
586586
{
@@ -737,8 +737,9 @@ void Occupy::tweights(const int nks,const int nspin,const int nband,const double
737737
}
738738
return;
739739
} // end subroutine tweights
740+
*/
740741

741-
742+
/*
742743
double Occupy::wsweight(const ModuleBase::Vector3<double> &r, ModuleBase::Vector3<double> *rws,const int nrws)
743744
{
744745
//============================================================
@@ -772,7 +773,9 @@ double Occupy::wsweight(const ModuleBase::Vector3<double> &r, ModuleBase::Vector
772773
773774
return wswe;
774775
} // end function wsweight
776+
*/
775777

778+
/*
776779
void Occupy::efermit(double** ekb,const int nband,const int nks,const double &nelec,const int nspin,
777780
const int ntetra,const ModuleBase::matrix &tetra, double &ef)
778781
{
@@ -877,8 +880,9 @@ void Occupy::efermit(double** ekb,const int nband,const int nks,const double &ne
877880
}
878881
return;
879882
} // end subroutine efermit
883+
*/
880884

881-
885+
/*
882886
double Occupy::sumkt(double** ekb,const int nband,const int nks,const int nspin,const int ntetra,
883887
const ModuleBase::matrix &tetra,const double &e)
884888
{
@@ -954,7 +958,9 @@ double Occupy::sumkt(double** ekb,const int nband,const int nks,const int nspin,
954958
sum *= 2.0 / nspin;
955959
return sum;
956960
} // end function sumkt
961+
*/
957962

963+
/*
958964
void Occupy::piksort(const int n, double *a)
959965
{
960966
int i;
@@ -979,3 +985,4 @@ void Occupy::piksort(const int n, double *a)
979985
}
980986
return;
981987
} //end subroutine piksort
988+
*/

0 commit comments

Comments
 (0)