@@ -52,7 +52,7 @@ class BsplineReader
5252 std::vector<int >& band2spo);
5353
5454public:
55- BsplineReader (EinsplineSetBuilder* e);
55+ BsplineReader (EinsplineSetBuilder* e, bool use_duplex_splines );
5656
5757 virtual ~BsplineReader ();
5858
@@ -86,6 +86,8 @@ class BsplineReader
8686 bool rotate;
8787 // /map from spo index to band index
8888 std::vector<std::vector<int >> spo2band;
89+ // / if true, use two real-valued splines for one complex-valued DFT orbital.
90+ const bool use_duplex_splines_;
8991 // / if true, use offload
9092 bool use_offload;
9193
@@ -100,13 +102,13 @@ class BsplineReader
100102 /* * read gvectors and set the mesh, and prepare for einspline
101103 */
102104 template <typename GT , typename BCT >
103- inline void set_grid (const TinyVector<int , 3 >& halfg, GT * xyz_grid, BCT * xyz_bc) const
105+ static void set_grid (const TinyVector<int , 3 >& mesh_sizes, const TinyVector< int , 3 >& halfg, GT * xyz_grid, BCT * xyz_bc)
104106 {
105107 for (int j = 0 ; j < 3 ; ++j)
106108 {
107109 xyz_grid[j].start = 0.0 ;
108110 xyz_grid[j].end = 1.0 ;
109- xyz_grid[j].num = mybuilder-> MeshSize [j];
111+ xyz_grid[j].num = mesh_sizes [j];
110112
111113 if (halfg[j])
112114 {
@@ -131,8 +133,6 @@ class BsplineReader
131133 const int N = bandgroup.getNumDistinctOrbitals ();
132134 const int numOrbs = bandgroup.getNumSPOs ();
133135
134- bspline.resizeStorage (N);
135-
136136 const std::vector<BandInfo>& cur_bands = bandgroup.myBands ;
137137 for (int iorb = 0 , num = 0 ; iorb < N; iorb++)
138138 {
@@ -142,23 +142,27 @@ class BsplineReader
142142 num += bspline.MakeTwoCopies [iorb] ? 2 : 1 ;
143143 }
144144
145+ bspline.resize_kpoints ();
145146 app_log () << " NumDistinctOrbitals " << N << " numOrbs = " << numOrbs << std::endl;
147+ }
146148
147- bspline.HalfG = 0 ;
148- TinyVector<int , 3 > bconds = mybuilder->TargetPtcl .getLattice ().BoxBConds ;
149- if (!bspline.isComplex ())
150- {
151- // no k-point folding, single special k point (G, L ...)
152- TinyVector<double , 3 > twist0 = mybuilder->primcell_kpoints [bandgroup.TwistIndex ];
153- for (int i = 0 ; i < 3 ; i++)
154- if (bconds[i] && ((std::abs (std::abs (twist0[i]) - 0.5 ) < 1.0e-8 )))
155- bspline.HalfG [i] = 1 ;
156- else
157- bspline.HalfG [i] = 0 ;
158- app_log () << " TwistIndex = " << cur_bands[0 ].TwistIndex << " TwistAngle " << twist0 << std::endl;
159- app_log () << " HalfG = " << bspline.HalfG << std::endl;
160- }
161- app_log ().flush ();
149+ /* * compute sign bits at the G/2 boundaries
150+ * no supercell, no k-point folding, single special k point (G, L ...)
151+ */
152+ static TinyVector<int , 3 > computeHalfG (const TinyVector<int , OHMMS_DIM >& bconds,
153+ const std::vector<TinyVector<double , OHMMS_DIM >>& primcell_kpoints,
154+ size_t twist0_index)
155+ {
156+ TinyVector<int , 3 > halfG;
157+ const auto & twist0 = primcell_kpoints[twist0_index];
158+ app_log () << " TwistIndex = " << twist0_index << " TwistAngle " << twist0 << std::endl;
159+ for (int i = 0 ; i < 3 ; i++)
160+ if (bconds[i] && ((std::abs (std::abs (twist0[i]) - 0.5 ) < 1.0e-8 )))
161+ halfG[i] = 1 ;
162+ else
163+ halfG[i] = 0 ;
164+ app_log () << " HalfG = " << halfG << std::endl;
165+ return halfG;
162166 }
163167
164168 /* * return the path name in hdf5
@@ -172,6 +176,22 @@ class BsplineReader
172176 path << " /electrons/kpoint_" << ti << " /spin_" << spin << " /state_" << ib << " /psi_g" ;
173177 return path.str ();
174178 }
179+
180+ /* * create data space in the spline object and try open spline dump files.
181+ * @param bandgroup band info
182+ * @param bspline the spline object being worked on
183+ * @return true if dumpfile pass class name and data type size check
184+ */
185+ bool lookforSplineDataDumpFile (const BandInfoGroup& bandgroup,
186+ const std::string& keyword,
187+ size_t datatype_size) const ;
188+
189+ /* * read planewave coefficients from h5 file
190+ * @param s data set full path in h5
191+ * @param h5f hdf5 file handle
192+ * @param cG vector to store coefficients
193+ */
194+ void readOneOrbitalCoefs (const std::string& s, hdf_archive& h5f, Vector<std::complex <double >>& cG) const ;
175195};
176196
177197} // namespace qmcplusplus
0 commit comments