13__global__
void Initialize_DNN_Positions(
Atoms* d_a,
Atoms New,
Atoms Old,
size_t Oldsize,
size_t Newsize,
size_t SelectedComponent,
size_t Location,
size_t chainsize,
int MoveType,
size_t CYCLE)
16 if(MoveType == TRANSLATION || MoveType == ROTATION || MoveType == SINGLE_INSERTION || MoveType == SINGLE_DELETION)
19 for(
size_t i = Oldsize; i < Oldsize + Newsize; i++)
21 Old.pos[i] = New.pos[i - Oldsize];
22 Old.scale[i] = New.scale[i - Oldsize];
23 Old.charge[i] = New.charge[i - Oldsize];
24 Old.scaleCoul[i] = New.scaleCoul[i - Oldsize];
27 else if(MoveType == INSERTION || MoveType == CBCF_INSERTION)
32 Old.pos[0] = New.pos[Location];
33 Old.scale[0] = New.scale[Location];
34 Old.charge[0] = New.charge[Location];
35 Old.scaleCoul[0] = New.scaleCoul[Location];
37 for(
size_t i = 0; i < chainsize; i++)
39 Old.pos[i + 1] = New.pos[Location * chainsize + i];
40 Old.scale[i + 1] = New.scale[Location * chainsize + i];
41 Old.charge[i + 1] = New.charge[Location * chainsize + i];
42 Old.scaleCoul[i + 1] = New.scaleCoul[Location * chainsize + i];
45 else if(MoveType == DELETION || MoveType == CBCF_DELETION)
47 for(
size_t i = 0; i < Oldsize; i++)
50 Old.pos[i] = d_a[SelectedComponent].pos[Location + i];
51 Old.scale[i] = d_a[SelectedComponent].scale[Location + i];
52 Old.charge[i] = d_a[SelectedComponent].charge[Location + i];
53 Old.scaleCoul[i] = d_a[SelectedComponent].scaleCoul[Location + i];
65void Prepare_DNN_InitialPositions(
Atoms*& d_a,
Atoms& New,
Atoms& Old,
Components& SystemComponents,
size_t SelectedComponent,
int MoveType,
size_t Location)
67 size_t Oldsize = 0;
size_t Newsize = 0;
size_t chainsize = 0;
70 case TRANSLATION:
case ROTATION:
72 Oldsize = SystemComponents.Moleculesize[SelectedComponent];
73 Newsize = SystemComponents.Moleculesize[SelectedComponent];
74 chainsize = SystemComponents.Moleculesize[SelectedComponent];
77 case INSERTION:
case SINGLE_INSERTION:
80 Newsize = SystemComponents.Moleculesize[SelectedComponent];
81 chainsize = SystemComponents.Moleculesize[SelectedComponent] - 1;
84 case DELETION:
case SINGLE_DELETION:
86 Oldsize = SystemComponents.Moleculesize[SelectedComponent];
88 chainsize = SystemComponents.Moleculesize[SelectedComponent] - 1;
93 throw std::runtime_error(
"Use the Special Function for Reinsertion");
98 throw std::runtime_error(
"Use the Special Function for IDENTITY SWAP!");
100 case CBCF_LAMBDACHANGE:
102 throw std::runtime_error(
"Use the Special Function for CBCF Lambda Change");
111 Newsize = SystemComponents.Moleculesize[SelectedComponent];
112 chainsize = SystemComponents.Moleculesize[SelectedComponent] - 1;
117 Oldsize = SystemComponents.Moleculesize[SelectedComponent];
119 chainsize = SystemComponents.Moleculesize[SelectedComponent] - 1;
123 Initialize_DNN_Positions<<<1,1>>>(d_a, New, Old, Oldsize, Newsize, SelectedComponent, Location, chainsize, MoveType, SystemComponents.CURRENTCYCLE);
126__global__
void Initialize_DNN_Positions_Reinsertion(double3* temp,
Atoms* d_a,
Atoms Old,
size_t Oldsize,
size_t Newsize,
size_t realpos,
size_t SelectedComponent)
128 for(
size_t i = 0; i < Oldsize; i++)
130 Old.pos[i] = d_a[SelectedComponent].pos[realpos + i];
131 Old.scale[i] = d_a[SelectedComponent].scale[realpos + i];
132 Old.charge[i] = d_a[SelectedComponent].charge[realpos + i];
133 Old.scaleCoul[i] = d_a[SelectedComponent].scaleCoul[realpos + i];
136 for(
size_t i = Oldsize; i < Oldsize + Newsize; i++)
138 Old.pos[i] = temp[i - Oldsize];
139 Old.scale[i] = d_a[SelectedComponent].scale[realpos + i - Oldsize];
140 Old.charge[i] = d_a[SelectedComponent].charge[realpos + i - Oldsize];
141 Old.scaleCoul[i] = d_a[SelectedComponent].scaleCoul[realpos + i - Oldsize];
145void Prepare_DNN_InitialPositions_Reinsertion(
Atoms*& d_a,
Atoms& Old, double3* temp,
Components& SystemComponents,
size_t SelectedComponent,
size_t Location)
147 size_t numberOfAtoms = SystemComponents.Moleculesize[SelectedComponent];
148 size_t Oldsize = 0;
size_t Newsize = numberOfAtoms;
150 Oldsize = SystemComponents.Moleculesize[SelectedComponent];
151 numberOfAtoms += Oldsize;
152 Initialize_DNN_Positions_Reinsertion<<<1,1>>>(temp, d_a, Old, Oldsize, Newsize, Location, SelectedComponent);
156double DNN_Prediction_Move(
Components& SystemComponents,
Simulations& Sims,
size_t SelectedComponent,
int MoveType)
162 double DNN_New = 0.0;
169 double DNN_New = 0.0;
174 case TRANSLATION:
case ROTATION:
case SINGLE_INSERTION:
case SINGLE_DELETION:
176 bool Do_New =
true;
bool Do_Old =
true;
177 if(MoveType == SINGLE_INSERTION) Do_Old =
false;
178 if(MoveType == SINGLE_DELETION) Do_New =
false;
179 double DNN_New = 0.0;
double DNN_Old = 0.0;
182 return DNN_New - DNN_Old;
187double DNN_Prediction_Reinsertion(
Components& SystemComponents,
Simulations& Sims,
size_t SelectedComponent, double3* temp)
189 double DNN_New = 0.0;
double DNN_Old = 0.0;
192 return DNN_New - DNN_Old;
206 std::ofstream textrestartFile{};
207 std::string dirname=
"DNN/";
208 std::string TRname = dirname +
"/" +
"Outliers_SINGLE_PARTICLE.data";
209 std::string Ifname = dirname +
"/" +
"Outliers_INSERTION.data";
210 std::string Dfname = dirname +
"/" +
"Outliers_DELETION.data";
213 std::filesystem::path cwd = std::filesystem::current_path();
215 std::filesystem::path directoryName = cwd /dirname;
216 std::filesystem::path IfileName = cwd /Ifname;
217 std::filesystem::path DfileName = cwd /Dfname;
218 std::filesystem::path TRfileName = cwd /TRname;
219 std::filesystem::create_directories(directoryName);
221 size_t size = SystemComponents.HostSystem[1].Molsize;
229 SystemComponents.Copy_GPU_Data_To_Temp(Sim.Old, start, size);
230 Move =
"TRANSLATION_ROTATION_NEW_NON_CBMC_INSERTION";
231 textrestartFile = std::ofstream(TRfileName, std::ios::app);
236 SystemComponents.Copy_GPU_Data_To_Temp(Sim.New, start, size);
237 Move =
"TRANSLATION_ROTATION_OLD_NON_CBMC_DELETION";
238 textrestartFile = std::ofstream(TRfileName, std::ios::app);
241 case REINSERTION_OLD:
243 SystemComponents.Copy_GPU_Data_To_Temp(Sim.Old, start, size);
244 Move =
"REINSERTION_OLD";
245 textrestartFile = std::ofstream(TRfileName, std::ios::app);
248 case REINSERTION_NEW:
250 start = SystemComponents.Moleculesize[ads_comp];
251 SystemComponents.Copy_GPU_Data_To_Temp(Sim.Old, start, size);
252 Move =
"REINSERTION_NEW";
253 textrestartFile = std::ofstream(TRfileName, std::ios::app);
258 SystemComponents.Copy_GPU_Data_To_Temp(Sim.Old, start, size);
259 Move =
"SWAP_INSERTION";
260 textrestartFile = std::ofstream(IfileName, std::ios::app);
265 SystemComponents.Copy_GPU_Data_To_Temp(Sim.Old, start, size);
266 Move =
"SWAP_DELETION";
267 textrestartFile = std::ofstream(DfileName, std::ios::app);
271 for(
size_t i = 0; i < size; i++)
272 textrestartFile << SystemComponents.TempSystem.pos[i].x <<
" " << SystemComponents.TempSystem.pos[i].y <<
" " << SystemComponents.TempSystem.pos[i].z <<
" " << SystemComponents.TempSystem.Type[i] <<
" " << Move <<
" " << E.DNN_E <<
" " << Correction <<
'\n';
273 textrestartFile.close();
Definition data_struct.h:746
Definition data_struct.h:843
Definition data_struct.h:615
Definition data_struct.h:1027