Skip to content

Commit

Permalink
Modified xatu.cpp to allow new formats (HDF5 files)
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandrojuria committed Mar 20, 2024
1 parent 7e70782 commit 168a6ef
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
3 changes: 2 additions & 1 deletion include/xatu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
#include "xatu/SystemConfiguration.hpp"
#include "xatu/utils.hpp"
#include "xatu/forward_declaration.hpp"
#include "xatu/interactions.hpp"
#include "xatu/interactions.hpp"
#include "xatu/HDF5Configuration.hpp"
16 changes: 14 additions & 2 deletions main/xatu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
#include <chrono>
#include <iomanip>
#include <tclap/CmdLine.h>
#include <xatu.hpp>
#include "xatu.hpp"


#ifndef constants
#define PI 3.141592653589793
Expand All @@ -25,6 +26,7 @@ int main(int argc, char* argv[]){
TCLAP::SwitchArg spinArg("s", "spin", "Compute exciton spin and write it to file.", cmd, false);
TCLAP::ValueArg<int> dftArg("d", "dft", "Indicates that the system file is a .outp CRYSTAL file.", false, -1, "No. Fock matrices", cmd);
TCLAP::SwitchArg absorptionArg("a", "absorption", "Computes the absorption spectrum.", cmd, false);
TCLAP::ValueArg<std::string> formatArg("f", "format", "Format of the input system file.", false, "model", "model or hdf5", cmd);

TCLAP::AnyOf outputOptions;
TCLAP::SwitchArg energyArg("e", "energy", "Write energies.", false);
Expand Down Expand Up @@ -52,6 +54,7 @@ int main(int argc, char* argv[]){
int decimals = precisionArg.getValue();
std::string method = methodArg.getValue();
std::vector<int> rsInfo = realspaceArg.getValue();
std::string format = formatArg.getValue();
int holeIndex = 0, ncellsRSWF = 8;
if (rsInfo.size() == 1){
holeIndex = rsInfo[0];
Expand All @@ -76,7 +79,16 @@ int main(int argc, char* argv[]){
systemConfig.reset(new xatu::CRYSTALConfiguration(systemfile, ncells));
}
else{
systemConfig.reset(new xatu::SystemConfiguration(systemfile));
if (format == "hdf5"){
systemConfig.reset(new xatu::HDF5Configuration(systemfile));
triangular = true;
}
else if (format == "model"){
systemConfig.reset(new xatu::SystemConfiguration(systemfile));
}
else{
throw std::invalid_argument("Format not recognized. Use 'model' or 'hdf5'.");
}
}

// If bands flag is present, compute bands and exit.
Expand Down

0 comments on commit 168a6ef

Please sign in to comment.