diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0ff7cd29..e1e8b208 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,20 @@ +default_language_version: + # all hooks should run with python 3.6+ + python: python3 repos: - - repo: https://github.com/astral-sh/ruff-pre-commit - # Ruff version. - rev: v0.1.0 - hooks: - - id: ruff + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: no-commit-to-branch + - id: check-executables-have-shebangs + - id: check-shebang-scripts-are-executable + - id: check-added-large-files + args: ['--maxkb=500', '--enforce-all'] + - id: check-yaml + + - repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.1.3 + hooks: + - id: ruff + args: [--show-source, --fix] diff --git a/examples/DA_paper/uphill/generate_rs.py b/examples/DA_paper/uphill/generate_rs.py index ee6cbdcf..2a15ffa6 100644 --- a/examples/DA_paper/uphill/generate_rs.py +++ b/examples/DA_paper/uphill/generate_rs.py @@ -268,6 +268,10 @@ def baised_md(configuration, mlp, temp, dt, interval, bias, **kwargs): rng=RandomState()) traj = ASETrajectory("tmp.traj", 'w', ase_atoms) + energies = [] + + def append_energy(_atoms=ase_atoms): + energies.append(_atoms.get_potential_energy()) if temp > 0: # Default Langevin NVT dyn = Langevin(ase_atoms, dt * ase_units.fs, @@ -285,7 +289,7 @@ def baised_md(configuration, mlp, temp, dt, interval, bias, **kwargs): trajectory = mlt.ConfigurationSet() for i in range(10, len(traj)): trajectory.append(traj[i]) - energies = energies[10:] # noqa: F821 + energies = energies[10:] for i, (frame, energy) in enumerate(zip(trajectory, energies)): frame.update_attr_from(configuration) @@ -314,7 +318,7 @@ def generate_rs(TS, solution, mlp, box_size): for i, species in enumerate(reactants): bias = mlt.Bias(zeta_func=mlt.AverageDistance((1,12), (6,11)), kappa=0.5, reference=ref[i]) traj = baised_md(configuration=species, - mlp=endo, # noqa: F821 + mlp=mlp, temp=300, dt=0.5, interval=20,