Skip to content

Commit

Permalink
check the number of calls to add_force
Browse files Browse the repository at this point in the history
  • Loading branch information
brucefan1983 committed Jun 27, 2024
1 parent af59204 commit 34d7e27
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/main_gpumd/add_force.cu
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void Add_Force::compute(const int step, const std::vector<Group>& groups, Atom&
const int num_atoms_total = atom.force_per_atom.size() / 3;
const int group_size = groups[grouping_method_[call]].cpu_size[group_id_[call]];
const int group_size_sum = groups[grouping_method_[call]].cpu_size_sum[group_id_[call]];
add_force<<<(atom.number_of_atoms - 1) / 64 + 1, 64>>>(
add_force<<<(group_size - 1) / 64 + 1, 64>>>(
group_size,
group_size_sum,
groups[grouping_method_[call]].contents.data(),
Expand Down Expand Up @@ -154,7 +154,9 @@ void Add_Force::parse(const char** param, int num_param, const std::vector<Group

++num_calls_;

exit(1);
if (num_calls_ > 10) {
PRINT_INPUT_ERROR("add_force cannot be used more than 10 times in one run.");
}
}

void Add_Force::finalize()
Expand Down
2 changes: 1 addition & 1 deletion src/main_gpumd/run.cu
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ void Run::parse_one_keyword(std::vector<std::string>& tokens)
electron_stop.parse(param, num_param, atom.number_of_atoms, number_of_types);
} else if (strcmp(param[0], "add_force") == 0) {
add_force.parse(param, num_param, group);
}else if (strcmp(param[0], "mc") == 0) {
} else if (strcmp(param[0], "mc") == 0) {
mc.parse_mc(param, num_param, group, atom);
} else if (strcmp(param[0], "dftd3") == 0) {
// nothing here; will be handled elsewhere
Expand Down

0 comments on commit 34d7e27

Please sign in to comment.