Skip to content

Commit

Permalink
Update pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
juraskov committed Oct 27, 2023
1 parent e0342e7 commit 06d6904
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
24 changes: 19 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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]
8 changes: 6 additions & 2 deletions examples/DA_paper/uphill/generate_rs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 06d6904

Please sign in to comment.