Skip to content

Commit 2bf586e

Browse files
Improve speed of quantity stringification (#2090)
* Skip unit conversion when stripping own units * Update release history
1 parent 158117d commit 2bf586e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

docs/releasehistory.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Releases follow the `major.minor.micro` scheme recommended by [PEP440](https://w
1313
### Behavior changes
1414

1515
### Bugfixes
16+
1617
- [PR #2052](https://github.com/openforcefield/openff-toolkit/pull/2052): Fixes bug where `Topology.from_pdb` couldn't load NH4+ ([Issue #2051](https://github.com/openforcefield/openff-toolkit/issues/2051))
1718

1819
### Miscellaneous
@@ -22,7 +23,9 @@ Releases follow the `major.minor.micro` scheme recommended by [PEP440](https://w
2223
- [PR #2078](https://github.com/openforcefield/openff-toolkit/pull/2078): Updates molecule cookbook molecule.from_qcschema()
2324

2425
### New features
26+
2527
- [PR #2066](https://github.com/openforcefield/openff-toolkit/pull/2066): Improves runtime in some situations by making AmberToolsToolkitWrapper perform lazy evaluation of AmberTools version. (@vamironov)
28+
- [PR #2090](https://github.com/openforcefield/openff-toolkit/pull/2090): Improves runtime of force field serialization via faster `Quantity` stringification.
2629

2730

2831
### Improved documentation and warnings

openff/toolkit/utils/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def quantity_to_string(input_quantity: Quantity) -> str:
163163
The serialized quantity
164164
165165
"""
166-
unitless_value: float | int | NDArray | list = input_quantity.m_as(input_quantity.units)
166+
unitless_value: float | int | NDArray | list = input_quantity.m
167167
# The string representation of a numpy array doesn't have commas and breaks the
168168
# parser, thus we convert any arrays to list here
169169
if isinstance(unitless_value, np.ndarray):

0 commit comments

Comments
 (0)