Skip to content

Q2DTor Integration#1585

Closed
mjohnson541 wants to merge 14 commits intomasterfrom
q2dtor
Closed

Q2DTor Integration#1585
mjohnson541 wants to merge 14 commits intomasterfrom
q2dtor

Conversation

@mjohnson541
Copy link
Copy Markdown
Contributor

This PR enables 2D dimensional coupled rotor calculations using the 2D-NS approximation within Arkane using the external software Q2DTor written by David Ferro Costas and Antonio Fernandez Ramos. It adds a wrapper class in Arkane for computing the statistical mechanical properties of 2D coupled rotors using Q2DTor and adds rotor processing for 2D coupled rotors.

Installing my fork of Q2DTor:

git clone https://github.com/mjohnson541/Q2DTor.git
git checkout arkane

add to your .bashrc or .bash_profile (as appropriate):
export Q2DTor=/.../Q2DTor/src/Q2DTor.py (replacing ... with appropriate absolute path)

I've added an example for calculating the thermo of CH2CHOOH. However the full example takes ~5-8 hours of time to run. The wrapper (HinderedRotor2D) automatically checks for the presence of the .evals output file from Q2DTor that contains the eigenvalues of the Hamiltonian. If it finds this file it automatically skips the calculations and uses the eigenvalues to compute statistical mechanical properties. To shorten the example I've added all of the Q2DTor output files to the example allowing it to find the .evals file and finish rapidly.

I haven't added the documentation yet, primarily because I haven't decided on answers to the following questions yet:

  1. How much detail should we have in the documentation specifically on Q2DTor's internals
  2. Where should Q2DTor details be located
  3. Where should the installation instructions go?

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 29, 2019

Codecov Report

Merging #1585 into master will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1585      +/-   ##
==========================================
+ Coverage   41.58%   41.59%   +0.01%     
==========================================
  Files         176      176              
  Lines       29147    29147              
  Branches     5995     5995              
==========================================
+ Hits        12120    12125       +5     
+ Misses      16187    16183       -4     
+ Partials      840      839       -1
Impacted Files Coverage Δ
rmgpy/data/kinetics/family.py 52.97% <0%> (+0.23%) ⬆️

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 bf2d163...76a56ed. Read the comment docs.

Copy link
Copy Markdown
Member

@alongd alongd left a comment

Choose a reason for hiding this comment

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

I haven't reviewed all commits yet, but wanted these comments to be uploaded for now. Perhaps take them into account when you modify the PR as you suggested offline?

cdef class Conformer(RMGObject):
"""
A representation of an individual molecular conformation. The attributes
A representation of an individual molecular conformation. The attributes
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would you like to make a separate commit for all the white space fixes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

white space changes removed

pass


def readScan(self):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is implemented for a 2D rotor (specifically from Q2DTor). Should the function name reflect that it's a 2D rotor?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I'll clean up the order...not sure how it got this out of order

for f in os.listdir(self.calcPath):
if len(f.split('_')) != 4:
continue
s,name,phi1,phi2 = f.split('_')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you add a comment with an example of such a file name for easier future readability and debugging?
We're checking above for four _, but I see three in scangeom_{name}_{phi1}_{phi2}.out

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Splitting on three '_' will give you a four-tuple => (scangeom, name, phi1, phi2.out)

Es.append(lg.software_log.loadEnergy())
xyz,atnum,_ = lg.software_log.loadGeometry()
xyzs.append(xyz)
atnums.append(atnum)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

atom numbers shouldn't change. Do you think we can just parse it once?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think you can really avoid parsing it, but I can just store it once.

' based on the {3}.'.format(symmetry, label, pivots, reason))
return symmetry

class HinderedRotor2D(Mode):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this go to rmgpy.statmech.mode?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It would make most sense to place it in rmgpy.statmech.torsion.pyx, but it creates a cyclic import I could resolve related to loading qm files, I think statmech.py is the best alternative, statmech.mode isn't in the first list of places I'd look for this in.

write a .pes file for Q2DTor based on the
read in scans
"""
atdict = {x.number:x.symbol for x in elementList}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can use common.symbol_by_number instead

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

# Calculations #
#----------------------------------#
start_calcs
level hf 3-21g # the calculation level
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Level doesn't actually do anything in our implementation, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nope, just a required part of the Q2DTor input file

# Torsional PES #
#----------------------------------#
start_pes
t1step 10.0 # step in phi1 for scan calculation [degrees]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What if the user used a different step size?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's related to Q2DTor launching jobs, I automatically write the pes file so it doesn't matter.

# Working temperatures #
#----------------------------------#
start_temperatures #
100.0 150.0 200.0 #
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What if the user cares about a different T range?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The temperature range is unimportant because it's only used by Q2DTor after you get the eigenvalues, I just take the eigenvalues and calculate everything ourselves once we have them.

reads an available .evals file to get the QM energy levels
for the 2D-NS rotors
"""
f = open(os.path.join(self.q2dtor_path,'IOfiles',self.name+'.evals'),'rU')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think open(... 'U') is deprecated, take a look

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

@mjohnson541
Copy link
Copy Markdown
Contributor Author

replaced by Multidimensional rotors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arkane Status: Ready for Review PR is complete and ready to be reviewed Type: Feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants