Skip to content

Refactor script discretization/discrete_pos.py; Fix function mdtools.check.bins; Fix function mdtools.structure.discrete_pos_trj#167

Merged
andthum merged 11 commits intomainfrom
ref/scripts/discretization/discrete_pos
Jun 15, 2023
Merged

Refactor script discretization/discrete_pos.py; Fix function mdtools.check.bins; Fix function mdtools.structure.discrete_pos_trj#167
andthum merged 11 commits intomainfrom
ref/scripts/discretization/discrete_pos

Conversation

@andthum
Copy link
Owner

@andthum andthum commented Jun 15, 2023

Refactor script discretization/discrete_pos.py; Fix function mdtools.check.bins; Fix function mdtools.structure.discrete_pos_trj

Type of change

  • Change of core package.
  • Change of scripts.
  • Bug fix.
  • New feature.
  • Code refactoring.
  • Dependency update.
  • Documentation update.
  • Maintenance.
  • Other: Description.
  • Non-breaking (backward-compatible) change.
  • Breaking (non-backward-compatible) change.

Proposed changes

Bug Fixes:

  • Fix the function mdtools.structure.discrete_pos_trj by setting the bin edges to the return value of the function mdtools.check.bin_edges. Before, the bin edges were checked but not changed if they were erroneous.
  • Fix a bug in the function mdtools.check.bins that was introduced in commit f69d2fc (Pull Request New script subvolume_charge.py #119). In this commit an if condition was changed such that although the variable step might be None it is compared to an integer which raises a TypeError.

New Features:

  • Script discretization/discrete_pos.py: Add new command-line option --tol with which the user can specify the tolerance value that is added to the box length to account for the right-open bin interval of the last bin.
  • Function mdtools.file_handler.save_dtrj: Add a new argument rename. If set to True and a file with the given file name already exists, rename it to fname.bak_timestamp to back it up.

PR checklist

  • I followed the guidelines in the Developer's guide.
  • New/changed code is properly tested.
  • New/changed code is properly documented.
  • The CI workflow is passing.

andthum added 11 commits June 15, 2023 13:37
Add a new command-line option `--tol` with which the user can specify
the tolerance value added to the box length `lbox` to account for the
right-open bin interval of the last bin.
Add `discrete_pos.py` to the list of files whose format is checked by
black.
Fix a bug in the function `mdtools.check.bins` that was introduced in
commit f69d2fc (Pull Request 119
#119).  There an if condition was
changed such that although the variable `step` might be `None` it is
compared to an integer which raises a `TypeError`.
Fix the function `mdtools.structure.discrete_pos_trj` by settings the
bin edges to the return value of the function `mdtools.check.bin_edges`.
Before, the bin edges were checked but nor changed if they were
erroneous.
Add a new argument `rename` to the function
`mdtools.file_handler.save_dtrj`.  If set to `True` and a file with the
given file name already exists, rename it to `fname.bak_timestamp` to
back it up.
@github-actions github-actions bot added breaking Breaking changes bugfix Pull requests that fix a bug enhancement New feature or request major-core Breaking change in the core package major-scripts Breaking change in one ore more scripts refactoring Code refactoring labels Jun 15, 2023
@andthum andthum merged commit cf75313 into main Jun 15, 2023
@andthum andthum deleted the ref/scripts/discretization/discrete_pos branch June 15, 2023 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaking changes bugfix Pull requests that fix a bug enhancement New feature or request major-core Breaking change in the core package major-scripts Breaking change in one ore more scripts refactoring Code refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant