-
Notifications
You must be signed in to change notification settings - Fork 230
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
Determine the rotor symmetry number from the potential scan #1526
Changes from all commits
d68e314
168a102
6beb888
a8abefb
d81a679
383395c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
############################################################################### | ||
# # | ||
# RMG - Reaction Mechanism Generator # | ||
# # | ||
# Copyright (c) 2002-2018 Prof. William H. Green (whgreen@mit.edu), # | ||
# Prof. Richard H. West (r.west@neu.edu) and the RMG Team (rmg_dev@mit.edu) # | ||
# # | ||
# Permission is hereby granted, free of charge, to any person obtaining a # | ||
# copy of this software and associated documentation files (the 'Software'), # | ||
# to deal in the Software without restriction, including without limitation # | ||
# the rights to use, copy, modify, merge, publish, distribute, sublicense, # | ||
# and/or sell copies of the Software, and to permit persons to whom the # | ||
# Software is furnished to do so, subject to the following conditions: # | ||
# # | ||
# The above copyright notice and this permission notice shall be included in # | ||
# all copies or substantial portions of the Software. # | ||
# # | ||
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # | ||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # | ||
# DEALINGS IN THE SOFTWARE. # | ||
# # | ||
############################################################################### | ||
|
||
""" | ||
This script contains unit tests of the :mod:`arkane.main` module. | ||
""" | ||
|
||
import unittest | ||
import os | ||
|
||
from rmgpy.exceptions import InputError | ||
|
||
from arkane import Arkane | ||
from arkane.statmech import StatMechJob, determine_rotor_symmetry | ||
from arkane.qchem import QChemLog | ||
|
||
################################################################################ | ||
|
||
|
||
class TestStatmech(unittest.TestCase): | ||
""" | ||
Contains unit tests of the StatmechJob class. | ||
""" | ||
@classmethod | ||
def setUp(self): | ||
arkane = Arkane() | ||
self.job_list = arkane.loadInputFile(os.path.join(os.path.dirname(os.path.abspath(__file__)), | ||
'data', 'Benzyl', 'input.py')) | ||
|
||
def test_gaussian_log_file_error(self): | ||
"""Test that the proper error is raised if gaussian geometry and frequency file paths are not the same""" | ||
job = self.job_list[-2] | ||
self.assertTrue(isinstance(job, StatMechJob)) | ||
with self.assertRaises(InputError): | ||
job.load() | ||
|
||
def test_rotor_symmetry_determination(self): | ||
""" | ||
Test that the correct symmetry number is determined for rotor potential scans. | ||
""" | ||
path1 = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data', 'NCC_NRotor.out') | ||
path2 = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data', 'NCC_CRotor.out') | ||
scan_log1 = QChemLog(path1) | ||
scan_log2 = QChemLog(path2) | ||
v_list1, angle = scan_log1.loadScanEnergies() | ||
v_list2, angle = scan_log2.loadScanEnergies() | ||
symmetry1 = determine_rotor_symmetry(energies=v_list1, label='NCC', pivots=[]) | ||
symmetry2 = determine_rotor_symmetry(energies=v_list2, label='NCC', pivots=[]) | ||
self.assertEqual(symmetry1, 1) | ||
self.assertEqual(symmetry2, 3) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main(testRunner=unittest.TextTestRunner(verbosity=2)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -351,8 +351,10 @@ scan in the following format:: | |
|
||
The ``Energy`` can be in units of ``kJ/mol``, ``J/mol``, ``cal/mol``, ``kcal/mol``, ``cm^-1`` or ``hartree``. | ||
|
||
The ``symmetry`` parameter will usually equal either 1, 2 or 3. Below are examples of internal rotor scans with these | ||
commonly encountered symmetry numbers. First, ``symmetry = 3``: | ||
The ``symmetry`` parameter will usually equal either 1, 2 or 3. It could be determined automatically by Arkane | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a way in .rst files to add a section of text from another file? That why, future updates to this in arkane/input.rst will automatically update the same section in input_pdep.rst. I am not sure if this is possible, but I will do some digging to find out. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting, I don't know There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It appears to be possible with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's leave it as is for now, I think we should change the pdep doc of Arkane to only include pdep stuff and avoid this repetition. |
||
(by simply not specifying it altogether), however it is always better to explicitly specify it if it is known. If it is | ||
determined by Arkane, the log file will specify the determined value and what it was based on. Below are examples of | ||
internal rotor scans with these commonly encountered symmetry numbers. First, ``symmetry = 3``: | ||
|
||
.. image:: symmetry_3_example.png | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,14 +19,15 @@ | |
'Klip_2': -78.98344186, | ||
} | ||
|
||
geometry = Log('ethyl_cbsqb3.log') | ||
geometry = Log('ethyl_b3lyp.log') | ||
|
||
frequencies = Log('ethyl_cbsqb3.log') | ||
frequencies = Log('ethyl_b3lyp.log') | ||
|
||
"""pivot are the two atoms that are attached to the rotor | ||
top contains the atoms that are being rotated including one of the atoms from pivots | ||
symmetry is the symmetry number of the scan | ||
fit is fit of the scan data. It defaults to 'best', but can also be assigned as 'cosine' or 'fourier'""" | ||
rotors = [ | ||
HinderedRotor(scanLog=Log('ethyl_scan_72.log'), pivots=[1,2], top=[1,3,4], symmetry=6, fit='best') | ||
] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it worth doing the same thing to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wanted to leave one example in with the explicit symmetry number (although it's well documented) for users who would like to specify it. But I'm open to other thoughts. |
||
fit is fit of the scan data. It defaults to 'best', but can also be assigned as 'cosine' or 'fourier' | ||
Principally, the rotor symmetry can be automatically determined by Arkane, but could also be given by the user | ||
(then the user's input overrides Arkane's determination): | ||
rotors = [HinderedRotor(scanLog=Log('ethyl_scan_72.log'), pivots=[1,2], top=[1,3,4], symmetry=6, fit='best')]""" | ||
rotors = [HinderedRotor(scanLog=Log('ethyl_scan_72.log'), pivots=[1,2], top=[1,3,4])] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,4 @@ | |
|
||
species('C2H5', 'ethyl.py') | ||
|
||
statmech('C2H5') | ||
thermo('C2H5', 'Wilhoit') |
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.
Can you move this change to the next commit where you add statmechTest.py? The rest of this commit can probably be combined with one of your earlier syntax commits as well.