exa-analytics / exatomic

A unified platform for theoretical and computational chemists
https://exa-analytics.github.io/exatomic
Apache License 2.0
19 stars 12 forks source link

Atom table transformations #150

Closed herbertludowieg closed 5 years ago

herbertludowieg commented 5 years ago

This PR closes #86 Additions:

Example Code:

from exatomic import gaussian
from exatomic.base import resource

uni = gaussian.Output(resource('g09-ch3nh2-631g.out')).to_universe()
# just to see the current atom table
uni.atom
# rotate atom table 90 degrees about z axis
rotation = uni.atom.rotate(theta=90, axis=[0,0,1], degrees=True)
# translate atom table 5 angstroms in x
trans_1 = uni.atom.translate(dx=5, units='Angstrom')
# or
trans_2 = uni.atom.translate(vector=[5,0,0], units='Angstroms')
tjduigna commented 5 years ago

I like the method additions! we definitely benefit from functionality like this. It looks like line endings got botched through git so it shows the whole core/atom.py as edited. Not sure if it's worth the hassle to fix but the main goal is to add the translate and rotate method to the atom frame right? I am unfamiliar with the Rodrigues formula, but when I had to do this I used rotation matrices. Will do a proper review at some point

herbertludowieg commented 5 years ago

For some reason I had it in a dos format and I converted it into unix. I was thinking about using rotation matrices, but I felt like it'd be neat to be able to define an arbitrary vector to rotate around. This seemed to be the simpler solution and I labeled it wrong it's supposed to be Rodrigues' rotation formula since there's one for Legendre polynomials and what not. Yeah, I just wanted to add the translate and rotate methods. Something else I was thinking of possibly adding is a method to remove an atom. Claudiu asked me one time if you could actually remove Hydrogens and I ended up making a bit of a hack of an addition. It seemed interesting, but it would require changing the atom and atom_two table so I guess I'd have to be a bit careful with it.

herbertludowieg commented 5 years ago

Yeah