Skip to content
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

Updated symmetry calculations #50

Merged
merged 4 commits into from
Dec 18, 2019
Merged

Updated symmetry calculations #50

merged 4 commits into from
Dec 18, 2019

Conversation

nateharms
Copy link

Updated the way that AutoTST determines symmetry numbers. We were using the outdated symmetry package to calculate this but it was resulting in errors in determination of symmetry numbers (see #49). This PR updates the autotst.species.Conformer.calculate_symmetry_number method to use the symmetry number calculated by RMG's Species objects. Tests were updated accordingly as well.

Nate Harms added 2 commits November 20, 2019 16:55
We're now using RMGSpecies to determine symmetry numbers instead of the outdated `symmetry` package
You're unable to set a property so we're setting what is returned in the property
@codecov
Copy link

codecov bot commented Nov 20, 2019

Codecov Report

Merging #50 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #50      +/-   ##
==========================================
+ Coverage    63.2%   63.25%   +0.04%     
==========================================
  Files          27       27              
  Lines        4626     4629       +3     
==========================================
+ Hits         2924     2928       +4     
+ Misses       1702     1701       -1
Impacted Files Coverage Δ
autotst/species.py 71.35% <100%> (+0.07%) ⬆️
autotst/reactionTest.py 99.5% <100%> (+0.01%) ⬆️
autotst/speciesTest.py 98.75% <100%> (ø) ⬆️
autotst/calculator/statmechTest.py 95% <0%> (-1.25%) ⬇️
autotst/reaction.py 80.08% <0%> (+0.21%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e417241...8238aa5. Read the comment docs.

Copy link
Member

@rwest rwest left a comment

Choose a reason for hiding this comment

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

Great. Does it also work well for TSs?

@nateharms
Copy link
Author

Symmetry numbers calculated for TSs in previous checks pass... But I believe it breaks down a bit at that point. This symmetry method works via the connectivity of the RMGMolecule rather than on the positions. So, if we want to get it to work we have to do something like the following:

In [1]: from rmgpy.molecule import Molecule as RMGMolecule 
   ...: from rmgpy.species import Species as RMGSpecies 
   ...: from autotst.reaction import Reaction, TS                                                                            
WARNING:root:No kyotocabinet available

In [2]: rxn = Reaction("[CH3]+[OH]_C+[O]") #Expected symmetry number of 3  
   ...: rxn.get_labeled_reaction() 
   ...: ts = rxn.ts["forward"][0]                                                                                            

In [3]: numbers = ts.ase_molecule.numbers 
   ...: positions = ts.ase_molecule.positions                                                                                

In [4]: mol = RMGMolecule() 
   ...: mol.from_xyz(numbers, positions)                                                                                     

In [5]: species = RMGSpecies(molecule=[mol]) 
   ...: species.get_symmetry_number()                                                                                        
Out[5]: 3.0

I make these updates shortly.

Copy link
Member

@rwest rwest left a comment

Choose a reason for hiding this comment

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

A few more tests would be nice. Maybe iterate a list of species, and in another test a list of reaction TS, and their expected symmetry numbers.

Because of the way that symmetry numbers are calculated for RMG objects (based on the graph), we have to reinitialize the TS as a graph with an edge connecting reacting atoms. This is taken care of and an additional test was added.
numbers = self.ase_molecule.numbers
positions = self.ase_molecule.positions

mol = RMGMolecule()
Copy link
Collaborator

Choose a reason for hiding this comment

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

small clarification, is mol different from self.rmg_molecule? can we just use self.rmg_molecule instead of making a new object that might need more memory!

Copy link
Collaborator

Choose a reason for hiding this comment

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

If ‘self.rmg_molecule’ has coords, I think we should use that. If not, maybe use the ‘update_coords_from’ method to create rmg mol from ase mol?

@nateharms
Copy link
Author

nateharms commented Nov 21, 2019 via email

@skrsna
Copy link
Collaborator

skrsna commented Nov 22, 2019

sounds good to me to leave it as it is if making a RMGMolecule object doesn't take up lots of run time memory. I guess I got confused with RMGSpecies object cause @rwest commented that it's taking up lot of memory during resonance structure generation for catalysis. If @davidfarinajr agrees someone merge this.

@davidfarinajr davidfarinajr merged commit 25067c7 into master Dec 18, 2019
@nateharms nateharms deleted the symmetry branch January 6, 2020 22:16
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