From owner-chemistry@ccl.net Fri Feb 23 00:34:00 2018 From: "Karol Langner karol.langner()gmail.com" To: CCL Subject: CCL: Use cclib functionality as part of Python script? Message-Id: <-53204-180223003234-30748-ERoALyZkYgZ6BqC9EyV6Vg * server.ccl.net> X-Original-From: Karol Langner Content-Type: multipart/alternative; boundary="001a1143d3acf3e7470565da7b91" Date: Thu, 22 Feb 2018 21:32:20 -0800 MIME-Version: 1.0 Sent to CCL by: Karol Langner [karol.langner*o*gmail.com] --001a1143d3acf3e7470565da7b91 Content-Type: text/plain; charset="UTF-8" Hi Francisco, Here's one way to do it: import cclib logfile = cclib.parser.ccopen('filename.out') data = logfile.parse() print data.ccenergies On Thu, Feb 22, 2018 at 2:21 PM, Guzman, Francisco fg58_-_njit.edu < owner-chemistry^^ccl.net> wrote: > Hello CCL'ers > > Does anyone have experience using/importing parts cclib as part of a > Python script? > > I want to be able to extract the CCSD(T) energies, convert from eV to > Hartrees, and use plug these energies into an equation extrapolation to the > CBS limit. This is straight forward enough to do in bash, but I can't > extract these energies the same way I would using a terminal using a Python > script. > > Using a terminal, I can extract the energies executing: > ccget ccenergies filname.out > > However, I want to be able to store this ouput as a new variable as part > of a larger Python script I am making for my own post processing. > > I've tried to "import cclib" in my script, but I don't know how to repeat > the output of "ccget ccenergies" as I would using a terminal. > > Thanks, > > /python novice > > -- > Francisco Guzman > PhD Candidate > Otto H. York Department of Chemical, Biological and Pharmaceutical > Engineering > New Jersey Institute of Technology > Email: fg58---njit.edu, guzman.research---gmail.com > --001a1143d3acf3e7470565da7b91 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Francisco,

Here's one way to do = it:

import cclib
logfile =3D cclib.parse= r.ccopen('filename.out')
data =3D logfile.parse()
print data.ccenergies


On Thu, Feb 22, 2018 at 2:21 PM, Guzman, = Francisco fg58_-_njit.edu <o= wner-chemistry^^ccl.net> wrote:
Hello CCL'ers

Does any= one have experience using/importing parts cclib as part of a Python script?=

I want to be able to extract the CCSD(T) energies, convert from eV= to Hartrees, and use plug these energies into an equation extrapolation to= the CBS limit. This is straight forward enough to do in bash, but I can= 9;t extract these energies the same way I would using a terminal using a Py= thon script.

Using a terminal, I can extract the energies exec= uting:
ccget ccenergies filname.out

However, I want to be able to store this ouput a= s a new variable as part of a larger Python script I am making for my own p= ost processing.

I've tried to "import cclib&quo= t; in my script, but I don't know how to repeat the output of "ccg= et ccenergies" as I would using a terminal.

Thanks,<= br>
/python novice
=

--
Francisco Guzman
PhD Candidate
Otto H. York Department of Chemical, Biologic= al and Pharmaceutical Engineering
New Jersey Institute of Technology

--001a1143d3acf3e7470565da7b91--