Skip to content

Comments

Rewrite clean2d algorithm on Python#52

Open
valiaafo wants to merge 10 commits intochython:V2from
cimm-kzn:clean2d_python
Open

Rewrite clean2d algorithm on Python#52
valiaafo wants to merge 10 commits intochython:V2from
cimm-kzn:clean2d_python

Conversation

@valiaafo
Copy link

All mentions of the old algorithm written in JavaScript have been removed. The file chython/algorithms/calculate2d/clean2d.js has been rewritten in Python, with new imports for the new algorithm, and moved to chython/algorithms/calculate2d/clean2d.py.


All files containing JavaScript code have been deleted, and instead, new files have been added to the chython/algorithms/calculate2d/ folder.

  • Calculate2d.py is the main recursive algorithm that calculates the coordinates of the vertices of the molecular graph.

  • KKLayout.py contains the Kamada-Kaway algorithm, which is necessary for calculating the coordinates of bridged cyclic molecules.

  • MathHelper.py includes auxiliary mathematical functions needed for calculations in the main algorithm, such as vectors and polygons (this will be completely replaced with an equivalent written using the NumPy library).

  • Properties.py contains auxiliary property classes for extending information about atoms, cycles, and bonds (this will soon be rewritten to reduce code repetition).

walderhu and others added 3 commits December 18, 2024 13:31


__all__ = ['Calculate2DMolecule', 'Calculate2DReaction']
from .clean2d import Calculate2DMolecule, Calculate2DReaction No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

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

broken import

Copy link
Author

Choose a reason for hiding this comment

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

fixed and additionally rechecked for operability

walderhu and others added 6 commits December 23, 2024 11:55
Some property classes and properties that duplicate the existing functionality of the kayton were removed, and were made to improve the readability of the code, which allowed to optimize the algorithm

The Vestor class for calculating coordinates and vectors was also improved, it was inherited from np.array and as a result a 2.5 times boost was obtained.

Also some functions were improved, the changes were of the following nature
- stylistic character
- changes aimed at improving code readability
- changes aimed at optimizing the algorithm (it was completely rewritten)
- changes related to the replacement of property class analogs with the existing ones of the molecular container.
- minor corrections of functions, in which calculation operations over coordinates and vectors took place, the same algorithm was rewritten, but adjusted to the optimized class already
refactor clean2d on python

See merge request cimm/public/chython!2
@valiaafo
Copy link
Author

valiaafo commented Feb 1, 2025

Some property classes and properties that duplicate the existing functionality of the kayton were removed, and were made to improve the readability of the code, which allowed to optimize the algorithm

The Vestor class for calculating coordinates and vectors was also improved, it was inherited from np.array and as a result a 2.5 times boost was obtained.

Also some functions were improved, the changes were of the following nature

  • stylistic character
  • changes aimed at improving code readability
  • changes aimed at optimizing the algorithm (it was completely rewritten)
  • changes related to the replacement of property class analogs with the existing ones of the molecular container.
  • minor corrections of functions, in which calculation operations over coordinates and vectors took place, the same algorithm was rewritten, but adjusted to the optimized class already

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.

4 participants