-
Notifications
You must be signed in to change notification settings - Fork 81
Add functionality for chemical applications of group theory/symmetry #236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add chemical applications of symmetry/group theory functionality including the ability to decompose reducible representations into irreducible representations, calculate IR/Raman active modes, predict symmetry adapted linear combination of orbitals (SALCs) by the projection operator method, etc.
Fix representations.py documentation by updating function names in examples.
|
Hi @weisscharlesj, sorry for the delay. I appreciate your time and work in submitting this pull request, and I apologize that the turn-around time is so long. I'm just curious: are you using ChemPy yourself in teaching or research? |
|
Sounds good. I should have an update to this PR probably before next week once I finish adding the ability to return dictionaries and more tests for the SALCs functionality. I use ChemPy a bit in my teaching such as my Scientific Computing for Chemists course. I hope to add some ChemPy examples to my open computing textbook before I teach this course again. |
Add the ability for the user to return results as a dictionary with mulliken symbols as keys for easier interpretation. Updated documentation, fixed a series of minor issues, added more tests, and improved consistency across functions.
|
Here is an updated PR with all the features I intend to implement. A few changes were made for user convenience such as the ability to return dictionaries with mulliken symbols as keys. Here is a summary of all the key features. representations.py
salcs.py
|
Fixed a few typos in tables.py, reformatted the dictionaries for easier reading/proof reading, and added more comments and a reference. Added more tests to test_representations.py to cover a wider set of point groups along with more tests for generating reducible representations from stationary atoms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have made some effort to make the master branch of ChemPy play nicely with latest NumPy (>2) and Python, and I intend to mint a new release in the upcoming weeks. This PR looks really good, so I'm hoping to merge it before that happens. I will not review the technical details (I trust that you got things right, otherwise we can always fix any mistakes later on).
I left some comments throughout, let me know what you think.
Renamed get_xyz() functions to print_xyz() and corrected Schoenflies misspellings. Changed tables dictionary in tables.py to use SymPy numeric representations for non-integer values to make calculations for exact. Added sympy_to_num() function in representations.py to evaluate SymPy representations to floats when necessary for calculations (e.g., decomp()). Added a print_table() function that prints a decent-looking character table for the user. This requires the tabulate library, which adds an extra ChemPy dependency. I can remove this function if you want to avoid another dependency. Updated calc_salc_func() to accept angles in the spherical coordinate convention to be more consistent with the convention used by SymPy and SciPy. Updated tests and documentation accordingly.
|
I believe this commit resolves all the requests along with adjusting the spherical coordinate convention to be consistent with SciPy and Sympy, and some minor edits for clarity. I added a print_table() function that uses tabulate. I’m fine removing this function if you'd prefer to avoid this dependency. |
|
Looking good! I merged master branch, added The remaining ones are these: $ python -m flake8 chempy/symmetry/I'll let you decide if you want to correct any of those (perhaps the unused imports at least?) or add some more of those "error codes" to to ignore list. |
Fixed the formatting issues, including the unused imports, either by deleting them or adding additional tests to test_salcs.py to use those imports. Added additional calc_salcs_projection() tests for a wider range of point group coverage. Removed xfail - this was used in the development and is no longer really needed. The docstrings were also updated and improved with more details and examples. Represented the floats in atom_contribution in tables.py as sympy objects to be more exact.
|
I fixed all of the above formatting errors. I also added some references, converted a few missed floats to sympy representations, and added a few more tests for better code and point group coverage. Let me know if there is anything else you'd like changed. Thanks! |
|
Thank you @weisscharlesj for this PR! I'll try to make a new release with these features as soon as possible. |
This is still being tested and polished, but I'm interested in some feedback. This pull request adds functionality for chemical applications of symmetry/group theory including the ability to:
For example, a reducible representation can be created and decomposed into the number of each irreducible representations for the point group by the following.
Reducible representations composed of all motions (i.e., rotation, vibration, and translation) can be relatively easily be created by providing the from_atoms() method with the number of atoms that remain stationary during each symmetry operation for the molecule’s point group. For example, water would be as follows.
This can be decomposed into irreducible representations.
A reducible can also be used to predict IR or Raman active modes such as below. This means this representation contains two A1 and one B1 IR active mode, for example.
There are also functions provides to help the user know the order the symmetry operations and irreducible representations (Mulliken symbols) are provided in when given the point group Schoenflies notation.
The second piece of the is pull request is salcs.py which generates the symmetry adapted linear combinations (SALCs) of molecular orbitals using the projection operator method. I’m not as happy with this piece. It works fine except still doesn’t generate all the SALCS for degenerate irreducible representations. Most inorganic chemistry text books dodge this point, so I’m still searching for a systematic solutions to generate degenerate SALCS. An alternate method for generating SALCS is also provided using the symmetry functions found on the right side of the character table. The user just needs to provide the xyz coordinate for the outer atoms or the angles.