@@ -53,70 +53,69 @@ class Grid
5353
5454 // Constructors and destructor
5555 // Grid is Global class,so init it with constant number
56- Grid ():test_grid(0 ){};
57- Grid (const int &test_grid_in);
58- virtual ~Grid ();
59-
60- void init (
61- std::ofstream &ofs,
62- const UnitCell &ucell,
63- const Atom_input &input);
64-
65- // 2015-05-07
66- void delete_vector (const Atom_input &input);
67-
68-
69- // Static data
70- static const double TOLERATE_ERROR;
71- static const std::hash<int > INT_HASHER;
72- static const char * const ERROR[3 ];
73-
74- // Data
75- int natom;// Total atoms.
76- bool pbc; // periodic boundary condition
77- bool expand_flag;
78- double sradius;// searching radius
79- double d_minX;// origin of all cells
80- double d_minY;
81- double d_minZ;
82- int dx;
83- int dy;
84- int dz;
85- int layer;
86- double cell_x_length;
87- double cell_y_length;
88- double cell_z_length;
89- CellSet ***Cell; // dx , dy ,dz is cell number in each direction,respectly.
90- void delete_Cell () // it will replace by container soon!
91- {
92- if (this ->init_cell_flag )
93- {
94- for (int i = 0 ;i < this ->dx ;i++)
95- {
96- for (int j = 0 ;j < this ->dy ;j++)
97- {
98- delete[] this ->Cell [i][j];
99- }
100- }
101-
102- for (int i = 0 ;i < this ->dx ;i++)
103- {
104- delete[] this ->Cell [i];
105- }
106-
107- delete[] this ->Cell ;
108- this ->init_cell_flag = false ;
109- }
110- }
111-
112- double grid_length[3 ];
113- double vec1[3 ];
114- double vec2[3 ];
115- double vec3[3 ];
116- double lat_now;
117- bool init_cell_flag;
118- // LiuXh add 2019-07-15
119- const double & getD_minX (void ) const {return d_minX;}
56+ Grid () : test_grid(0 ) {};
57+ Grid (const int & test_grid_in);
58+ virtual ~Grid ();
59+
60+ void init (std::ofstream& ofs, const UnitCell& ucell, const Atom_input& input);
61+
62+ // 2015-05-07
63+ void delete_vector (const Atom_input& input);
64+
65+ // Static data
66+ static const double TOLERATE_ERROR;
67+ static const std::hash<int > INT_HASHER;
68+ static const char * const ERROR[3 ];
69+
70+ // Data
71+ int natom; // Total atoms.
72+ bool pbc; // periodic boundary condition
73+ bool expand_flag;
74+ double sradius; // searching radius
75+ double d_minX; // origin of all cells
76+ double d_minY;
77+ double d_minZ;
78+ int dx;
79+ int dy;
80+ int dz;
81+ int layer;
82+ double cell_x_length;
83+ double cell_y_length;
84+ double cell_z_length;
85+ CellSet*** Cell; // dx , dy ,dz is cell number in each direction,respectly.
86+ void delete_Cell () // it will replace by container soon!
87+ {
88+ if (this ->init_cell_flag )
89+ {
90+ for (int i = 0 ; i < this ->dx ; i++)
91+ {
92+ for (int j = 0 ; j < this ->dy ; j++)
93+ {
94+ delete[] this ->Cell [i][j];
95+ }
96+ }
97+
98+ for (int i = 0 ; i < this ->dx ; i++)
99+ {
100+ delete[] this ->Cell [i];
101+ }
102+
103+ delete[] this ->Cell ;
104+ this ->init_cell_flag = false ;
105+ }
106+ }
107+
108+ double grid_length[3 ];
109+ double vec1[3 ];
110+ double vec2[3 ];
111+ double vec3[3 ];
112+ double lat_now;
113+ bool init_cell_flag = false ;
114+ // LiuXh add 2019-07-15
115+ const double & getD_minX (void ) const
116+ {
117+ return d_minX;
118+ }
120119 const double & getD_minY (void ) const {return d_minY;}
121120 const double & getD_minZ (void ) const {return d_minZ;}
122121
@@ -128,38 +127,31 @@ class Grid
128127protected:
129128 AtomLink* getHashCode (const UnitCell &ucell, const FAtom &atom)const ; // Peize Lin delete const 2018-07-14
130129// AtomLink* const getHashCode(const FAtom &atom)const;
131- AtomLink* atomlink;
132- AtomLink* cordon_p;// Warning! A guard! Don't delete it!
133-
134- private:
135-
136- const int test_grid;
137- // ==========================================================
138- // MEMBER FUNCTIONS :
139- // Three Main Steps:
140- // NAME : setMemberVariables (read in datas from Atom_input,
141- // init cells.)
142- // NAME : setAtomLinkArray( set the AtomLinkArray twice,
143- // first use Build_Hash,second use Fold_Hash)
144- // NAME : setBoundaryAdjacent( Consider different situations,
145- // if not_expand case : nature/periodic boundary
146- // condition , if expand_case)
147- // ==========================================================
148- void setMemberVariables (
149- std::ofstream &ofs_in,
150- const Atom_input &input);
151-
152- void setAtomLinkArray (
153- const UnitCell &ucell,
154- const Atom_input &input);
155-
156- void setBoundaryAdjacent (
157- std::ofstream &ofs_in,
158- const Atom_input &input);
159-
160- // ==========================================================
161- //
162- // ==========================================================
130+ AtomLink* atomlink = nullptr ;
131+ AtomLink* cordon_p = nullptr ; // Warning! A guard! Don't delete it!
132+
133+ private:
134+ const int test_grid;
135+ // ==========================================================
136+ // MEMBER FUNCTIONS :
137+ // Three Main Steps:
138+ // NAME : setMemberVariables (read in datas from Atom_input,
139+ // init cells.)
140+ // NAME : setAtomLinkArray( set the AtomLinkArray twice,
141+ // first use Build_Hash,second use Fold_Hash)
142+ // NAME : setBoundaryAdjacent( Consider different situations,
143+ // if not_expand case : nature/periodic boundary
144+ // condition , if expand_case)
145+ // ==========================================================
146+ void setMemberVariables (std::ofstream& ofs_in, const Atom_input& input);
147+
148+ void setAtomLinkArray (const UnitCell& ucell, const Atom_input& input);
149+
150+ void setBoundaryAdjacent (std::ofstream& ofs_in, const Atom_input& input);
151+
152+ // ==========================================================
153+ //
154+ // ==========================================================
163155 AtomLink* Build_Cache (const UnitCell &ucell, const Atom_input &input);
164156 // Peize Lin delete const and throw(std::out_of_range, std::logic_error) 2018-07-14
165157
0 commit comments