diff --git a/.gitignore b/.gitignore index ad33721f56e..ca97e93c495 100644 --- a/.gitignore +++ b/.gitignore @@ -1,29 +1,64 @@ -/build* -build_info.h -bin -obj +``` +# Compiled and build artifacts *.o -OUT.* -log.txt -result.out -*.dat -.DS_Store -.cache -.vscode -html +*.obj +*.exe +*.dll +*.so +*.a +*.out + +# Dependencies +node_modules/ +venv/ +.venv/ +__pycache__/ +.mypy_cache/ +.pytest_cache/ +target/ +.gradle/ + +# Logs and temp files *.log -STRU_READIN_ADJUST.cif -*.egg -*.egg-info -build -dist -.idea -time.json -*.pyc -__pycache__ -abacus.json -*.npy -toolchain/install/ -toolchain/abacus_env.sh -.trae -compile_commands.json +*.tmp +*.swp +*.swo + +# Environment +.env +.env.local +*.env.* + +# Editors +.vscode/ +.idea/ + +# System files +.DS_Store +Thumbs.db + +# Coverage +coverage/ +htmlcov/ +.coverage + +# Compressed files +*.zip +*.gz +*.tar +*.tgz +*.bz2 +*.xz +*.7z +*.rar +*.zst +*.lz4 +*.lzh +*.cab +*.arj +*.rpm +*.deb +*.Z +*.lz +*.lzo +``` \ No newline at end of file diff --git a/source/source_pw/module_pwdft/op_pw_proj.cpp b/source/source_pw/module_pwdft/op_pw_proj.cpp index 8c7cddfc89c..5996924b6e3 100644 --- a/source/source_pw/module_pwdft/op_pw_proj.cpp +++ b/source/source_pw/module_pwdft/op_pw_proj.cpp @@ -58,6 +58,24 @@ void OnsiteProj>::init(const int ik_in) onsite_p->tabulate_atomic(ik_in); this->tnp = onsite_p->get_tot_nproj(); + if(this->has_delta_spin && !this->init_delta_spin) + { + this->init_delta_spin = true; + //prepare ip_iat and lambda_coeff + resmem_int_op()(this->ip_iat, onsite_p->get_tot_nproj()); + resmem_complex_op()(this->lambda_coeff, this->ucell->nat * 4); + std::vector ip_iat0(onsite_p->get_tot_nproj()); + int ip0 = 0; + for(int iat=0;iatucell->nat;iat++) + { + for(int ip=0;ipget_nh(iat);ip++) + { + ip_iat0[ip0++] = iat; + } + } + syncmem_int_h2d_op()(this->ip_iat, ip_iat0.data(), onsite_p->get_tot_nproj()); + } + if(this->next_op != nullptr) { this->next_op->init(ik_in); @@ -130,25 +148,9 @@ void OnsiteProj>::cal_ps_delta_spin(const int npol, const } setmem_complex_op()(this->ps, 0, tnp * m); - if(!this->init_delta_spin) - { - this->init_delta_spin = true; - //prepare ip_iat and lambda_coeff - resmem_int_op()(this->ip_iat, onsite_p->get_tot_nproj()); - resmem_complex_op()(this->lambda_coeff, this->ucell->nat * 4); - std::vector ip_iat0(onsite_p->get_tot_nproj()); - int ip0 = 0; - for(int iat=0;iatucell->nat;iat++) - { - for(int ip=0;ipget_nh(iat);ip++) - { - ip_iat0[ip0++] = iat; - } - } - syncmem_int_h2d_op()(this->ip_iat, ip_iat0.data(), onsite_p->get_tot_nproj()); - } - // prepare array of nh_iat and lambda_array to pass to the onsite_ps_op operator + spinconstrain::SpinConstrain>& sc = spinconstrain::SpinConstrain>::getScInstance(); + auto& lambda = sc.get_sc_lambda(); std::vector> tmp_lambda_coeff(this->ucell->nat * 4); for(int iat=0;iatucell->nat;iat++) { @@ -158,7 +160,6 @@ void OnsiteProj>::cal_ps_delta_spin(const int npol, const tmp_lambda_coeff[iat * 4 + 3] = std::complex(-1 * lambda[iat][2], 0.0); } syncmem_complex_h2d_op()(this->lambda_coeff, tmp_lambda_coeff.data(), this->ucell->nat * 4); - // TODO: code block above should be moved to the init function hamilt::onsite_ps_op()( this->ctx, // device context