16 std::string spo_object_name;
19 attrib.
add(norb,
"size");
20 attrib.
add(twist,
"twist");
21 attrib.
add(spo_object_name,
"name");
25 throw std::runtime_error(
"free orbital SPO set require the \"size\" input");
33 app_log() <<
"twist fraction = " << twist << std::endl;
34 app_log() <<
"twist cartesian = " << tvec << std::endl;
36 const int npw =
std::ceil((norb + 1.0) / 2);
37 if (2 * npw - 1 != norb)
39 std::ostringstream msg;
40 msg <<
"norb = " << norb <<
" npw = " << npw;
41 msg <<
" cannot be ran in real PWs (sin, cos)" << std::endl;
42 msg <<
"either use complex build or change the size of SPO set" << std::endl;
43 msg <<
"ideally, set size to a closed shell of PWs." << std::endl;
44 throw std::runtime_error(msg.str());
46 for (
int ldim = 0; ldim < twist.
size(); ldim++)
49 throw std::runtime_error(
"no twist for real orbitals");
55 std::vector<PosType> kpts(npw);
63 for (
int ik = 1; ik < npw; ik++)
68 const int nktot = klists.
kpts.size();
69 std::vector<int> mkidx(npw, 0);
71 for (
int jk = 0; jk < nktot; jk++)
74 const int jmk = klists.
minusk[jk];
85 auto sposet = std::make_unique<FreeOrbital>(spo_object_name, kpts);
92 for (
int i = 0; i < l.size(); i++)
FreeOrbitalBuilder(ParticleSet &els, Communicate *comm, xmlNodePtr cur)
std::vector< PosType > kpts_cart
K-vector in Cartesian coordinates.
helper functions for EinsplineSetBuilder
QTBase::RealType RealType
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
std::unique_ptr< SPOSet > createSPOSetFromXML(xmlNodePtr cur) override
create an sposet from xml (legacy)
bool put(xmlNodePtr cur)
assign attributes to the set
bool in_list(const int j, const std::vector< int > l)
Wrapping information on parallelism.
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
Specialized paritlce class for atomistic simulations.
base class for the real SPOSet builder
MakeReturn< UnaryNode< FnCeil, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t ceil(const Vector< T1, C1 > &l)
class to handle a set of attributes of an xmlNode
void setTwist(const SingleParticlePos &t)
std::vector< int > minusk
Given a k index, return index to -k.
const auto & getLattice() const
void updateKLists(const ParticleLayout &lattice, RealType kc, unsigned ndim, const PosType &twist=PosType(), bool useSphere=true)
k points sorted by the |k| excluding |k|=0
std::vector< TinyVector< int, DIM > > kpts
K-vector in reduced coordinates.
void add(PDT &aparam, const std::string &aname, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new attribute