14#include <pscf/crystal/UnitCell.h>
15#include <pscf/crystal/SpaceGroup.h>
16#include <pscf/crystal/shiftToMinimum.h>
17#include <pscf/mesh/Mesh.h>
18#include <pscf/mesh/MeshIterator.h>
19#include <util/signal/Signal.h>
20#include <util/format/Dbl.h>
21#include <util/math/Constants.h>
66 std::string groupName)
69 readGroup(groupName, group);
91 waves_.allocate(nWave_);
92 waveIds_.allocate(nWave_);
103 UTIL_THROW(
"Basis failed validity test suite");
107 isInitialized_ =
true;
122 void Basis<D>::makeWaves()
124 IntVec<D> meshDimensions = mesh().dimensions();
125 std::vector< BWave<D> > twaves;
126 twaves.reserve(nWave_);
132 for (itr.begin(); !itr.atEnd(); ++itr) {
133 w.indicesStd = itr.position();
134 v = shiftToMinimum(w.indicesStd, meshDimensions, unitCell_);
136 w.sqNorm = unitCell().ksq(v);
141 BWaveNormComp<D> comp;
142 std::sort(twaves.begin(), twaves.end(), comp);
145 for (
int i = 0; i < nWave_; ++i) {
146 waves_[i].sqNorm = twaves[i].sqNorm;
147 waves_[i].indicesStd = twaves[i].indicesStd;
148 waves_[i].indicesMin = twaves[i].indicesMin;
191 std::vector< BWave<D> > starList;
199 std::complex<double> coeff;
204 const double epsilon = 1.0E-8;
205 IntVec<D> meshDimensions = mesh().dimensions();
368 Gsq_max = waves_[0].sqNorm;
369 for (i = 1; i <= nWave_; ++i) {
372 bool newList =
false;
375 bunchSize = bunchEnd - bunchBegin;
378 Gsq = waves_[i].sqNorm;
379 if (Gsq > Gsq_max + epsilon) {
382 bunchSize = bunchEnd - bunchBegin;
393 for (j = bunchBegin; j < bunchEnd; ++j) {
394 wave.indicesStd = waves_[j].indicesStd;
395 wave.indicesMin = waves_[j].indicesMin;
396 wave.sqNorm = waves_[j].sqNorm;
397 if (j > bunchBegin) {
398 UTIL_CHECK( std::abs(wave.sqNorm-waves_[j].sqNorm)
413 rootItr = bunch.begin();
421 while (bunch.size() > 0) {
423 rootVecMin = rootItr->indicesMin;
424 rootVecStd = rootItr->indicesStd;
425 Gsq = rootItr->sqNorm;
434 for (j = 0; j < group.size(); ++j) {
438 vec = rootVecMin*group[j];
441 UTIL_CHECK(std::abs(Gsq - unitCell().ksq(vec)) < epsilon);
445 wave.indicesMin = shiftToMinimum(vec, meshDimensions,
447 wave.indicesStd = vec;
448 mesh().shift(wave.indicesStd);
453 for (k = 0; k < D; ++k) {
454 wave.phase += rootVecMin[k]*(group[j].t(k));
456 while (wave.phase > 0.5) {
459 while (wave.phase <= -0.5) {
476 if (wave.indicesStd == rootVecStd) {
477 if (std::abs(wave.phase) > 1.0E-6) {
484 setItr = star.find(wave);
486 if (setItr == star.end()) {
499 phase_diff = setItr->phase - wave.phase;
506 if (std::abs(phase_diff) > 1.0E-6) {
519 setItr = star.begin();
520 for ( ; setItr != star.end(); ++setItr) {
521 starList.push_back(*setItr);
526 std::sort(starList.begin(), starList.end(), waveMinComp);
529 int starListSize = starList.size();
530 for (j = 0; j < starListSize; ++j) {
531 bunch.erase(starList[j]);
532 bunchList.
append(starList[j]);
540 nBasisWave_ += star.size();
545 newStar.beginId = starBegin;
546 newStar.endId = newStar.beginId + star.size();
547 newStar.size = star.size();
548 newStar.cancel = cancel;
552 if (nextInvert == -1) {
558 newStar.invertFlag = -1;
559 rootItr = bunch.begin();
568 nVec.negate(rootVecMin);
571 (*meshPtr_).shift(nVec);
574 bool inverseFound =
false;
575 setItr = star.begin();
576 for ( ; setItr != star.end(); ++setItr) {
577 if (nVec == setItr->indicesStd) {
589 newStar.invertFlag = 0;
590 rootItr = bunch.begin();
598 newStar.invertFlag = 1;
605 setItr = bunch.begin();
606 for ( ; setItr != bunch.end(); ++setItr) {
607 if (nVec == setItr->indicesStd) {
619 std::cout <<
"Inverse not found for: " <<
"\n";
620 std::cout <<
" vec (std):"
621 << rootVecStd <<
"\n";
622 std::cout <<
" vec (min):"
623 << rootVecMin <<
"\n";
624 std::cout <<
"-vec (std):" << nVec <<
"\n";
632 stars_.append(newStar);
633 starBegin = newStar.endId;
644 for (j = 0; j < bunchList.
size(); ++j) {
646 waves_[k].indicesStd = bunchList[j].indicesStd;
647 waves_[k].indicesMin = bunchList[j].indicesMin;
648 waves_[k].sqNorm = bunchList[j].sqNorm;
649 coeff = std::complex<double>(0.0, bunchList[j].phase);
651 if (std::abs(
imag(coeff)) < 1.0E-6) {
652 coeff = std::complex<double>(
real(coeff), 0.0);
654 if (std::abs(
real(coeff)) < 1.0E-6) {
655 coeff = std::complex<double>(0.0,
imag(coeff));
657 waves_[k].coeff = coeff;
666 bunchBegin = bunchEnd;
671 nStar_ = stars_.size();
688 std::complex<double> rootCoeff;
689 std::complex<double> partCoeff;
690 std::complex<double> d;
692 for (i = 0; i < nStar_; ++i) {
696 if (stars_[i].invertFlag == 0) {
699 for (j = stars_[i].beginId; j < stars_[i].endId; ++j) {
700 if (waves_[j].inverseId < 0) {
703 nVec.negate(waves_[j].indicesMin);
704 (*meshPtr_).shift(nVec);
710 k = stars_[i].endId - 1 - (j - stars_[i].beginId);
711 if (nVec == waves_[k].indicesStd) {
712 waves_[j].inverseId = k;
713 waves_[k].inverseId = j;
718 for (k = j; k < stars_[i].endId; ++k) {
719 if (nVec == waves_[k].indicesStd) {
720 waves_[j].inverseId = k;
721 waves_[k].inverseId = j;
729 if (waves_[j].inverseId < 0) {
731 std::cout <<
"Inverse not found in closed star"
733 std::cout <<
"G = " << waves_[j].indicesMin
734 <<
", coeff = " << waves_[j].coeff
736 std::cout <<
"All waves in star " << i
738 for (k=stars_[i].beginId; k < stars_[i].endId; ++k) {
739 std::cout << waves_[k].indicesMin <<
" "
740 << waves_[k].coeff << std::endl;
751 rootId = stars_[i].beginId;
752 stars_[i].rootId = rootId;
753 stars_[i].waveMin = waves_[rootId].indicesMin;
755 if (stars_[i].cancel) {
758 std::complex<double> czero(0.0, 0.0);
759 for (j = stars_[i].beginId; j < stars_[i].endId; ++j) {
760 waves_[j].coeff = czero;
766 partId = waves_[rootId].inverseId;
769 rootCoeff = waves_[rootId].coeff;
770 for (j = stars_[i].beginId; j < stars_[i].endId; ++j) {
771 waves_[j].coeff /= rootCoeff;
773 rootCoeff = waves_[rootId].coeff;
778 if (partId != rootId) {
780 partCoeff = waves_[partId].coeff;
781 UTIL_CHECK(std::abs(std::abs(partCoeff) - 1.0) < 1.0E-9);
782 if (std::abs(partCoeff - rootCoeff) > 1.0E-6) {
784 if (
real(d) < -1.0E-4) {
787 if (std::abs(
real(d)) <= 1.0E-4) {
792 for (j=stars_[i].beginId; j < stars_[i].endId; ++j){
793 waves_[j].coeff /= d;
803 if (stars_[i].invertFlag == 1) {
808 UTIL_CHECK(stars_[i].size == stars_[i+1].size);
809 UTIL_CHECK(stars_[i].cancel == stars_[i+1].cancel);
813 for (j = stars_[i].beginId; j < stars_[i].endId; ++j) {
814 if (waves_[j].inverseId < 0) {
817 nVec.negate(waves_[j].indicesMin);
818 (*meshPtr_).shift(nVec);
824 k = stars_[i+1].endId - 1 - (j - stars_[i].beginId);
825 if (nVec == waves_[k].indicesStd) {
826 waves_[j].inverseId = k;
827 waves_[k].inverseId = j;
832 k = stars_[i+1].beginId;
833 for ( ; k < stars_[i+1].endId; ++k) {
834 if (nVec == waves_[k].indicesStd) {
835 waves_[j].inverseId = k;
836 waves_[k].inverseId = j;
851 for (j = stars_[i+1].beginId; j < stars_[i+1].endId; ++j) {
857 rootId = stars_[i].beginId;
858 stars_[i].rootId = rootId;
859 stars_[i].waveMin = waves_[rootId].indicesMin;
863 partId = waves_[rootId].inverseId;
864 stars_[i+1].rootId = partId;
865 stars_[i+1].waveMin = waves_[partId].indicesMin;
867 if (stars_[i].cancel) {
869 std::complex<double> czero(0.0, 0.0);
870 for (j = stars_[i].beginId; j < stars_[i].endId; ++j) {
871 waves_[j].coeff = czero;
873 for (j = stars_[i+1].beginId; j < stars_[i+1].endId; ++j) {
874 waves_[j].coeff = czero;
880 rootCoeff = waves_[rootId].coeff;
881 for (j = stars_[i].beginId; j < stars_[i].endId; ++j) {
882 waves_[j].coeff /= rootCoeff;
886 partCoeff = waves_[partId].coeff;
887 for (j = stars_[i+1].beginId; j < stars_[i+1].endId; ++j) {
888 waves_[j].coeff /= partCoeff;
901 for (i = 0; i < nStar_; ++i) {
902 double snorm = 1.0/sqrt(
double(stars_[i].size));
903 for (j = stars_[i].beginId; j < stars_[i].endId; ++j) {
904 waves_[j].coeff *= snorm;
905 waves_[j].starId = i;
910 for (i = 0; i < nWave_; ++i) {
911 if (std::abs(
real(waves_[i].coeff)) < 1.0E-8) {
913 = std::complex<double>(0.0,
imag(waves_[i].coeff));
915 if (std::abs(
imag(waves_[i].coeff)) < 1.0E-8) {
917 = std::complex<double>(
real(waves_[i].coeff), 0.0);
922 for (i = 0; i < nWave_; ++i) {
923 vec = waves_[i].indicesStd;
926 for (j = 0; j < D; ++j) {
932 if ((vec[D-1] + 1) > (meshDimensions[D-1]/2 + 1)) {
933 waves_[i].implicit =
true;
935 waves_[i].implicit =
false;
939 waveIds_[mesh().rank(vec)] = i;
943 starIds_.allocate(nBasis_);
945 for (i = 0; i < nStar_; ++i) {
946 stars_[i].starId = i;
947 if (stars_[i].cancel) {
948 stars_[i].basisId = -1;
950 stars_[i].basisId = j;
969 out <<
"N_wave" << std::endl;
971 out <<
" " << nWave_ << std::endl;
973 out <<
" " << nBasisWave_ << std::endl;
979 for (i = 0; i < nWave_; ++i) {
980 starId = waves_[i].starId;
981 if (outputAll || (!stars_[starId].cancel)) {
982 out <<
' ' <<
Int(k, 7);
983 out <<
' ' <<
Int(i, 7);
984 for (j = 0; j < D; ++j) {
985 out <<
' ' <<
Int(waves_[i].indicesMin[j], 4);
987 out <<
' ' <<
Int(waves_[i].starId, 5);
988 out <<
" " <<
Dbl(waves_[i].coeff.real(), 15);
989 out <<
" " <<
Dbl(waves_[i].coeff.imag(), 15);
1002 out <<
"N_star" << std::endl
1003 <<
" " << nStar_ << std::endl;
1005 out <<
"N_basis" << std::endl
1006 <<
" " << nBasis_ << std::endl;
1012 for (i = 0; i < nStar_; ++i) {
1013 if (outputAll || (!stars_[i].cancel)) {
1014 out <<
' ' <<
Int(stars_[i].basisId, 5);
1015 out <<
' ' <<
Int(i, 5);
1016 out <<
' ' <<
Int(stars_[i].size, 4)
1017 <<
' ' <<
Int(stars_[i].beginId, 7)
1018 <<
' ' <<
Int(stars_[i].endId, 7)
1019 <<
' ' <<
Int(stars_[i].invertFlag, 3);
1021 out <<
' ' <<
Int(stars_[i].cancel, 3);
1023 for (j = 0; j < D; ++j) {
1024 out <<
' ' <<
Int(stars_[i].waveMin[j], 5);
1036 int is, ib, iw, iwp, j;
1039 if (nWave_ != mesh().size()) {
1040 std::cout <<
"nWave != size of mesh" << std::endl;
1049 if (
wave(iw).indicesStd != v) {
1050 std::cout <<
"Inconsistent waveId and Wave::indicesStd"
1057 for (iw = 0; iw < nWave_; ++iw) {
1060 v = waves_[iw].indicesMin;
1062 if (std::abs(Gsq - waves_[iw].sqNorm) > 1.0E-8) {
1064 std::cout <<
"Incorrect sqNorm:" <<
"\n"
1065 <<
"wave.indicesMin = " <<
"\n"
1066 <<
"wave.sqNorm = " << waves_[iw].sqNorm <<
"\n"
1067 <<
"|v|^{2} = " << Gsq <<
"\n";
1073 if (v != waves_[iw].indicesStd) {
1075 std::cout <<
"shift(indicesMin) != indicesStd" << std::endl;
1080 is = waves_[iw].starId;
1081 if (iw < stars_[is].beginId) {
1083 std::cout <<
"Wave::starId < Star::beginId" << std::endl;
1086 if (iw >= stars_[is].endId) {
1088 std::cout <<
"Wave::starId >= Star::endId" << std::endl;
1093 if (waves_[iw].inverseId < 0) {
1095 std::cout <<
"Wave::inverseId not assigned\n";
1096 std::cout <<
"G = " << waves_[iw].indicesMin << std::endl;
1101 v.
negate(waves_[iw].indicesMin);
1103 iwp = waves_[iw].inverseId;
1104 if (waves_[iwp].indicesStd != v) {
1106 std::cout <<
"Wave::inverseId is not inverse" << std::endl;
1107 std::cout <<
"G = " << waves_[iw].indicesMin << std::endl;
1108 std::cout <<
"-G (from inverseId) = "
1109 << waves_[iwp].indicesMin << std::endl;
1114 if (waves_[iwp].inverseId != iw) {
1116 std::cout <<
"Wave::inverseId values do not agree\n";
1117 std::cout <<
"+G = " << waves_[iw].indicesMin << std::endl;
1118 std::cout <<
"-G = " << waves_[iwp].indicesMin << std::endl;
1123 if (waves_[iw].implicit ==
true && waves_[iwp].implicit ==
true)
1126 std::cout <<
"Wave and its inverse are both implicit";
1127 std::cout <<
"+G = " << waves_[iw].indicesMin << std::endl;
1128 std::cout <<
"-G = " << waves_[iwp].indicesMin << std::endl;
1135 for (is = 0; is < nStar_; ++is) {
1138 nWave += stars_[is].size;
1139 if (stars_[is].size != stars_[is].endId - stars_[is].beginId) {
1141 std::cout <<
"Inconsistent Star::size:" << std::endl;
1142 std::cout <<
"Star id " << is << std::endl;
1143 std::cout <<
"star size " << stars_[is].size << std::endl;
1144 std::cout <<
"Star begin " << stars_[is].beginId << std::endl;
1145 std::cout <<
"Star end " << stars_[is].endId << std::endl;
1149 if (stars_[is].beginId != stars_[is-1].endId) {
1151 std::cout <<
"Star ranges not consecutive:" << std::endl;
1152 std::cout <<
"Star id " << is << std::endl;
1153 std::cout <<
"stars_[" << is <<
"]" <<
".beginId = "
1154 << stars_[is].beginId << std::endl;
1155 std::cout <<
"stars_[" << is-1 <<
"]" <<
".endId = "
1156 << stars_[is-1].endId << std::endl;
1162 if (stars_[is].invertFlag == -1) {
1163 v.
negate(stars_[is-1].waveMin);
1164 v = shiftToMinimum(v, mesh().dimensions(), unitCell_);
1165 if (stars_[is].waveMin != v) {
1167 std::cout <<
"waveMin of star is not inverse of waveMin "
1168 <<
"of previous star" << std::endl;
1169 std::cout <<
"star id " << is << std::endl;
1170 std::cout <<
"waveMin " << stars_[is].waveMin << std::endl;
1171 std::cout <<
"waveMin (previous star) "
1172 << stars_[is-1].waveMin << std::endl;
1176 v = waves_[stars_[is].beginId].indicesMin;
1177 if (stars_[is].waveMin != v) {
1179 std::cout <<
"waveMin of star != first wave of star"
1181 std::cout <<
"star id " << is << std::endl;
1182 std::cout <<
"waveMin " << stars_[is].waveMin
1184 std::cout <<
"first wave " << v << std::endl;
1190 for (iw = stars_[is].beginId; iw < stars_[is].endId; ++iw) {
1191 if (waves_[iw].starId != is) {
1193 std::cout <<
"Inconsistent Wave::starId :" << std::endl;
1194 std::cout <<
"star id " << is << std::endl;
1195 std::cout <<
"star beginId " << stars_[is].beginId <<
"\n";
1196 std::cout <<
"star endId " << stars_[is].endId <<
"\n";
1197 std::cout <<
"wave id " << iw <<
"\n";
1198 std::cout <<
"wave starId " << waves_[iw].starId <<
"\n";
1204 if (stars_[is].starId != is) {
1206 std::cout <<
"stars_[is].starId != is for "
1207 <<
"is = " << is <<
"\n";
1212 ib = stars_[is].basisId;
1213 if (stars_[is].cancel) {
1216 std::cout <<
"basisId != -1 for cancelled star\n";
1217 std::cout <<
"star id = " << is <<
"\n";
1221 if (starIds_[ib] != is) {
1223 std::cout <<
"starIds_[stars_[is].basisId] != is for: \n";
1224 std::cout <<
"is = " << is <<
"\n";
1225 std::cout <<
"ib = stars_[is].basisId = " << ib <<
"\n";
1226 std::cout <<
"starIds_[ib] = " << starIds_[ib]
1233 for (iw = stars_[is].beginId + 1; iw < stars_[is].endId; ++iw) {
1234 if (waves_[iw].indicesMin > waves_[iw-1].indicesMin) {
1236 std::cout <<
"Failure of ordering by indicesB within star"
1240 if (waves_[iw].indicesMin == waves_[iw-1].indicesMin) {
1242 std::cout <<
"Equal values of indicesMin within star"
1249 if (stars_[is].cancel) {
1250 for (iw = stars_[is].beginId + 1; iw < stars_[is].endId; ++iw)
1252 if (std::abs(waves_[iw].coeff) > 1.0E-8) {
1254 std::cout <<
"Nonzero coefficient in a cancelled star"
1256 std::cout <<
"G = " << waves_[iw].indicesMin
1257 <<
" coeff = " << waves_[iw].coeff
1267 if (stars_[nStar_-1].endId != mesh().size()) {
1269 std::cout <<
"Star endId of last star != mesh size" << std::endl;
1272 if (
nWave != mesh().size()) {
1274 std::cout <<
"Sum of star sizes != mesh size" << std::endl;
1280 std::complex<double> cdel;
1283 while (is < nStar_) {
1284 cancel = stars_[is].cancel;
1286 if (stars_[is].invertFlag == 0) {
1289 int begin = stars_[is].beginId;
1290 int end = stars_[is].endId;
1291 for (iw = begin; iw < end; ++iw) {
1292 iwp = waves_[iw].inverseId;
1293 if (waves_[iwp].starId != is) {
1295 std::cout <<
"Inverse not found in closed star"
1297 std::cout <<
"G = " << waves_[iw].indicesMin
1298 <<
"coeff = " << waves_[iw].coeff
1300 std::cout <<
"All waves in star " << is <<
"\n";
1301 for (j=begin; j < end; ++j) {
1302 std::cout << waves_[j].indicesMin <<
" "
1303 << waves_[j].coeff <<
"\n";
1308 cdel = std::conj(waves_[iwp].coeff);
1309 cdel -= waves_[iw].coeff;
1310 if (std::abs(cdel) > 1.0E-8) {
1312 std::cout <<
"Function for closed star is not real:"
1314 std::cout <<
"+G = " << waves_[iw].indicesMin
1315 <<
" coeff = " << waves_[iw].coeff
1317 std::cout <<
"-G = " << waves_[iwp].indicesMin
1318 <<
" coeff = " << waves_[iwp].coeff
1320 std::cout <<
"Coefficients are not conjugates."
1322 std::cout <<
"All waves in star " << is <<
"\n";
1323 for (j=begin; j < end; ++j) {
1324 std::cout << waves_[j].indicesMin <<
" "
1325 << waves_[j].coeff <<
"\n";
1339 if (stars_[is].invertFlag != 1) {
1341 std::cout <<
"Expected invertFlag == 1" << std::endl;
1344 if (stars_[is+1].invertFlag != -1) {
1346 std::cout <<
"Expected invertFlag == -1" << std::endl;
1349 if (stars_[is+1].size != stars_[is].size) {
1351 std::cout <<
"Partner stars of different size" << std::endl;
1354 if (stars_[is+1].cancel != stars_[is].cancel) {
1356 std::cout <<
"Partners stars with different cancel flags"
1362 int begin1 = stars_[is].beginId;
1363 int end1 = stars_[is].endId;
1364 int begin2 = stars_[is+1].beginId;
1365 int end2 = stars_[is+1].endId;
1371 for (iw = begin1; iw < end1; ++iw) {
1372 iwp = waves_[iw].inverseId;
1373 if (waves_[iwp].starId != is + 1) {
1375 std::cout <<
"Inverse not found for G in open star"
1377 std::cout <<
"First star id = " << is << std::endl;
1378 std::cout <<
"+G = " << waves_[iw].indicesMin
1379 <<
"coeff = " << waves_[iw].coeff
1381 std::cout <<
"Waves in star " << is
1382 <<
" (starInvert ==1):" <<
"\n";
1383 for (j = begin1; j < end1; ++j) {
1384 std::cout << waves_[j].indicesMin <<
" "
1385 << waves_[j].coeff <<
"\n";
1387 std::cout <<
"Waves in star " << is+1
1388 <<
" (starInvert == -1):" <<
"\n";
1389 for (j=begin2; j < end2; ++j) {
1390 std::cout << waves_[j].indicesMin <<
" "
1391 << waves_[j].coeff <<
"\n";
1396 cdel = std::conj(waves_[iwp].coeff);
1397 cdel -= waves_[iw].coeff;
1398 if (std::abs(cdel) > 1.0E-8) {
1400 std::cout <<
"Error of coefficients in open stars:"
1402 std::cout <<
"First star id = " << is << std::endl;
1403 std::cout <<
"+G = " << waves_[iw].indicesMin
1404 <<
" coeff = " << waves_[iw].coeff
1406 std::cout <<
"-G = " << waves_[iwp].indicesMin
1407 <<
" coeff = " << waves_[iwp].coeff
1409 std::cout <<
"Coefficients are not conjugates."
1411 std::cout <<
"Waves in star " << is
1412 <<
" (starInvert ==1):" <<
"\n";
1413 for (j = begin1; j < end1; ++j) {
1414 std::cout << waves_[j].indicesMin <<
" "
1415 << waves_[j].coeff <<
"\n";
1417 std::cout <<
"Waves in star " << is+1
1418 <<
" (starInvert == -1):" <<
"\n";
1419 for (j=begin2; j < end2; ++j) {
1420 std::cout << waves_[j].indicesMin <<
" "
1421 << waves_[j].coeff <<
"\n";
1436 for (ib = 0; ib < nBasis_; ++ib) {
1438 if (stars_[is].cancel) {
1440 std::cout <<
"Star referred to by starIds_ is cancelled\n";
1443 if (stars_[is].basisId != ib) {
1445 std::cout <<
"Error: stars_[starIds_[ib]].basisId != ib\n";
1446 std::cout <<
"Basis function index ib = " << ib <<
"\n";
1447 std::cout <<
"is = starIds_[ib] = " << is <<
"\n";
1448 std::cout <<
"stars_[is].basisId = "
1449 << stars_[is].basisId <<
"\n";
A list of wavevectors that are related by space-group symmetries.
int nBasis() const
Total number of nonzero symmetry-adapted basis functions.
bool isValid() const
Returns true if this basis is valid, false otherwise.
int nWave() const
Total number of wavevectors.
void outputStars(std::ostream &out, bool outputAll=false) const
Print a list of all stars to an output stream.
void makeBasis(Mesh< D > const &mesh, UnitCell< D > const &unitCell, SpaceGroup< D > const &group)
Construct basis for a specific mesh and space group.
UnitCell< D > const & unitCell() const
Get the unit cell from which this basis was constructed.
int waveId(IntVec< D > vector) const
Get the integer index of a wave, as required by wave(int id).
Signal< void > & signal()
Get a Signal that is triggered by basis initialization.
Wave const & wave(int id) const
Get a specific Wave, access by integer index.
void outputWaves(std::ostream &out, bool outputAll=false) const
Print a list of all waves to an output stream.
An IntVec<D, T> is a D-component vector of elements of integer type T.
Iterator over points in a Mesh<D>.
void begin()
Set iterator to the first point in the mesh.
bool atEnd() const
Is this the end (i.e., one past the last point)?
IntVec< D > position() const
Get current position in the grid, as integer vector.
Description of a regular grid of points in a periodic domain.
Crystallographic space group.
void checkMeshDimensions(IntVec< D > const &dimensions) const
Check if input mesh dimensions are compatible with space group.
Base template for UnitCell<D> classes, D=1, 2 or 3.
Vec< D, T > & negate(const Vec< D, T > &v)
Return negative of vector v.
static const double Pi
Trigonometric constant Pi.
Dbl()
Default constructor.
An automatically growable array, analogous to a std::vector.
int size() const
Return the logical size of this array (number of elements).
void clear()
Reset to empty state.
void append(Data const &data)
Append an element to the end of the sequence.
Int()
Default constructor.
Notifier (or subject) in the Observer design pattern.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
double imag(fftw_complex const &a)
Return the imaginary part of an fftw_complex number.
double real(fftw_complex const &a)
Return the real part of an fftw_complex number.
PSCF package top-level namespace.
Comparator for BWave objects, based on BWave::indicesMin.
Comparator for BWave objects, based on BWave::indicesStd.
Wave struct designed for use within Basis construction.