Skip to content

Commit

Permalink
Merge pull request #21 from Peteracn96:coherence_factor
Browse files Browse the repository at this point in the history
Fixes blochCoherenceFactor function
  • Loading branch information
alejandrojuria authored Jul 3, 2024
2 parents 58b8716 + 1b259c8 commit 92a2c80
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/ExcitonTB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,11 +602,17 @@ std::complex<double> ExcitonTB::blochCoherenceFactor(const arma::cx_vec& coefs1,
std::complex<double> imag(0, 1);
arma::cx_vec coefs = arma::conj(coefs1) % coefs2;
arma::cx_vec phases = arma::ones<arma::cx_vec>(system->basisdim);
int index_min = 0;
int index_max = -1;

for(int i = 0; i < system->natoms; i++){
int species = system->motif.row(i)(3);
arma::rowvec atomPosition = system->motif.row(i).subvec(0, 2);
phases.subvec(i*system->orbitals(species), (i+1)*system->orbitals(species) - 1) *=
exp(imag*arma::dot(k1 - k2 + G, atomPosition));
arma::rowvec atomPosition = system->motif.row(i).subvec(0, 2);

index_max += system->orbitals(species);
phases.subvec(index_min, index_max) *= exp(imag*arma::dot(k1 - k2 + G, atomPosition));

index_min = index_max + 1;
}

std::complex<double> factor = arma::dot(coefs, phases);
Expand Down

0 comments on commit 92a2c80

Please sign in to comment.