Skip to content

Commit ae8392c

Browse files
authored
Merge pull request brucefan1983#857 from brucefan1983/read_double_instead_of_float
float to double reading
2 parents 3db1c85 + 12c5d72 commit ae8392c

File tree

9 files changed

+57
-80
lines changed

9 files changed

+57
-80
lines changed

src/force/ilp_nep_gr_hbn.cu

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ ILP_NEP_GR_HBN::ILP_NEP_GR_HBN(FILE* fid_ilp, const char* file_nep, int num_type
196196
"[radial_factor] [angular_factor] [zbl_factor].\n";
197197
exit(1);
198198
}
199-
paramb.rc_radial = get_float_from_token(tokens[1], __FILE__, __LINE__);
200-
paramb.rc_angular = get_float_from_token(tokens[2], __FILE__, __LINE__);
199+
paramb.rc_radial = get_double_from_token(tokens[1], __FILE__, __LINE__);
200+
paramb.rc_angular = get_double_from_token(tokens[2], __FILE__, __LINE__);
201201
printf(" radial cutoff = %g A.\n", paramb.rc_radial);
202202
printf(" angular cutoff = %g A.\n", paramb.rc_angular);
203203

@@ -215,9 +215,9 @@ ILP_NEP_GR_HBN::ILP_NEP_GR_HBN(FILE* fid_ilp, const char* file_nep, int num_type
215215
printf(" enlarged MN_angular = %d.\n", paramb.MN_angular);
216216

217217
if (tokens.size() == 8) {
218-
paramb.typewise_cutoff_radial_factor = get_float_from_token(tokens[5], __FILE__, __LINE__);
219-
paramb.typewise_cutoff_angular_factor = get_float_from_token(tokens[6], __FILE__, __LINE__);
220-
paramb.typewise_cutoff_zbl_factor = get_float_from_token(tokens[7], __FILE__, __LINE__);
218+
paramb.typewise_cutoff_radial_factor = get_double_from_token(tokens[5], __FILE__, __LINE__);
219+
paramb.typewise_cutoff_angular_factor = get_double_from_token(tokens[6], __FILE__, __LINE__);
220+
paramb.typewise_cutoff_zbl_factor = get_double_from_token(tokens[7], __FILE__, __LINE__);
221221
if (paramb.typewise_cutoff_radial_factor > 0.0f) {
222222
paramb.use_typewise_cutoff = true;
223223
}
@@ -324,14 +324,14 @@ ILP_NEP_GR_HBN::ILP_NEP_GR_HBN(FILE* fid_ilp, const char* file_nep, int num_type
324324
std::vector<float> parameters(annmb.num_para);
325325
for (int n = 0; n < annmb.num_para; ++n) {
326326
tokens = get_tokens(input);
327-
parameters[n] = get_float_from_token(tokens[0], __FILE__, __LINE__);
327+
parameters[n] = get_double_from_token(tokens[0], __FILE__, __LINE__);
328328
}
329329
nep_data.parameters.resize(annmb.num_para);
330330
nep_data.parameters.copy_from_host(parameters.data());
331331
update_potential(nep_data.parameters.data(), annmb);
332332
for (int d = 0; d < annmb.dim; ++d) {
333333
tokens = get_tokens(input);
334-
paramb.q_scaler[d] = get_float_from_token(tokens[0], __FILE__, __LINE__);
334+
paramb.q_scaler[d] = get_double_from_token(tokens[0], __FILE__, __LINE__);
335335
}
336336

337337

src/force/nep.cu

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ void NEP::initialize_dftd3()
6060
exit(1);
6161
}
6262
std::string xc_functional = tokens[1];
63-
float rc_potential = get_float_from_token(tokens[2], __FILE__, __LINE__);
64-
float rc_coordination_number = get_float_from_token(tokens[3], __FILE__, __LINE__);
63+
float rc_potential = get_double_from_token(tokens[2], __FILE__, __LINE__);
64+
float rc_coordination_number = get_double_from_token(tokens[3], __FILE__, __LINE__);
6565
dftd3.initialize(xc_functional, rc_potential, rc_coordination_number);
6666
break;
6767
}
@@ -168,8 +168,8 @@ NEP::NEP(const char* file_potential, const int num_atoms)
168168
std::cout << "This line should be zbl rc_inner rc_outer." << std::endl;
169169
exit(1);
170170
}
171-
zbl.rc_inner = get_float_from_token(tokens[1], __FILE__, __LINE__);
172-
zbl.rc_outer = get_float_from_token(tokens[2], __FILE__, __LINE__);
171+
zbl.rc_inner = get_double_from_token(tokens[1], __FILE__, __LINE__);
172+
zbl.rc_outer = get_double_from_token(tokens[2], __FILE__, __LINE__);
173173
if (zbl.rc_inner == 0 && zbl.rc_outer == 0) {
174174
zbl.flexibled = true;
175175
printf(" has the flexible ZBL potential\n");
@@ -188,8 +188,8 @@ NEP::NEP(const char* file_potential, const int num_atoms)
188188
"[radial_factor] [angular_factor] [zbl_factor].\n";
189189
exit(1);
190190
}
191-
paramb.rc_radial = get_float_from_token(tokens[1], __FILE__, __LINE__);
192-
paramb.rc_angular = get_float_from_token(tokens[2], __FILE__, __LINE__);
191+
paramb.rc_radial = get_double_from_token(tokens[1], __FILE__, __LINE__);
192+
paramb.rc_angular = get_double_from_token(tokens[2], __FILE__, __LINE__);
193193
printf(" radial cutoff = %g A.\n", paramb.rc_radial);
194194
printf(" angular cutoff = %g A.\n", paramb.rc_angular);
195195

@@ -207,9 +207,9 @@ NEP::NEP(const char* file_potential, const int num_atoms)
207207
printf(" enlarged MN_angular = %d.\n", paramb.MN_angular);
208208

209209
if (tokens.size() == 8) {
210-
paramb.typewise_cutoff_radial_factor = get_float_from_token(tokens[5], __FILE__, __LINE__);
211-
paramb.typewise_cutoff_angular_factor = get_float_from_token(tokens[6], __FILE__, __LINE__);
212-
paramb.typewise_cutoff_zbl_factor = get_float_from_token(tokens[7], __FILE__, __LINE__);
210+
paramb.typewise_cutoff_radial_factor = get_double_from_token(tokens[5], __FILE__, __LINE__);
211+
paramb.typewise_cutoff_angular_factor = get_double_from_token(tokens[6], __FILE__, __LINE__);
212+
paramb.typewise_cutoff_zbl_factor = get_double_from_token(tokens[7], __FILE__, __LINE__);
213213
if (paramb.typewise_cutoff_radial_factor > 0.0f) {
214214
paramb.use_typewise_cutoff = true;
215215
}
@@ -316,22 +316,22 @@ NEP::NEP(const char* file_potential, const int num_atoms)
316316
std::vector<float> parameters(annmb.num_para);
317317
for (int n = 0; n < annmb.num_para; ++n) {
318318
tokens = get_tokens(input);
319-
parameters[n] = get_float_from_token(tokens[0], __FILE__, __LINE__);
319+
parameters[n] = get_double_from_token(tokens[0], __FILE__, __LINE__);
320320
}
321321
nep_data.parameters.resize(annmb.num_para);
322322
nep_data.parameters.copy_from_host(parameters.data());
323323
update_potential(nep_data.parameters.data(), annmb);
324324
for (int d = 0; d < annmb.dim; ++d) {
325325
tokens = get_tokens(input);
326-
paramb.q_scaler[d] = get_float_from_token(tokens[0], __FILE__, __LINE__);
326+
paramb.q_scaler[d] = get_double_from_token(tokens[0], __FILE__, __LINE__);
327327
}
328328

329329
// flexible zbl potential parameters
330330
if (zbl.flexibled) {
331331
int num_type_zbl = (paramb.num_types * (paramb.num_types + 1)) / 2;
332332
for (int d = 0; d < 10 * num_type_zbl; ++d) {
333333
tokens = get_tokens(input);
334-
zbl.para[d] = get_float_from_token(tokens[0], __FILE__, __LINE__);
334+
zbl.para[d] = get_double_from_token(tokens[0], __FILE__, __LINE__);
335335
}
336336
zbl.num_types = paramb.num_types;
337337
}

src/force/nep_multigpu.cu

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ NEP_MULTIGPU::NEP_MULTIGPU(
170170
std::cout << "This line should be zbl rc_inner rc_outer." << std::endl;
171171
exit(1);
172172
}
173-
zbl.rc_inner = get_float_from_token(tokens[1], __FILE__, __LINE__);
174-
zbl.rc_outer = get_float_from_token(tokens[2], __FILE__, __LINE__);
173+
zbl.rc_inner = get_double_from_token(tokens[1], __FILE__, __LINE__);
174+
zbl.rc_outer = get_double_from_token(tokens[2], __FILE__, __LINE__);
175175
if (zbl.rc_inner == 0 && zbl.rc_outer == 0) {
176176
zbl.flexibled = true;
177177
printf(" has the flexible ZBL potential\n");
@@ -190,8 +190,8 @@ NEP_MULTIGPU::NEP_MULTIGPU(
190190
"[radial_factor] [angular_factor] [zbl_factor].\n";
191191
exit(1);
192192
}
193-
paramb.rc_radial = get_float_from_token(tokens[1], __FILE__, __LINE__);
194-
paramb.rc_angular = get_float_from_token(tokens[2], __FILE__, __LINE__);
193+
paramb.rc_radial = get_double_from_token(tokens[1], __FILE__, __LINE__);
194+
paramb.rc_angular = get_double_from_token(tokens[2], __FILE__, __LINE__);
195195
printf(" radial cutoff = %g A.\n", paramb.rc_radial);
196196
printf(" angular cutoff = %g A.\n", paramb.rc_angular);
197197

@@ -210,9 +210,9 @@ NEP_MULTIGPU::NEP_MULTIGPU(
210210
printf(" enlarged MN_angular = %d.\n", paramb.MN_angular);
211211

212212
if (tokens.size() == 8) {
213-
paramb.typewise_cutoff_radial_factor = get_float_from_token(tokens[5], __FILE__, __LINE__);
214-
paramb.typewise_cutoff_angular_factor = get_float_from_token(tokens[6], __FILE__, __LINE__);
215-
paramb.typewise_cutoff_zbl_factor = get_float_from_token(tokens[7], __FILE__, __LINE__);
213+
paramb.typewise_cutoff_radial_factor = get_double_from_token(tokens[5], __FILE__, __LINE__);
214+
paramb.typewise_cutoff_angular_factor = get_double_from_token(tokens[6], __FILE__, __LINE__);
215+
paramb.typewise_cutoff_zbl_factor = get_double_from_token(tokens[7], __FILE__, __LINE__);
216216
if (paramb.typewise_cutoff_radial_factor > 0.0f) {
217217
paramb.use_typewise_cutoff = true;
218218
}
@@ -320,19 +320,19 @@ NEP_MULTIGPU::NEP_MULTIGPU(
320320
std::vector<float> parameters(annmb[0].num_para);
321321
for (int n = 0; n < annmb[0].num_para; ++n) {
322322
tokens = get_tokens(input);
323-
parameters[n] = get_float_from_token(tokens[0], __FILE__, __LINE__);
323+
parameters[n] = get_double_from_token(tokens[0], __FILE__, __LINE__);
324324
}
325325
for (int d = 0; d < annmb[0].dim; ++d) {
326326
tokens = get_tokens(input);
327-
paramb.q_scaler[d] = get_float_from_token(tokens[0], __FILE__, __LINE__);
327+
paramb.q_scaler[d] = get_double_from_token(tokens[0], __FILE__, __LINE__);
328328
}
329329

330330
// flexible zbl potential parameters
331331
if (zbl.flexibled) {
332332
int num_type_zbl = (paramb.num_types * (paramb.num_types + 1)) / 2;
333333
for (int d = 0; d < 10 * num_type_zbl; ++d) {
334334
tokens = get_tokens(input);
335-
zbl.para[d] = get_float_from_token(tokens[0], __FILE__, __LINE__);
335+
zbl.para[d] = get_double_from_token(tokens[0], __FILE__, __LINE__);
336336
}
337337
zbl.num_types = paramb.num_types;
338338
}

src/main_nep/snes.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,11 @@ void SNES::compute(Parameters& para, Fitness* fitness_function)
260260
}
261261
for (int n = 0; n < number_of_variables; ++n) {
262262
tokens = get_tokens(input);
263-
population[n] = get_float_from_token(tokens[0], __FILE__, __LINE__);
263+
population[n] = get_double_from_token(tokens[0], __FILE__, __LINE__);
264264
}
265265
for (int d = 0; d < para.dim; ++d) {
266266
tokens = get_tokens(input);
267-
para.q_scaler_cpu[d] = get_float_from_token(tokens[0], __FILE__, __LINE__);
267+
para.q_scaler_cpu[d] = get_double_from_token(tokens[0], __FILE__, __LINE__);
268268
}
269269
para.q_scaler_gpu[0].copy_from_host(para.q_scaler_cpu.data());
270270
fitness_function->predict(para, population.data());

src/main_nep/structure.cu

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,18 @@ static void read_force(
109109
}
110110
std::string atom_symbol(tokens[0 + species_offset]);
111111
structure.x[na] =
112-
get_float_from_token(tokens[0 + pos_offset], xyz_filename.c_str(), line_number);
112+
get_double_from_token(tokens[0 + pos_offset], xyz_filename.c_str(), line_number);
113113
structure.y[na] =
114-
get_float_from_token(tokens[1 + pos_offset], xyz_filename.c_str(), line_number);
114+
get_double_from_token(tokens[1 + pos_offset], xyz_filename.c_str(), line_number);
115115
structure.z[na] =
116-
get_float_from_token(tokens[2 + pos_offset], xyz_filename.c_str(), line_number);
116+
get_double_from_token(tokens[2 + pos_offset], xyz_filename.c_str(), line_number);
117117
if (num_columns > 4) {
118118
structure.fx[na] =
119-
get_float_from_token(tokens[0 + force_offset], xyz_filename.c_str(), line_number);
119+
get_double_from_token(tokens[0 + force_offset], xyz_filename.c_str(), line_number);
120120
structure.fy[na] =
121-
get_float_from_token(tokens[1 + force_offset], xyz_filename.c_str(), line_number);
121+
get_double_from_token(tokens[1 + force_offset], xyz_filename.c_str(), line_number);
122122
structure.fz[na] =
123-
get_float_from_token(tokens[2 + force_offset], xyz_filename.c_str(), line_number);
123+
get_double_from_token(tokens[2 + force_offset], xyz_filename.c_str(), line_number);
124124
}
125125

126126
bool is_allowed_element = false;
@@ -160,7 +160,7 @@ static void read_one_structure(
160160
const std::string energy_string = "energy=";
161161
if (token.substr(0, energy_string.length()) == energy_string) {
162162
has_energy_in_exyz = true;
163-
structure.energy = get_float_from_token(
163+
structure.energy = get_double_from_token(
164164
token.substr(energy_string.length(), token.length()), xyz_filename.c_str(), line_number);
165165
structure.energy /= structure.num_atom;
166166
}
@@ -174,7 +174,7 @@ static void read_one_structure(
174174
const std::string temperature_string = "temperature=";
175175
if (token.substr(0, temperature_string.length()) == temperature_string) {
176176
structure.has_temperature = true;
177-
structure.temperature = get_float_from_token(
177+
structure.temperature = get_double_from_token(
178178
token.substr(temperature_string.length(), token.length()),
179179
xyz_filename.c_str(),
180180
line_number);
@@ -191,7 +191,7 @@ static void read_one_structure(
191191
for (const auto& token : tokens) {
192192
const std::string weight_string = "weight=";
193193
if (token.substr(0, weight_string.length()) == weight_string) {
194-
structure.weight = get_float_from_token(
194+
structure.weight = get_double_from_token(
195195
token.substr(weight_string.length(), token.length()), xyz_filename.c_str(), line_number);
196196
if (structure.weight <= 0.0f || structure.weight > 100.0f) {
197197
PRINT_INPUT_ERROR("Configuration weight should > 0 and <= 100.");
@@ -206,7 +206,7 @@ static void read_one_structure(
206206
has_lattice_in_exyz = true;
207207
const int transpose_index[9] = {0, 3, 6, 1, 4, 7, 2, 5, 8};
208208
for (int m = 0; m < 9; ++m) {
209-
structure.box_original[transpose_index[m]] = get_float_from_token(
209+
structure.box_original[transpose_index[m]] = get_double_from_token(
210210
tokens[n + m].substr(
211211
(m == 0) ? (lattice_string.length() + 1) : 0,
212212
(m == 8) ? (tokens[n + m].length() - 1) : tokens[n + m].length()),
@@ -227,7 +227,7 @@ static void read_one_structure(
227227
structure.has_virial = true;
228228
const int reduced_index[9] = {0, 3, 5, 3, 1, 4, 5, 4, 2};
229229
for (int m = 0; m < 9; ++m) {
230-
structure.virial[reduced_index[m]] = get_float_from_token(
230+
structure.virial[reduced_index[m]] = get_double_from_token(
231231
tokens[n + m].substr(
232232
(m == 0) ? (virial_string.length() + 1) : 0,
233233
(m == 8) ? (tokens[n + m].length() - 1) : tokens[n + m].length()),
@@ -247,7 +247,7 @@ static void read_one_structure(
247247
float volume = abs(get_det(structure.box_original));
248248
const int reduced_index[9] = {0, 3, 5, 3, 1, 4, 5, 4, 2};
249249
for (int m = 0; m < 9; ++m) {
250-
virials_from_stress[reduced_index[m]] = get_float_from_token(
250+
virials_from_stress[reduced_index[m]] = get_double_from_token(
251251
tokens[n + m].substr(
252252
(m == 0) ? (stress_string.length() + 1) : 0,
253253
(m == 8) ? (tokens[n + m].length() - 1) : tokens[n + m].length()),
@@ -295,7 +295,7 @@ static void read_one_structure(
295295
structure.virial[m] = 0.0f;
296296
}
297297
for (int m = 0; m < 3; ++m) {
298-
structure.virial[m] = get_float_from_token(
298+
structure.virial[m] = get_double_from_token(
299299
tokens[n + m].substr(
300300
(m == 0) ? (dipole_string.length() + 1) : 0,
301301
(m == 2) ? (tokens[n + m].length() - 1) : tokens[n + m].length()),
@@ -325,7 +325,7 @@ static void read_one_structure(
325325
structure.has_virial = true;
326326
const int reduced_index[9] = {0, 3, 5, 3, 1, 4, 5, 4, 2};
327327
for (int m = 0; m < 9; ++m) {
328-
structure.virial[reduced_index[m]] = get_float_from_token(
328+
structure.virial[reduced_index[m]] = get_double_from_token(
329329
tokens[n + m].substr(
330330
(m == 0) ? (pol_string.length() + 1) : 0,
331331
(m == 8) ? (tokens[n + m].length() - 1) : tokens[n + m].length()),

src/makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
###########################################################
22
# Note:
33
# 1) You can modify -arch=sm_60 according to
4-
# your GPU architecture.
4+
# your GPU architecture. For compute capability < 6.0,
5+
# need to add -DUSE_KEPLER to CFLAGS.
56
# 2) For Windows systems, if you get errors like
67
# c1xx : fatal error C1083: Cannot open source file: ...
78
# You can consider removing -Xcompiler "/wd 4819"

src/mc/nep_energy.cu

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ void NEP_Energy::initialize(const char* file_potential)
111111
std::cout << "This line should be zbl rc_inner rc_outer." << std::endl;
112112
exit(1);
113113
}
114-
zbl.rc_inner = get_float_from_token(tokens[1], __FILE__, __LINE__);
115-
zbl.rc_outer = get_float_from_token(tokens[2], __FILE__, __LINE__);
114+
zbl.rc_inner = get_double_from_token(tokens[1], __FILE__, __LINE__);
115+
zbl.rc_outer = get_double_from_token(tokens[2], __FILE__, __LINE__);
116116
if (zbl.rc_inner == 0 && zbl.rc_outer == 0) {
117117
zbl.flexibled = true;
118118
printf(" has the flexible ZBL potential\n");
@@ -131,8 +131,8 @@ void NEP_Energy::initialize(const char* file_potential)
131131
"[radial_factor] [angular_factor] [zbl_factor].\n";
132132
exit(1);
133133
}
134-
paramb.rc_radial = get_float_from_token(tokens[1], __FILE__, __LINE__);
135-
paramb.rc_angular = get_float_from_token(tokens[2], __FILE__, __LINE__);
134+
paramb.rc_radial = get_double_from_token(tokens[1], __FILE__, __LINE__);
135+
paramb.rc_angular = get_double_from_token(tokens[2], __FILE__, __LINE__);
136136
printf(" radial cutoff = %g A.\n", paramb.rc_radial);
137137
printf(" angular cutoff = %g A.\n", paramb.rc_angular);
138138

@@ -146,9 +146,9 @@ void NEP_Energy::initialize(const char* file_potential)
146146
printf(" enlarged MN_angular = %d.\n", paramb.MN_angular);
147147

148148
if (tokens.size() == 8) {
149-
paramb.typewise_cutoff_radial_factor = get_float_from_token(tokens[5], __FILE__, __LINE__);
150-
paramb.typewise_cutoff_angular_factor = get_float_from_token(tokens[6], __FILE__, __LINE__);
151-
paramb.typewise_cutoff_zbl_factor = get_float_from_token(tokens[7], __FILE__, __LINE__);
149+
paramb.typewise_cutoff_radial_factor = get_double_from_token(tokens[5], __FILE__, __LINE__);
150+
paramb.typewise_cutoff_angular_factor = get_double_from_token(tokens[6], __FILE__, __LINE__);
151+
paramb.typewise_cutoff_zbl_factor = get_double_from_token(tokens[7], __FILE__, __LINE__);
152152
if (paramb.typewise_cutoff_radial_factor > 0.0f) {
153153
paramb.use_typewise_cutoff = true;
154154
}
@@ -242,22 +242,22 @@ void NEP_Energy::initialize(const char* file_potential)
242242
std::vector<float> parameters(annmb.num_para);
243243
for (int n = 0; n < annmb.num_para; ++n) {
244244
tokens = get_tokens(input);
245-
parameters[n] = get_float_from_token(tokens[0], __FILE__, __LINE__);
245+
parameters[n] = get_double_from_token(tokens[0], __FILE__, __LINE__);
246246
}
247247
nep_parameters.resize(annmb.num_para);
248248
nep_parameters.copy_from_host(parameters.data());
249249
update_potential(nep_parameters.data(), annmb);
250250
for (int d = 0; d < annmb.dim; ++d) {
251251
tokens = get_tokens(input);
252-
paramb.q_scaler[d] = get_float_from_token(tokens[0], __FILE__, __LINE__);
252+
paramb.q_scaler[d] = get_double_from_token(tokens[0], __FILE__, __LINE__);
253253
}
254254

255255
// flexible zbl potential parameters
256256
if (zbl.flexibled) {
257257
int num_type_zbl = (paramb.num_types * (paramb.num_types + 1)) / 2;
258258
for (int d = 0; d < 10 * num_type_zbl; ++d) {
259259
tokens = get_tokens(input);
260-
zbl.para[d] = get_float_from_token(tokens[0], __FILE__, __LINE__);
260+
zbl.para[d] = get_double_from_token(tokens[0], __FILE__, __LINE__);
261261
}
262262
zbl.num_types = paramb.num_types;
263263
}

src/utilities/error.cu

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -165,29 +165,6 @@ int get_int_from_token(const std::string& token, const char* filename, const int
165165
return value;
166166
}
167167

168-
float get_float_from_token(const std::string& token, const char* filename, const int line)
169-
{
170-
float value = 0;
171-
try {
172-
value = std::stof(token);
173-
} catch (const std::exception& e) {
174-
std::cout << "Standard exception:\n";
175-
std::cout << " File: " << filename << std::endl;
176-
std::cout << " Line: " << line << std::endl;
177-
std::cout << " Error message: " << e.what() << std::endl;
178-
exit(1);
179-
}
180-
if (std::isinf(value)) {
181-
std::cout << "This number is inf.\n";
182-
exit(1);
183-
}
184-
if (std::isnan(value)) {
185-
std::cout << "This number is nan.\n";
186-
exit(1);
187-
}
188-
return value;
189-
}
190-
191168
double get_double_from_token(const std::string& token, const char* filename, const int line)
192169
{
193170
double value = 0;

src/utilities/error.cuh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,4 @@ std::vector<std::string> get_tokens(const std::string& line);
8282
std::vector<std::string> get_tokens(std::ifstream& input);
8383
std::vector<std::string> get_tokens_without_unwanted_spaces(std::ifstream& input);
8484
int get_int_from_token(const std::string& token, const char* filename, const int line);
85-
float get_float_from_token(const std::string& token, const char* filename, const int line);
8685
double get_double_from_token(const std::string& token, const char* filename, const int line);

0 commit comments

Comments
 (0)