Skip to content

Fix various issues and enhance molecule constructor functionality#133

Open
lmseidler wants to merge 14 commits intomainfrom
mol
Open

Fix various issues and enhance molecule constructor functionality#133
lmseidler wants to merge 14 commits intomainfrom
mol

Conversation

@lmseidler
Copy link
Copy Markdown
Member

This pull request introduces substantial improvements to the handling of molecular geometry and data structures, with a strong emphasis on type safety, extensibility, and backwards compatibility. The changes refactor the way geometries and molecules are represented and instantiated, add new utility methods for conversion between formats, and enhance documentation for clarity. Additionally, there are improvements to parallel job assignment logic and the addition of a periodic table mapping. Below are the most important changes grouped by theme.

Geometry and Molecule Data Refactoring

  • Refactored GeometryData and MoleculeData to use explicit types (Atom, tuples for coordinates) and added constructors (from_xyz, from_mol) for safer and more flexible instantiation from xyz lines or atomic numbers and coordinates. Deprecated old list-of-strings interfaces with warnings for backwards compatibility. [1] [2] [3]
  • Updated geometry conversion methods (toorca, toxyz, tocoord, etc.) to provide clearer documentation and ensure proper handling of coordinate formats and units. Added new methods for updating geometry from files and deprecated old ones with warnings. [1] [2] [3]
  • Improved docstrings and type annotations throughout molecule and geometry classes to clarify the meaning and usage of attributes and methods, making the codebase more maintainable and accessible. [1] [2] [3]

Type Safety and Backwards Compatibility

  • Changed Atom.xyz from a list[float] to a tuple[float, float, float] for better type safety and consistency. Added casting and validation logic to ensure correct parsing of input lines.
  • Deprecated legacy interfaces for geometry and molecule instantiation, providing warnings to guide users toward new constructors. [1] [2] [3] [4]

Utility and Infrastructure

  • Added a periodic table mapping (PSE) to params.py for converting atomic numbers to element symbols, supporting new geometry constructors and improving code clarity.
  • Improved parallel job assignment logic in set_omp to handle edge cases more robustly, minimizing idle cores and ensuring efficient resource allocation. [1] [2]

Minor Enhancements

  • Updated file import statements and warnings usage to support new features and maintain compatibility.
  • Changed the way conformers are set up in ensemble.py to use the new MoleculeData.from_xyz constructor, aligning with the refactored data model.

Copilot AI review requested due to automatic review settings March 5, 2026 10:02
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors CENSO’s molecule/geometry data model toward typed atom/coordinate structures with new constructors and file-update helpers, while also improving parallel OpenMP balancing and adding a periodic table mapping to support the new constructors.

Changes:

  • Refactor GeometryData/MoleculeData to use Atom objects and typed coordinate tuples; add from_xyz/from_mol constructors and deprecate legacy string-list inputs.
  • Replace legacy geometry update methods (fromxyz/fromcoord) with update_from_xyz_file/update_from_coord_file (keeping deprecated wrappers) and update processors to use the new APIs.
  • Improve load-balancing logic in set_omp and add a PSE atomic-number→symbol mapping in params.py.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
test/unit/test_parallel.py Updates unit tests to use MoleculeData.from_xyz after constructor refactor.
src/censo/processing/tm_processor.py Switches to update_from_coord_file for reading optimized geometries.
src/censo/processing/qm_processor.py Makes QmProc explicitly abstract via ABCMeta.
src/censo/processing/processor.py Makes GenericProc an ABC so abstract methods are enforced.
src/censo/processing/orca_processor.py Switches to update_from_xyz_file/update_from_coord_file for geometry updates.
src/censo/processing/job.py Modernizes type annotation for mo_guess using `
src/censo/params.py Adds PSE mapping (atomic number → element symbol).
src/censo/parallel.py Refines set_omp balancing logic to reduce idle cores and handle edge cases.
src/censo/molecules.py Major data model refactor: Atom, typed coordinates, new constructors, and deprecated wrappers.
src/censo/ensemble.py Updates conformer creation to use MoleculeData.from_xyz.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/censo/molecules.py
Comment thread src/censo/molecules.py
Comment thread src/censo/molecules.py
Comment thread src/censo/molecules.py
Comment thread src/censo/molecules.py
Comment thread src/censo/molecules.py Outdated
@lmseidler lmseidler added this to the v3.1.0 milestone Mar 5, 2026
lmseidler and others added 2 commits March 5, 2026 11:14
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants