5 #ifndef _DENSITYOFSTATES_H_
6 #define _DENSITYOFSTATES_H_
37 void binMode(
const int mode,
const int noBins,
const T minw,
const T maxw)
39 const T dwStar=1./T(noBins);
46 Deltaw=(1-ratio)*maxw;
48 TArray modeBounds(noBins+1);
54 for(
int i=0;i<noBins+1;i++)
55 modeBounds[i]=floor(i*dwStar*Deltaw+minw);
57 for(
int i=0;i<noBins;i++)
58 modeMids[i]=(modeBounds[i]+modeBounds[i+1])/2.;
62 for(
int k=0;k<klen;k++)
65 int bin=
findBin(modeBounds, omega);
69 for(
int i=0;i<noBins;i++)
73 modeKpts.push_back(newArrPtr);
78 for(
int k=0;k<klen;k++)
81 int bin=
findBin(modeBounds, omega);
83 binArray[BinKcount[bin]]=k;
87 addMode(modeBounds, modeMids, modeKpts, mode);
93 const T dwStar=1./T(noBins);
100 Deltaw=(1-ratio)*maxw;
102 TArray modeBounds(noBins+1);
111 for(
int i=0;i<noBins+1;i++)
112 modeBounds[i]=floor(i*dwStar*Deltaw+minw);
114 for(
int i=0;i<noBins;i++)
115 modeMids[i]=(modeBounds[i]+modeBounds[i+1])/2.;
119 for(
int k=0;k<klen;k++)
123 for(
int m=0;m<modeNum;m++)
126 int bin=
findBin(modeBounds, omega);
132 for(
int i=0;i<noBins;i++)
138 modeKpts.push_back(newArrPtr);
139 Mpts.push_back(newArrPtr1);
145 for(
int k=0;k<klen;k++)
149 for(
int m=0;m<modeNum;m++)
152 int bin=
findBin(modeBounds, omega);
155 binArray[BinKcount[bin]]=k;
156 mbinArray[BinKcount[bin]]=m;
202 const T freqDif=wMax-wMin;
210 DOSfile.open(filename);
227 if(freq>bounds[i] && freq<=bounds[i+1])
230 throw CException(
"Frequency not in given discretization!");
262 const T vdot=vg[0]*n[0]+vg[1]*n[1]+vg[2]*n[2];
313 for(
int f0=0;f0<freqCount;f0++)
316 const int f1=otherDOS.
findBin(w0);
319 if(mat1sum==0. && mat0sum==0.)
322 (*trans)[f0]=1./(1.+mat0sum/mat1sum);
345 const T vdot=vg[0]*n[0]+vg[1]*n[1]+vg[2]*n[2];
350 outSum+=dk3*vdot*e0*tau;
368 T ceil=
min(old[0], mBounds[0]);
371 while(i<old.getLength() || j<mBounds.getLength())
373 if(i<old.getLength())
378 if(j<mBounds.getLength())
393 else if( o>=ceil && o<m)
402 else if(m>=ceil && m<o)
413 TArray newBounds(newBinCount+1);
414 ceil=
min(old[0], mBounds[0]);
420 while(i<old.getLength() || j<mBounds.getLength())
422 if(i<old.getLength())
427 if(j<mBounds.getLength())
436 newBounds[newBinCount]=o;
442 else if( o>=ceil && o<m)
447 newBounds[newBinCount]=o;
452 else if(m>=ceil && m<o)
457 newBounds[newBinCount]=m;
475 for(
int k=0;k<klen;k++)
479 for(
int mode=0;mode<modenum;mode++)
493 const int len=BinPop[fInd];
503 for(
int k=0;k<klen;k++)
507 for(
int mode=0;mode<modenum;mode++)
513 binKArray[BinPop[bin]]=k;
514 binMArray[BinPop[bin]]=mode;
552 for(
int j=0;j<newBinCount+1;j++)
561 (*refl)[i]=1.-(*Ttrans)[i];
596 T ceil=
min(old[0], mBounds[0]);
599 while(i<old.getLength() || j<mBounds.
getLength())
601 if(i<old.getLength())
621 else if( o>=ceil && o<m)
630 else if(m>=ceil && m<o)
641 TArray newBounds(newBinCount+1);
642 ceil=
min(old[0], mBounds[0]);
648 while(i<old.getLength() || j<mBounds.
getLength())
650 if(i<old.getLength())
664 newBounds[newBinCount]=o;
670 else if( o>=ceil && o<m)
675 newBounds[newBinCount]=o;
680 else if(m>=ceil && m<o)
685 newBounds[newBinCount]=m;
699 for(
int k=0; k<mBounds.
getLength()-1;k++)
701 const T mTop=mBounds[k+1];
702 const T mBot=mBounds[k];
719 for(
int k=0; k<old.getLength()-1;k++)
721 const T oTop=old[k+1];
747 const int len=BinPop[fInd];
758 for(
int k=0; k<mBounds.
getLength()-1;k++)
760 const T mTop=mBounds[k+1];
761 const T mBot=mBounds[k];
762 const T dif=mTop-mBot;
770 const T coeff=masterDif/dif;
775 for(
int addInd=0;addInd<klist.
getLength();addInd++)
777 newKArray[BinPop[l]]=klist[addInd];
778 newMArray[BinPop[l]]=mode;
779 newFArray[BinPop[l]]=coeff;
793 for(
int k=0; k<old.getLength()-1;k++)
795 const T oTop=old[k+1];
797 const T dif=oTop-oBot;
800 TArray& fraclist=*oldModeFractions[k];
807 const T coeff=masterDif/dif;
812 for(
int addInd=0;addInd<klist.
getLength();addInd++)
814 newKArray[BinPop[l]]=klist[addInd];
815 newMArray[BinPop[l]]=mlist[addInd];
816 newFArray[BinPop[l]]=coeff*fraclist[addInd];
TArray & getModeFractions(const int fBin)
void binMode(const int mode, const int noBins, const T minw, const T maxw)
vector< TArrPtr > TArrList
void copyDOS(DensityOfStates &otherDOS)
int findBin(const TArray &bounds, const T freq)
Tkvol & getkvol(int n) const
Tmode & getmode(int n) const
ArrayBase * makeDMMreflection(ArrayBase *trans)
const Tkspace & getKspace()
ArrayBase * getFreqMids()
T sumOutgoing(const VectorT3 &n, const int fBin, const T Temp)
T calcBinFlux(const T Temp, const int fBin, const T tau)
void resize(const int newLength)
shared_ptr< TArray > TArrPtr
IntArray & getMIndices(const int fBin)
void saveNormDOS(const char *filename)
ArrayBase * getFreqBins()
void addMode(const TArray &mBounds, const TArray &mMids, const IntArrList &mKlist, const int mode)
IntArrList & getKptsList()
const int findBin(const T freq) const
DensityOfStates(const Tkspace &kspace)
shared_ptr< IntArray > IntArrayPtr
void binEntireKspace(const int noBins, const T minw, const T maxw)
IntArray & getKIndices(const int fBin)
double min(double x, double y)
virtual void copyFrom(const IContainer &oc)
void mergeBins(DensityOfStates &otherDOS, const bool original)
ArrayBase * makeDMMtransmission(DensityOfStates &otherDOS, const T Temp, const bool merge)
vector< IntArrayPtr > IntArrList