Skip to content

Commit 6ccb78a

Browse files
committed
1. Remove Input_Item::value_read_size and Input_List::check_value_size() temporarily.
1 parent da30ea2 commit 6ccb78a

13 files changed

+72
-15
lines changed

source/src_io/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ add_library(
2424
read_dm.cpp
2525
read_rho.cpp
2626
read_txt_tools.cpp
27+
read_txt_input_value.cpp
28+
read_txt_input_list.cpp
29+
read_txt_input_process.cpp
30+
read_txt_input-general.cpp
31+
read_txt_input-pw.cpp
2732
read_txt_stru.cpp
2833
restart.cpp
2934
rwstream.cpp

source/src_io/read_txt_input-general.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//=======================
2+
// AUTHOR : Peize Lin
3+
// DATE : 2021-12-13
4+
//=======================
5+
16
#include "read_txt_input_list.h"
27

38
#include "src_io/read_txt_tools.h"
@@ -17,7 +22,6 @@ namespace Read_Txt_Input
1722
item.annotation = "1: single spin; 2: up and down spin; 4: noncollinear spin";
1823
item.check_transform = [](Input_Item &self)
1924
{
20-
Input_List::check_value_size(self, 1);
2125
if(!Read_Txt_Tools::in_set(self.values[0].geti(), {1,2,4}))
2226
throw std::invalid_argument("nspin must be 1,2,4");
2327
};
@@ -34,7 +38,6 @@ namespace Read_Txt_Input
3438
item.annotation = "atom species number";
3539
item.check_transform = [](Input_Item &self)
3640
{
37-
Input_List::check_value_size(self, 1);
3841
if(self.values[0].geti()<=0)
3942
throw std::invalid_argument("ntype must > 0");
4043
};
@@ -51,7 +54,6 @@ namespace Read_Txt_Input
5154
item.annotation = "turn symmetry on or off";
5255
item.check_transform = [](Input_Item &self)
5356
{
54-
Input_List::check_value_size(self, 1);
5557
if(!Read_Txt_Tools::in_set( self.values[0].gets(), Read_Txt_Tools::Preset::Bool))
5658
throw std::invalid_argument("symmetry must be bool");
5759
};

source/src_io/read_txt_input-pw.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//=======================
2+
// AUTHOR : Peize Lin
3+
// DATE : 2021-12-13
4+
//=======================
5+
16
#include "read_txt_input_list.h"
27

38
#include "module_base/constants.h"
@@ -16,7 +21,6 @@ namespace Read_Txt_Input
1621
item.annotation = "energy cutoff for wave functions";
1722
item.check_transform = [](Input_Item &self)
1823
{
19-
Input_List::check_value_size(self, 1, 2);
2024
if(self.values[1].gets()=="eV"){}
2125
else if(self.values[1].gets()=="Ry")
2226
self.values[0].setd( self.values[0].getd() / ModuleBase::Ry_to_eV );

source/src_io/read_txt_input_item-template.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//=======================
2+
// AUTHOR : Peize Lin
3+
// DATE : 2021-12-13
4+
//=======================
5+
16
#ifndef READ_TXT_INPUT_ITEM_TEMPLATE_H
27
#define READ_TXT_INPUT_ITEM_TEMPLATE_H
38

source/src_io/read_txt_input_item.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//=======================
2+
// AUTHOR : Peize Lin
3+
// DATE : 2021-12-13
4+
//=======================
5+
16
#ifndef READ_TXT_INPUT_ITEM_H
27
#define READ_TXT_INPUT_ITEM_H
38

@@ -37,7 +42,7 @@ namespace Read_Txt_Input
3742

3843
private:
3944
std::string label;
40-
int value_read_size = -1;
45+
//int value_read_size = -1;
4146

4247
friend class Input_List;
4348
friend class Input_Process;

source/src_io/read_txt_input_list.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
#include "read_txt_input_list.h"
1+
//=======================
2+
// AUTHOR : Peize Lin
3+
// DATE : 2021-12-13
4+
//=======================
25

6+
#include "read_txt_input_list.h"
37

48
namespace Read_Txt_Input
59
{
@@ -9,6 +13,7 @@ namespace Read_Txt_Input
913
add_order.push_back(input_item.label);
1014
}
1115

16+
/*
1217
void Input_List::check_value_size(const Input_Item& input_item, const int size)
1318
{
1419
if(input_item.value_read_size==-1)
@@ -24,6 +29,7 @@ namespace Read_Txt_Input
2429
if(input_item.value_read_size<size_low || input_item.value_read_size>size_up)
2530
throw std::out_of_range(std::to_string(input_item.value_read_size)+std::to_string(size_low)+std::to_string(size_up));
2631
}
32+
*/
2733

2834
void Input_List::set_items()
2935
{

source/src_io/read_txt_input_list.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//=======================
2+
// AUTHOR : Peize Lin
3+
// DATE : 2021-12-13
4+
//=======================
5+
16
#ifndef READ_TXT_INIPUT_LIST_H
27
#define READ_TXT_INIPUT_LIST_H
38

@@ -16,8 +21,8 @@ namespace Read_Txt_Input
1621

1722
private:
1823
void add_item(const Input_Item &input_item);
19-
static void check_value_size(const Input_Item& input_item, const int size);
20-
static void check_value_size(const Input_Item& input_item, const int size_low, const int size_up);
24+
//static void check_value_size(const Input_Item& input_item, const int size);
25+
//static void check_value_size(const Input_Item& input_item, const int size_low, const int size_up);
2126

2227
std::map<std::string, Input_Item> list;
2328
std::vector<std::string> add_order;

source/src_io/read_txt_input_process.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//=======================
2+
// AUTHOR : Peize Lin
3+
// DATE : 2021-12-13
4+
//=======================
5+
16
#include "read_txt_input_process.h"
27

38
#include "src_io/read_txt_tools.h"
@@ -35,11 +40,16 @@ namespace Read_Txt_Input
3540
const auto ptr = input.list.find(input_read.first);
3641
if(ptr==input.list.end())
3742
throw std::out_of_range("input_read.first");
38-
if(input_read.second.size() > ptr->second.values.size())
39-
throw std::out_of_range("size error");
43+
44+
//if(input_read.second.size() > ptr->second.values.size())
45+
if(input_read.second.size() != ptr->second.values.size())
46+
throw std::out_of_range(
47+
"size of INPUT "+ptr->second.label+" needs "+std::to_string(ptr->second.values.size())
48+
+" but reads "+std::to_string(input_read.second.size()));
49+
4050
for(size_t i=0; i<input_read.second.size(); ++i)
4151
ptr->second.values[i].sets(input_read.second[i]);
42-
ptr->second.value_read_size = input_read.second.size();
52+
//ptr->second.value_read_size = input_read.second.size();
4353
}
4454
}
4555

source/src_io/read_txt_input_process.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//=======================
2+
// AUTHOR : Peize Lin
3+
// DATE : 2021-12-13
4+
//=======================
5+
16
#ifndef READ_TXT_INIPUT_PROCESS_H
27
#define READ_TXT_INIPUT_PROCESS_H
38

source/src_io/read_txt_input_value.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//=======================
2+
// AUTHOR : Peize Lin
3+
// DATE : 2021-12-13
4+
//=======================
5+
16
#include "read_txt_input_value.h"
27

38
#include "src_io/read_txt_tools.h"

0 commit comments

Comments
 (0)