@@ -78,14 +78,14 @@ namespace RI_Util
7878 {
7979 for (auto ¶m : param_list.second )
8080 {
81- if (param.at (" Rcut_type " ) == " spencer" )
81+ if (param.at (" singularity_correction " ) == " spencer" )
8282 {
8383 // 4/3 * pi * Rcut^3 = V_{supercell} = V_{unitcell} * Nk
8484 const int nspin0 = (PARAM.inp .nspin ==2 ) ? 2 : 1 ;
8585 const double Rcut = std::pow (0.75 * p_kv->get_nkstot_full ()/nspin0 * ucell.omega / (ModuleBase::PI), 1.0 /3.0 );
8686 param[" Rcut" ] = ModuleBase::GlobalFunc::TO_STRING (Rcut);
8787 }
88- else if (param.at (" Rcut_type " ) == " revised_spencer" )
88+ else if (param.at (" singularity_correction " ) == " revised_spencer" )
8989 {
9090 const double bvk_a1 = ucell.a1 .norm () * p_kv->nmp [0 ];
9191 const double bvk_a2 = ucell.a2 .norm () * p_kv->nmp [1 ];
@@ -97,6 +97,54 @@ namespace RI_Util
9797 }
9898 return coulomb_param_updated;
9999 }
100+
101+ inline std::map<Conv_Coulomb_Pot_K::Coulomb_Method,
102+ std::pair<bool ,
103+ std::map<Conv_Coulomb_Pot_K::Coulomb_Type,
104+ std::vector<std::map<std::string,std::string>>>>>
105+ update_coulomb_settings (
106+ const std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> &coulomb_param,
107+ const UnitCell &ucell,
108+ const K_Vectors *p_kv)
109+ {
110+ const std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>>
111+ coulomb_param_updated = update_coulomb_param (coulomb_param, ucell, p_kv);
112+
113+ // Separate the parameters into Center2 and Ewald methods
114+ std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> coulomb_param_center2;
115+ std::map<Conv_Coulomb_Pot_K::Coulomb_Type, std::vector<std::map<std::string,std::string>>> coulomb_param_ewald;
116+ for (auto ¶m_list : coulomb_param_updated)
117+ {
118+ for (auto ¶m : param_list.second )
119+ {
120+ if (param.at (" singularity_correction" ) == " spencer" || param.at (" singularity_correction" ) == " limits"
121+ || param.at (" singularity_correction" ) == " revised_spencer" )
122+ {
123+ coulomb_param_center2[param_list.first ].push_back (param);
124+ }
125+ else if (param.at (" singularity_correction" ) == " massidda" || param.at (" singularity_correction" ) == " carrier" )
126+ {
127+ coulomb_param_ewald[param_list.first ].push_back (param);
128+ }
129+ }
130+ }
131+
132+ std::map<Conv_Coulomb_Pot_K::Coulomb_Method,
133+ std::pair<bool ,
134+ std::map<Conv_Coulomb_Pot_K::Coulomb_Type,
135+ std::vector<std::map<std::string,std::string>>>>> coulomb_settings;
136+
137+ if (!coulomb_param_center2.empty ())
138+ {
139+ coulomb_settings[Conv_Coulomb_Pot_K::Coulomb_Method::Center2] = std::make_pair (true , coulomb_param_center2);
140+ }
141+ if (!coulomb_param_ewald.empty ())
142+ {
143+ coulomb_settings[Conv_Coulomb_Pot_K::Coulomb_Method::Ewald] = std::make_pair (true , coulomb_param_ewald);
144+ }
145+
146+ return coulomb_settings;
147+ }
100148}
101149
102150#endif
0 commit comments