29 const Array<dVec,1> &initialPos,
int numberBroken) :
30 numTimeSlices(_numTimeSlices),
32 worm(initialPos.size()),
37 int numParticles = initialPos.size();
44 for (
int n = 0; n < numParticles; n++) {
45 for (
int i = 0; i <
NDIM; i++)
46 beads(Range::all(),n)[i] = initialPos(n)[i];
61 prevLink(0,Range::all()) =
XXX;
66 if (numberBroken > 0){
68 for (
int n=0; n<numberBroken; n++){
76 }
else if(
constants()->spatialSubregionOn()){
136 for (bead1[1] = 0; bead1[1] < beads.extent(secondDim); bead1[1]++) {
141 bool foundBead =
false;
142 for (bead2[1] = bead1[1] + 1; bead2[1] < beads.extent(secondDim); bead2[1]++) {
153 beads(bead1) = beads(bead2);
184 beads(beadIndex) = pos;
202 int slice = prevIndex[0] + 1;
206 beadIndex =
addBead(slice,pos);
208 next(prevIndex) = beadIndex;
209 prev(beadIndex) = prevIndex;
227 int slice = nextIndex[0] - 1;
232 beadIndex =
addBead(slice,pos);
234 prev(nextIndex) = beadIndex;
235 next(beadIndex) = nextIndex;
254 lastBeadIndex[0] = slice;
259 if (lastBeadIndex[1] == numWorldLines) {
264 beads(Range::all(),numWorldLines) = 0.0;
269 worm.beads(Range::all(),numWorldLines) = 0;
274 prevLink(Range::all(),numWorldLines) =
XXX;
275 nextLink(Range::all(),numWorldLines) =
XXX;
295 beads(lastBeadIndex) = pos;
299 return lastBeadIndex;
313 prevBead =
prev(beadIndex);
330 nextBead =
next(beadIndex);
353 lastBeadIndex[0] = beadIndex[0];
357 if (!all(
next(beadIndex)==
XXX))
359 if (!all(
prev(beadIndex)==
XXX))
369 beads(beadIndex) = beads(lastBeadIndex);
372 prev(beadIndex) =
prev(lastBeadIndex);
373 next(beadIndex) =
next(lastBeadIndex);
375 if (!all(
next(lastBeadIndex)==
XXX))
376 prev(
next(lastBeadIndex)) = beadIndex;
377 if (!all(
prev(lastBeadIndex)==
XXX))
378 next(
prev(lastBeadIndex)) = beadIndex;
408 nextLink(beadIndexL[0],beadIndexL[1]) =
XXX;
409 prevLink(beadIndexR[0],beadIndexR[1]) =
XXX;
416 nextLink(beadIndexL[0],beadIndexL[1]) = beadIndexR;
417 prevLink(beadIndexR[0],beadIndexR[1]) = beadIndexL;
431 vector<int>::iterator itr;
447 vector<int>::iterator itr;
474 if( all(
next(beadIndex) ==
XXX))
483 if( all(
prev(beadIndex) ==
XXX))
523 ( beads(beadIndex)[0] <
constants()->spatialSubregion() ) )
546 bool foundError =
false;
553 foundError = (all(
prev(beadIndex)!=
XXX));
555 foundError = (all(
prev(beadIndex)==
XXX));
560 cout << beadIndex[1] <<
'\t' << beads(beadIndex) <<
't' <<
585 communicate()->
file(
"wl")->stream() << format(
"# START_CONFIG %06d\n") % configNumber;
591 for (
int n = 0; n < numParticles; n++) {
595 communicate()->
file(
"wl")->stream() << format(
"%8d %8d %8d") % beadIndex[0]
600 for (i = 0; i <
NDIM; i++) {
601 communicate()->
file(
"wl")->stream() << format(
"%16.3E") % (beads(beadIndex)[i]);
610 %
prev(beadIndex)[1] %
next(beadIndex)[0] %
next(beadIndex)[1];
613 beadIndex =
next(beadIndex);
616 communicate()->
file(
"wl")->stream() << format(
"# END_CONFIG %06d\n") % configNumber;
623 Array <beadLocator,1> startBead,endBead;
624 startBead.resize(numParticles);
625 endBead.resize(numParticles);
628 Array <int,1> wlLength(numParticles);
631 int numWorldLines = 0;
647 beadIndex = startBead(nwl);
649 doBead(beadIndex) =
false;
650 beadIndex =
next(beadIndex);
651 }
while (!all(beadIndex==endBead(nwl)));
662 for (
int n = 0; n < numParticles; n++) {
668 if (doBead(testStart)) {
670 startBead(nwl) = testStart;
673 endBead(nwl) = startBead(nwl);
676 beadIndex = startBead(nwl);
679 doBead(beadIndex) =
false;
681 beadIndex =
next(beadIndex);
682 }
while (!all(beadIndex==endBead(nwl)));
695 communicate()->
file(
"wl")->stream() << format(
"# START_CONFIG %06d\n") % configNumber;
701 for (
int n = 0; n < numWorldLines; n++) {
702 beadIndex = startBead(n);
705 beadIndex[0] % beadIndex[1] % wlLength(n);
709 for (i = 0; i <
NDIM; i++) {
710 communicate()->
file(
"wl")->stream() << format(
"%16.3E") % (beads(beadIndex)[i]);
719 %
prev(beadIndex)[1] %
next(beadIndex)[0] %
next(beadIndex)[1];
722 beadIndex =
next(beadIndex);
723 }
while (!all(beadIndex==endBead(n)));
725 communicate()->
file(
"wl")->stream() << format(
"# END_CONFIG %06d\n") % configNumber;
753 for (
int n = 0; n < numWorldLines; n++) {
758 (*outFilePtr) <<
"^";
760 (*outFilePtr) <<
"z";
763 else if (all(beadIndex==
worm.
tail)) {
765 (*outFilePtr) <<
"v";
767 (*outFilePtr) <<
"y";
772 (*outFilePtr) <<
"*";
774 (*outFilePtr) <<
" ";
778 (*outFilePtr) <<
"\t";
780 for (
int n = 0; n < numWorldLines; n++) {
784 (*outFilePtr) <<
" ";
786 (*outFilePtr) <<
"|";
789 (*outFilePtr) <<
"\t";
792 for (
int n = 0; n < numWorldLines; n++) {
795 bool foundWormBead =
false;
797 for (
int k = 0; k < wormBeads.extent(firstDim); k++) {
799 if (all(beadIndex==wormBeads(k))) {
800 foundWormBead =
true;
801 if ((k > 0) && (k < (wormBeads.extent(firstDim)-1))) {
802 if ( (wormBeads(k+1)[1] > wormBeads(k)[1]) ||
803 (wormBeads(k-1)[1] < wormBeads(k)[1]) )
805 else if ( (wormBeads(k+1)[1] < wormBeads(k)[1]) ||
806 (wormBeads(k-1)[1] > wormBeads(k)[1]) )
817 (*outFilePtr) <<
"^";
819 (*outFilePtr) <<
"v";
821 (*outFilePtr) << beadOut;
825 (*outFilePtr) <<
"~";
827 (*outFilePtr) <<
" ";
832 (*outFilePtr) << endl;
835 (*outFilePtr) << endl;
File * file(string type)
Get method returning file object.
The base class which holds details on the generalized box that our system will be simulated inside of...
The particle (bead) lookup table.
void updateGrid(const Path &)
We update the full nearest neighbor grid by filling up all data arrays at all time slices.
void resizeList(int _numParticles)
Resize the bead and grid lists.
void addBead(const beadLocator &, const dVec &)
Add a single bead to the NN grid and position pos.
void updateBead(const beadLocator &, const dVec &)
Update the NN grid with a new bead position.
void delBead(const beadLocator &)
Remove a single bead from the NN grid.
bool inSubregionA(const beadLocator &) const
Checks to see if bead is in subregion A/B at break slice + 1.
int getNumParticles() const
Get the size of the worldline array.
beadLocator delBeadGetNext(const beadLocator &)
Delete a bead and move forwards.
Path(const Container *, LookupTable &, int, const Array< dVec, 1 > &, int numberBroken=0)
Constructor.
void resetBrokenClosedVecs()
Reset broken/closed worldline vectors.
void leftPack()
Initialize any loaded state by left packing the array.
beadLocator delBeadGetPrev(const beadLocator &)
Delete a bead and move backwards.
void outputConfig(int) const
Output the world-line configurations in a generic format.
vector< int > closedWorldlines
A list of particles with closed worldlines on left of break.
vector< int > brokenWorldlinesR
A list of particles with broken worldlines on right of break.
bool checkSubregionLinks() const
Check if only subregion worldlines are broken, for debugging.
void delBead(const beadLocator &)
Remove a bead from the world-line configuration.
void printWormConfig(Array< beadLocator, 1 > &)
Used when debugging worm configurations.
bool isBroken(const beadLocator &) const
Checks to see if worldline is broken.
void makeLink(const beadLocator &, const beadLocator &)
Make a link between beads.
vector< int > brokenWorldlinesL
A list of particles with broken worldlines on left of break.
void removeCenterLink(const beadLocator &)
Break the link to right of bead t center slice AND update lists.
double breakFactor(const beadLocator &, const beadLocator &) const
Returns factor for broken worldines.
const int numTimeSlices
A local constant copy of the number of time slices.
beadLocator addPrevBead(const beadLocator &, const dVec &)
Add a bead at the previous time slice.
Array< int, 1 > numBeadsAtSlice
The number of active beads at a given time slice.
int breakSlice
The location of the break in the path (0=>no break)
beadLocator addBead(const int, const dVec &)
Add a bead to the worldline configuration at a given slice.
void addCenterLink(const beadLocator &, const beadLocator &)
Make a link between beads at center slice AND update lists.
bool inSubregionB(const beadLocator &) const
Check if bead is in subregion B.
void updateBead(const beadLocator &, const dVec &)
Update the position of a bead in the worldine configuration.
beadLocator & next(int slice, int ptcl)
Move one link forward in imaginary time.
Worm worm
Details on the worm.
beadLocator & prev(int slice, int ptcl)
Move one link backward in imaginary time.
beadLocator addNextBead(const beadLocator &, const dVec &)
Add a bead at the next time slice.
LookupTable & lookup
A reference to the nearest neighbor lookup table.
void breakLink(const beadLocator &)
Break the link to right of bead.
bool isConfigDiagonal
Stores the diagonality of the configuration.
beadLocator tail
The coordinates of the worm tail.
beadLocator head
The coordinates of the worm head.
beadLocator special2
Special bead, used in move updates.
void delBead(int, int)
Safely delete a bead (int indexed)
int beadOn(int, int) const
Safely get a bead (int indexed)
void incNumBeadsOn()
Increment the number of active beads.
void decNumBeadsOn()
Decrement the number of active beads.
const Array< unsigned int, 2 > & getBeads() const
Return the bead list.
void addBead(int, int)
Safely add a bead (int indexed)
beadLocator special1
Special bead, used in move updates.
#define NDIM
Number of spatial dimnsions.
TinyVector< int, 2 > beadLocator
time-slice,bead-number world line index
TinyVector< double, NDIM > dVec
A NDIM-vector of type double.
#define PIMC_ASSERT(X)
Rename assert method.
#define XXX
Used to refer to a nonsense beadIndex.
Class definitions for all file input/output.
Communicator * communicate()
Global public access to the communcator singleton.
ConstantParameters * constants()
Global public access to the constants.
LookupTable class definition.