modernize

This commit is contained in:
Axel Kohlmeyer
2023-10-27 00:20:05 -04:00
parent 717e1d4319
commit b9283cfcf6
5 changed files with 34 additions and 19 deletions

24
purge-workflows.py Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env python3
from yaml import load
import subprocess
try:
from yaml import CLoader as Loader
except ImportError:
from yaml import Loader
runs = subprocess.check_output('gh api repos/lammps/lammps/actions/runs',shell=True)
data = load(runs,Loader=Loader)
while data['total_count'] > 3:
print('remaining: ', data['total_count'])
num=1
for d in data['workflow_runs']:
print(num, d['id'],d['name'],d['run_number'])
num += 1
if num > 4:
subprocess.call('gh api -X DELETE repos/lammps/lammps/actions/runs/' + str(d['id']), shell=True)
#print('gh api -X DELETE repos/lammps/lammps/actions/runs/' + str(d['id']))
else:
print('skip')
runs = subprocess.check_output('gh api repos/lammps/lammps/actions/runs',shell=True)
data = load(runs,Loader=Loader)

View File

@ -195,7 +195,7 @@ void FixDtReset::end_of_step()
update->dt_default = 0; update->dt_default = 0;
if (respaflag) update->integrate->reset_dt(); if (respaflag) update->integrate->reset_dt();
if (force->pair) force->pair->reset_dt(); if (force->pair) force->pair->reset_dt();
for (int i = 0; i < modify->nfix; i++) modify->fix[i]->reset_dt(); for (auto &ifix : modify->get_fix_list()) ifix->reset_dt();
output->reset_dt(); output->reset_dt();
} }

View File

@ -71,12 +71,9 @@ void FixNVELimit::init()
// warn if using fix shake, which will lead to invalid constraint forces // warn if using fix shake, which will lead to invalid constraint forces
for (int i = 0; i < modify->nfix; i++) if ((comm->me == 0) && ((modify->get_fix_by_style("^shake").size() > 0) ||
if (utils::strmatch(modify->fix[i]->style,"^shake") (modify->get_fix_by_style("^rattle").size() > 0)))
|| utils::strmatch(modify->fix[i]->style,"^rattle")) {
if (comm->me == 0)
error->warning(FLERR,"Should not use fix nve/limit with fix shake or fix rattle"); error->warning(FLERR,"Should not use fix nve/limit with fix shake or fix rattle");
}
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -143,7 +143,6 @@ pairclass(nullptr), pairnames(nullptr), pairmasks(nullptr)
cutneighghostsq = nullptr; cutneighghostsq = nullptr;
cuttype = nullptr; cuttype = nullptr;
cuttypesq = nullptr; cuttypesq = nullptr;
fixchecklist = nullptr;
// pairwise neighbor lists and associated data structs // pairwise neighbor lists and associated data structs
@ -242,7 +241,6 @@ Neighbor::~Neighbor()
memory->destroy(cutneighghostsq); memory->destroy(cutneighghostsq);
delete[] cuttype; delete[] cuttype;
delete[] cuttypesq; delete[] cuttypesq;
delete[] fixchecklist;
for (int i = 0; i < nlist; i++) delete lists[i]; for (int i = 0; i < nlist; i++) delete lists[i];
for (int i = 0; i < nbin; i++) delete neigh_bin[i]; for (int i = 0; i < nbin; i++) delete neigh_bin[i];
@ -497,19 +495,15 @@ void Neighbor::init()
if (cut_respa[0]-skin < 0) cut_middle_inside_sq = 0.0; if (cut_respa[0]-skin < 0) cut_middle_inside_sq = 0.0;
} }
// fixchecklist = other classes that can induce reneighboring in decide()
restart_check = 0; restart_check = 0;
if (output->restart_flag) restart_check = 1; if (output->restart_flag) restart_check = 1;
delete[] fixchecklist; // fixchecklist = other classes that can induce reneighboring in decide()
fixchecklist = nullptr;
fixchecklist = new int[modify->nfix];
fixchecklist.clear();
fix_check = 0; fix_check = 0;
for (i = 0; i < modify->nfix; i++) for (auto &ifix : modify->get_fix_list())
if (modify->fix[i]->force_reneighbor) if (ifix->force_reneighbor) fixchecklist.push_back(ifix);
fixchecklist[fix_check++] = i;
must_check = 0; must_check = 0;
if (restart_check || fix_check) must_check = 1; if (restart_check || fix_check) must_check = 1;
@ -2298,8 +2292,8 @@ int Neighbor::decide()
if (must_check) { if (must_check) {
bigint n = update->ntimestep; bigint n = update->ntimestep;
if (restart_check && n == output->next_restart) return 1; if (restart_check && n == output->next_restart) return 1;
for (int i = 0; i < fix_check; i++) for (auto &ifix : fixchecklist)
if (n == modify->fix[fixchecklist[i]]->next_reneighbor) return 1; if (n == ifix->next_reneighbor) return 1;
} }
ago++; ago++;

View File

@ -187,7 +187,7 @@ class Neighbor : protected Pointers {
int must_check; // 1 if must check other classes to reneigh int must_check; // 1 if must check other classes to reneigh
int restart_check; // 1 if restart enabled, 0 if no int restart_check; // 1 if restart enabled, 0 if no
int fix_check; // # of fixes that induce reneigh int fix_check; // # of fixes that induce reneigh
int *fixchecklist; // which fixes to check std::vector<Fix *>fixchecklist; // which fixes to check
double triggersq; // trigger = build when atom moves this dist double triggersq; // trigger = build when atom moves this dist