mcocdawc / chemcoord

A python module for manipulating cartesian and internal coordinates.
GNU Lesser General Public License v3.0
72 stars 19 forks source link

writting zmatrix from pandas frame #22

Closed Balasubra closed 7 years ago

Balasubra commented 7 years ago

Friends, Friends, I appreciate the effort on "chemcord library". I am facing a particular situation where i need to manipulate some dihedrals. I simply used chemcoor as follows,

Opened my Zmatrix as pandas Dataframe, and substituted the dihedral angle

zm = cc.Zmat.read_zmat('Startz.com').frame zm.loc[8,'dihedral']=83.5

The issue is to output the pandas frame again as modified Zmatrix. I dnt see any relevant function in chemcoord to do the same, am i missing something ?. Is there any way to output zmatrix directly besides converting it to xyz ?.

Thanks, Bala

mcocdawc commented 7 years ago

General advice: You rarely want to access the frame attribute.

How to do it idiomatically: Current master branch and upcoming version of chemcoord:

zm = cc.Zmat.read_zmat('Startz.com')
zm.loc[8, 'dihedral'] = 83.5
zm.write_zmat(...)

Version 1.2.0 (the one currently installed using pip):

zm = cc.Zmat.read_zmat('Startz.com')
zm[8, 'dihedral'] = 83.5
zm.write(...)

If you are at the documentation homepage you can select the documentation for different versions of chemcoord.