Release Notes for Version 1.5.1
Version 1.5.1 introduces arithmetic operations for the ChemFormula class, enabling addition, subtraction, and multiplication of chemical formulas. These features enhance the library's capabilities for chemical computations and improve usability with updated documentation, examples, and tests.
New Features
Formula Addition
+Operator: Combine twoChemFormulainstances by summing their element counts and charges. This feature supports operations like adding reaction products or combining formulas.
Formula Subtraction
-Operator: Subtract element counts and charges between twoChemFormulainstances. Includes validation for negative frequencies and empty results.
Formula Multiplication
*Operator: Multiply aChemFormulaby a positive integer, scaling element counts and charges. Supports both left and right multiplication.
Specialized Dictionary Classes
ChemFormulaDict: A dictionary for element frequencies, enforcing non-negative integer values.ChemFormulaDictFloat: A dictionary for element fractions, supporting floats and integers.
Documentation and Examples
- Expanded
README.md: Added detailed sections on formula arithmetic, including examples for addition, subtraction, and multiplication. - New Example Script:
examples/example6.pydemonstrates practical use cases for formula arithmetic.
Testing and Type Safety
- Comprehensive tests for all arithmetic operations, including validation of edge cases and error handling.
- Updated type stubs (
chemformula.pyi) to reflect new features and ensure type safety.
Project Configuration
- Changed CI matrix to include Python 3.14.
- Bump version to
1.5.1.
What's Changed
- Feature/adding formulas by @molshape in #22
- Feature/subtracting formulas by @molshape in #23
- Feature/multiply formulas by @molshape in #24
- Feature/formula arithmetics by @molshape in #25
Full Changelog: v1.5.0...v1.5.1 or CHANGELOG.md