ALPSCore / CT-HYB

ALPS Hybridization Expansion Matrix Code
GNU General Public License v2.0
16 stars 13 forks source link

Problem with std::string parameter input #16

Closed dombrno closed 6 years ago

dombrno commented 6 years ago

Good evening, I am trying to run a calculation using the latest versions on the master branch of AlpsCore and Alpcore/CT-Hyb, and I guess an error, which seems to have to do with the parameters type. An excerpt from my input.ini file is as follows:

on=0

[measurement.two_time_G2]
on=0
n_legendre=50

[measurement.equal_time_G2]
on=0

[measurement.nn_corr]
on=1
n_tau=3
n_def=10
def="nn_def.txt" 

When executing hybmat, I get the following error:

We cannot open nn_def.txt (type: std::string) (name='measurement.nn_corr.def')!

thrown at line 423 of impurity_init.ipp. The cause of the error is that the value of par[fname_key] is actually the string "nn_def.txt (type: std::string) (name='measurement.nn_corr.def')" instead of the string "nn_def.txt". I guess this is coming from ALPSCore, but I am not that experienced with the inner workings of the parameters type in order to identify the root cause.

Thanks!

I guess

dombrno commented 6 years ago

A fix is actually to replace

 std::ifstream infile_f(boost::lexical_cast<std::string>(par[fname_key]).c_str());

by

std::ifstream infile_f(boost::lexical_cast<std::string>(par[fname_key].template as<std::string>()))

I will submit a pull request, that will be a first :)

egull commented 6 years ago

Thank you! Alex, once the pull request is in, could you please have a look and merge?

dombrno commented 6 years ago

My pleasure - any help I can provide! It might take me a bit of time, my fork has been lagging for a while, I need to fetch upstream etc, but I am interested in the experience of creating the pull request, so please give me maybe a day or so.