Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lmp: improve error message when compute/fix is not found #3801

Merged
merged 3 commits into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions source/lmp/pair_deepmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@
int icompute = modify->find_compute(compute_fparam_id);
Compute *compute = modify->compute[icompute];

assert(compute);
if (!compute) {
error->all(FLERR, "compute id is not found: " + compute_fparam_id);

Check warning on line 223 in source/lmp/pair_deepmd.cpp

View check run for this annotation

Codecov / codecov/patch

source/lmp/pair_deepmd.cpp#L223

Added line #L223 was not covered by tests
}
fparam.resize(dim_fparam);

if (dim_fparam == 1) {
Expand All @@ -246,7 +248,9 @@
int icompute = modify->find_compute(compute_aparam_id);
Compute *compute = modify->compute[icompute];

assert(compute);
if (!compute) {
error->all(FLERR, "compute id is not found: " + compute_aparam_id);

Check warning on line 252 in source/lmp/pair_deepmd.cpp

View check run for this annotation

Codecov / codecov/patch

source/lmp/pair_deepmd.cpp#L252

Added line #L252 was not covered by tests
}
int nlocal = atom->nlocal;
aparam.resize(static_cast<size_t>(dim_aparam) * nlocal);

Expand Down Expand Up @@ -277,7 +281,9 @@
ttm_fix = dynamic_cast<FixTTMDP *>(modify->fix[ii]);
}
}
assert(ttm_fix);
if (!ttm_fix) {
error->all(FLERR, "fix ttm id is not found: " + ttm_fix_id);

Check warning on line 285 in source/lmp/pair_deepmd.cpp

View check run for this annotation

Codecov / codecov/patch

source/lmp/pair_deepmd.cpp#L285

Added line #L285 was not covered by tests
}

fparam.resize(dim_fparam);

Expand Down Expand Up @@ -316,7 +322,9 @@
ttm_fix = dynamic_cast<FixTTMDP *>(modify->fix[ii]);
}
}
assert(ttm_fix);
if (!ttm_fix) {
error->all(FLERR, "fix ttm id is not found: " + ttm_fix_id);

Check warning on line 326 in source/lmp/pair_deepmd.cpp

View check run for this annotation

Codecov / codecov/patch

source/lmp/pair_deepmd.cpp#L326

Added line #L326 was not covered by tests
}
// modify
double **x = atom->x;
int *mask = atom->mask;
Expand Down