File tree Expand file tree Collapse file tree
source/source_pw/module_stodft Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,13 +66,15 @@ void Stochastic_WF<T, Device>::clean_chiallorder()
6666template <typename T, typename Device>
6767void Stochastic_WF<T, Device>::init_sto_orbitals(const int seed_in)
6868{
69+ const unsigned int RANK_SEED_FACTOR = 10000 ; // 用于区分不同进程/组的随机种子偏移量
70+
6971 if (seed_in == 0 || seed_in == -1 )
7072 {
71- srand (( unsigned ) time (nullptr ) + GlobalV::MY_RANK * 10000 ); // GlobalV global variables are reserved
73+ srand (static_cast < unsigned >( time (nullptr )) + GlobalV::MY_RANK * RANK_SEED_FACTOR);
7274 }
7375 else
7476 {
75- srand (( unsigned ) std::abs (seed_in) + (GlobalV::MY_BNDGROUP * GlobalV::NPROC_IN_BNDGROUP + GlobalV::RANK_IN_BPGROUP) * 10000 );
77+ srand (static_cast < unsigned >( std::abs (seed_in)) + (GlobalV::MY_BNDGROUP * GlobalV::NPROC_IN_BNDGROUP + GlobalV::RANK_IN_BPGROUP) * RANK_SEED_FACTOR );
7678 }
7779
7880 this ->allocate_chi0 ();
You can’t perform that action at this time.
0 commit comments