Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start rewrites #6

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile.buildenv
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ RUN apt-get -y install valgrind gdb strace
RUN apt-get -y install libhdf5-dev libeigen3-dev

RUN groupadd -g $GID -o $UNAME && useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME
RUN chown $UNAME /usr/local/bin

USER $UNAME
RUN mkdir /home/${UNAME}/kite
Expand Down
4 changes: 2 additions & 2 deletions tools/src/arpes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,15 +366,15 @@ void arpes<U, DIM>::calculate(){
if(calculate_full_arpes){

Eigen::Matrix<double, -1, -1> incidents = Eigen::Matrix<double, -1, -1>::Zero(DIM, NumVectors);
for(int ii = 0; ii < NumVectors; ii++){
for(unsigned int ii = 0; ii < NumVectors; ii++){
incidents.col(ii) = incident_vector;
}

Eigen::Matrix<double, -1, -1> modulation = Eigen::Matrix<double, -1, -1>::Zero(1, NumVectors);
modulation = incident_vector.matrix().transpose()*(incidents + arpes_k_vectors.matrix())/incident_vector.matrix().norm();


for(int ii = 0; ii < NumVectors; ii++){
for(unsigned int ii = 0; ii < NumVectors; ii++){
ARPES.col(ii) *= modulation(ii)*modulation(ii);
}
}
Expand Down
2 changes: 1 addition & 1 deletion tools/src/cond_2order/Gamma1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Eigen::Matrix<std::complex<U>, -1, -1> conductivity_nonlinear<U, DIM>::Gamma1shg
int thread_num;
int local_NumMoments;
omp_set_num_threads(systemInfo.NumThreads);
#pragma omp parallel shared(N_threads, cond) firstprivate(thread_num, DeltaMatrix)
#pragma omp parallel shared(N_threads, cond) firstprivate(DeltaMatrix) private(thread_num)
{
#pragma omp master
{
Expand Down
2 changes: 1 addition & 1 deletion tools/src/cond_2order/Gamma1photo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Eigen::Matrix<std::complex<U>, -1, -1> conductivity_nonlinear<U, DIM>::Gamma1con
int local_NumMoments;

omp_set_num_threads(systemInfo.NumThreads);
#pragma omp parallel shared(N_threads, cond) firstprivate(thread_num, DeltaMatrix)
#pragma omp parallel shared(N_threads, cond) firstprivate(DeltaMatrix) private(thread_num)
{
#pragma omp master
{
Expand Down
18 changes: 14 additions & 4 deletions tools/src/cond_2order/Gamma2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Eigen::Matrix<std::complex<U>, -1, -1> conductivity_nonlinear<U, DIM>::Gamma2shg
int thread_num;
int local_NumMoments;
omp_set_num_threads(systemInfo.NumThreads);
#pragma omp parallel shared(N_threads, cond) firstprivate(thread_num, DeltaMatrix)
#pragma omp parallel shared(N_threads, cond) firstprivate(DeltaMatrix) private(thread_num)
{
#pragma omp master
{
Expand Down Expand Up @@ -72,11 +72,21 @@ Eigen::Matrix<std::complex<U>, -1, -1> conductivity_nonlinear<U, DIM>::Gamma2shg
local_cond = Eigen::Matrix<std::complex<U>, -1, -1>::Zero(N_energies, N_omegas);

// Loop over the frequencies
//U w1, w2;
U w1, w2;
/*
* Although frequencies2(w,0) was used to set w1 this value is never being used again.
* So i removed w1 from the code. To make sure that the program works exactly the same
* I still run frequencies2(w,0). This is needed because this function might do some
* things that influence other data, generate output, ...
*
* I assume that not using w1 was an oversight. If this is true I suggest uncommenting the
* code again and actually using it.
*
* -- Nikolas Garofil
*/
U /*w1,*/ w2;
std::complex<U> GammaEp, GammaEn, GammaE;
for(int w = 0; w < N_omegas; w++){
w1 = frequencies2(w,0);
/*w1 = */frequencies2(w,0);
w2 = frequencies2(w,1);

for(int e = 0; e < N_energies; e++){
Expand Down
2 changes: 1 addition & 1 deletion tools/src/cond_2order/Gamma2photo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Eigen::Matrix<std::complex<U>, -1, -1> conductivity_nonlinear<U, DIM>::Gamma2con
int thread_num;
int local_NumMoments;
omp_set_num_threads(systemInfo.NumThreads);
#pragma omp parallel shared(N_threads, cond) firstprivate(thread_num, DeltaMatrix)
#pragma omp parallel shared(N_threads, cond) firstprivate(DeltaMatrix) private(thread_num)
{
#pragma omp master
{
Expand Down
3 changes: 0 additions & 3 deletions tools/src/cond_2order/Gamma3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ Eigen::Matrix<std::complex<U>, -1, -1> conductivity_nonlinear<U, DIM>::Gamma3shg
// number of threads, thread number and number of moments alocated
// to each thread. These have to be computed inside a threaded block
int N_threads;
int thread_num;
int local_NumMoments;

// Functions that are going to be used by the contractor
Expand Down Expand Up @@ -143,7 +142,6 @@ Eigen::Matrix<std::complex<U>, -1, -1> conductivity_nonlinear<U, DIM>::Gamma3shg
// number of threads, thread number and number of moments alocated
// to each thread. These have to be computed inside a threaded block
int N_threads;
int thread_num;
int local_NumMoments;

// Functions that are going to be used by the contractor
Expand Down Expand Up @@ -256,7 +254,6 @@ Eigen::Matrix<std::complex<U>, -1, -1> conductivity_nonlinear<U, DIM>::Gamma3shg
// number of threads, thread number and number of moments alocated
// to each thread. These have to be computed inside a threaded block
int N_threads;
int thread_num;
int local_NumMoments;

// Functions that are going to be used by the contractor
Expand Down
1 change: 0 additions & 1 deletion tools/src/cond_2order/Gamma3photo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ Eigen::Matrix<std::complex<U>, -1, -1> conductivity_nonlinear<U, DIM>::Gamma3Con
// number of threads, thread number and number of moments alocated
// to each thread. These have to be computed inside a threaded block
int N_threads;
int thread_num;
int local_NumMoments;

// Functions that are going to be used by the contractor
Expand Down
18 changes: 14 additions & 4 deletions tools/src/cond_2order/conductivity_2order.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ conductivity_nonlinear<T, DIM>::conductivity_nonlinear(system_info<T, DIM>& info
// KPM parameters
NumPoints = -1;
special = 0;
dirString;

std::string name = info.filename; // name of the hdf5 file
file = H5::H5File(name.c_str(), H5F_ACC_RDONLY);
Expand Down Expand Up @@ -347,11 +346,22 @@ void conductivity_nonlinear<U, DIM>::calculate_photo(){
}

U freq;
U w1, w2;
/*
* Although frequencies2() was used to set w1 and w2 these values are never being used again.
* So i removed w1 and w2 from the code. To make sure that the program works exactly the same
* I still run the frequencies2() functions. This is needed because this function might do some
* things that influence other data, generate output, ...
*
* I assume that not using w1 and w2 was an oversight. If this is true I suggest uncommenting the
* code again and actually using it.
*
* -- Nikolas Garofil
*/
//U w1, w2;
for(int w = 0; w < N_omegas; w++){
freq = frequencies(w);
w1 = frequencies2(w,0);
w2 = frequencies2(w,1);
/*w1 =*/ frequencies2(w,0);
/*w2 =*/ frequencies2(w,1);

// Energy integration
cond0(w) = integrate(energies, Eigen::Matrix<std::complex<U>,-1,1>(omega_energies0.col(w)));
Expand Down
2 changes: 1 addition & 1 deletion tools/src/cond_dc/conductivity_dc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ void conductivity_dc<U, DIM>::calculate2(){

// save to a file
save_to_file(condDC);
};
}


// Instantiations
Expand Down
27 changes: 10 additions & 17 deletions tools/src/macros.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define outcol "\033[1;31m"
#define outres "\033[0m"
#define TEXTCOLOR_RED "\033[1;31m"
#define TEXTCOLOR_RESET "\033[0m"

#ifndef DEBUG
#define DEBUG 1
Expand All @@ -9,29 +9,22 @@
#define VERBOSE 1
#endif

#define PI 3.14159265
// The first scale is 1/2pi and corresponds to the conductance quantum per spin e^2/h
// The second scale is the universal conductivity of graphene e^2/4h_bar
#define scale1 0.159154943
#define scale1 1/(2*PI)
#define scale2 0.25
#define unit_scale 0.159154943
#define unit_scale 1/(2*PI)

#ifdef VERBOSE
#if VERBOSE==1
#define verbose_message(VAR) std::cout<<VAR<<std::flush
#else
#define verbose_message(VAR)
#endif
#if VERBOSE==1
#define verbose_message(VAR) std::cout<<VAR<<std::flush
#else
#define verbose_message(VAR)
#endif

#ifdef DEBUG
#if DEBUG==1
#define debug_message(VAR) std::cout << outcol << VAR << outres << std::flush
#define verbose_message(VAR) std::cout<<VAR<<std::flush
#else
#define debug_message(VAR)
#endif
#if DEBUG==1
#define debug_message(VAR) std::cout << TEXTCOLOR_RED << VAR << TEXTCOLOR_RESET << std::flush
#define verbose_message(VAR) std::cout<<VAR<<std::flush
#else
#define debug_message(VAR)
#endif
4 changes: 0 additions & 4 deletions tools/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
#include "compiletime_info.h"

int main(int argc, char *argv[]){
if(argc < 2){
std::cout << "No configuration file found. Exiting.\n";
exit(1);
}
shell_input variables(argc, argv);
print_header_message();
print_info_message();
Expand Down
82 changes: 44 additions & 38 deletions tools/src/messages.hpp
Original file line number Diff line number Diff line change
@@ -1,53 +1,59 @@
void print_header_message(){
#if VERBOSE
std::cout <<
"\n+------------------------------------------------------------------------+\n"
"| Chebyshev Polynomial Green's Function Approach | \n"
"| to Real-Space Quantum Transport Simulations | \n"
"| | \n"
"| KITE | Release 1.0 | \n"
"| Kite home: quantum-kite.com | \n"
"| | \n"
"| Created by Simao M. Joao, Joao V. Lopes (Universidade do Porto), | \n"
"| Tatiana G. Rappoport (Universidade Federal Rio de Janeiro), | \n"
"| Misa Andelkovic, Lucian Covaci (University of Antwerp) | \n"
"| and Aires Ferreira (University of York) | \n"
"| | \n"
"| Funded by The Royal Society | royalsociety.org | \n"
"| | \n"
"| Copyright (C) 2018, 2109, M. Andelkovic, L. Covaci, A. Ferreira, | \n"
"| S. M. Joao, J. V. Lopes, T. G. Rappoport | \n"
"| | \n"
"| This program is free software: you can redistribute it and/or modify | \n"
"| it under the terms of the GNU General Public License as published by | \n"
"| the Free Software Foundation, either version 3 of the License, or | \n"
"| (at your option) any later version. | \n"
"| | \n"
"| This program is distributed in the hope that it will be useful, | \n"
"| but WITHOUT ANY WARRANTY; without even the implied warranty of | \n"
"| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | \n"
"| See the GNU General Public License for more details. | \n"
"+------------------------------------------------------------------------+\n";
std::cout << R"ENDSTRING(

+------------------------------------------------------------------------+
| Chebyshev Polynomial Green's Function Approach |
| to Real-Space Quantum Transport Simulations |
| |
| KITE | Release 1.0 |
| Kite home: quantum-kite.com |
| |
| Created by Simao M. Joao, Joao V. Lopes (Universidade do Porto), |
| Tatiana G. Rappoport (Universidade Federal Rio de Janeiro), |
| Misa Andelkovic, Lucian Covaci (University of Antwerp) |
| and Aires Ferreira (University of York) |
| |
| Funded by The Royal Society | royalsociety.org |
| |
| Copyright (C) 2018, 2019, M. Andelkovic, L. Covaci, A. Ferreira, |
| S. M. Joao, J. V. Lopes, T. G. Rappoport |
| |
| This program is free software: you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by |
| the Free Software Foundation, either version 3 of the License, or |
| (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU General Public License for more details. |
+------------------------------------------------------------------------+
)ENDSTRING";
#endif
}

void print_flags_message(){
#if VERBOSE
std::cout <<
"------- FLAGS SET -------\n"
"DEBUG: " << DEBUG <<"\n"
"VERBOSE: " << VERBOSE << "\n"
"-------------------------\n\n";
"------- FLAGS SET -------" << std::endl <<
"DEBUG: " << DEBUG << std::endl <<
"VERBOSE: " << VERBOSE << std::endl <<
"-------------------------" << std::endl <<
"" <<std::endl;
#endif
}

void print_info_message(){
#if VERBOSE
std::cout <<
"\n------------------------------ INFORMATION ------------------------------\n"
"Linear response functions in units of e^2/h. \n"
"To stop these messages, set VERBOSE to 0 in the Makefile. \n"
"To see debug messages, set DEBUG to 1 in the Makefile. \n"
"------------------------------------------------------------------------- \n\n";
std::cout << R"ENDSTRING(

------------------------------ INFORMATION ------------------------------
Linear response functions in units of e^2/h.
To stop these messages, set VERBOSE to 0 in the Makefile.
To see debug messages, set DEBUG to 1 in the Makefile.
-------------------------------------------------------------------------

)ENDSTRING";
#endif
}
Loading