Re: [Ifeffit] Some questions regarding running Larch code in Python

2018-01-09 Thread Hanyu Zhang
Thanks Matt!

I'll go play with more. I think this is the missing link that I needed.

--
Hanyu (Alice) Zhang
CWRU Class of 2018 | Engineering Physics major
BS/MS program | Materials science
*Minors:* Mathematics | Materials science
*Honors societies:* National Society of Collegiate Scholars | Tau Beta Pi | Pi
Mu Epsilon
*Active Clubs:* Case Origami Circle | Case Rocket Team | CWRUbotix | Case
Physics and Astronomy club | Math club

On Tue, Jan 9, 2018 at 1:26 PM, Matt Newville 
wrote:

> Hi Hanyu,
>
> Sorry for the confusion.   The 'Co.inp' file you attached is actually an
> Atoms.inp file, not a Feff6 or Feff8 input file.
>
> If you run that file through WebAtoms,http://cars9.uchicago.edu/
> webatoms?url=http://cars9.uchicago.edu/atomsdb/Co.inp
> you'll get a Feff6l input file -- running this with
>
>   larch> feff6l('feff_Co.inp')
>
> will generate `feff.dat` files that you can use to define Feff Paths,
> as the examples show...
>
> To run Feff8l, you'll have to generate a Feff8 file from WebAtoms (see
> attached for your Co.inp)
>
> To use that to create feff.dat files, use
>
>   larch> feff8l('feff8_Co.inp')
>
> or, using feffrunner for Feff8 inputs and from python, use:
>
> import larch
>
> from pylab import loadtxt
> from larch import Group
> from larch import Interpreter
> from larch_plugins.xafs import autobk
> from larch_plugins.xafs import feffrunner
> from larch_plugins.xafs import feffdat
>
> session = Interpreter()
> feff = feffrunner.feffrunner('feff8_Co.inp',_larch=session)
>
> # run Fef8:
> feff.run()
>
> # OR  explicitly run all Feff8 modules in order
> feff.run(exe='rdinp')
> feff.run(exe='pot')
> feff.run(exe='xsph')
> feff.run(exe='pathfinder')
> feff.run(exe='genfmt')
> feff.run(exe='ff2x')
>
> # create a Path from a feff.dat file:
>
> testPath = feffdat.FeffPathGroup(filename='feff0001.dat', _larch=session)
> feffdat._path2chi(testPath,_larch = session)
>
> print(testPath)
> print(dir(testPath))
> 
>
> Hope that helps
>
> --Matt
>
>
>
> ___
> Ifeffit mailing list
> Ifeffit@millenia.cars.aps.anl.gov
> http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit
> Unsubscribe: http://millenia.cars.aps.anl.gov/mailman/options/ifeffit
>
>
___
Ifeffit mailing list
Ifeffit@millenia.cars.aps.anl.gov
http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit
Unsubscribe: http://millenia.cars.aps.anl.gov/mailman/options/ifeffit


[Ifeffit] Some questions regarding running Larch code in Python

2018-01-08 Thread Hanyu Zhang
Hello everyone,

I'm trying to find radial distribution functions for materials with known
concentrations of individual atoms by running Larch code through Python,
but am having some difficulties with creating feffpaths:

   1. I'm not quite understanding the feff.inp files stuff. Calling
   FeffRunner().run() with a input file that works with Atoms always throws
   the "rdinp not found exception". From what I'm understanding,
   feffrunner().run() calls the different modules to create a feffpath()
   group, but where are the rdinp, pot, xsph, etc codes/files?
   2. Somewhat on the same line of thought, can someone give me an example
   of a valid feff.dat file to generate a feffpath() group? I went
   through feffdat.py and the parsing code in lines 88-102 (under __read())
   looks like it only accepts very specific input formats.
   3. What does "ipot" stand for in the "geom" variable? I understand that
   if I did pass in a valid file, I'd probably not have to know this, but I
   was just curious...

Also, this might be a overly-general question, but is this the best way to
approach the problem? The basic idea now is to get chi(k) values for a
bunch of different paths/RDFs, and figure out which ones match experimental
values the best. This is also the main reason I want to get past the
Demeter GUI and Larch-specific interface: eventually I might throw the code
on a supercomputer of some sort and have it crunch the numbers. The details
still have to be worked out on my end, but I was wondering if there was a
faster or better way to go about finding the RDF for compound materials
with known concentrations of individual atoms.

I've attached some of my Python code (with more specific versions of
questions 1 and 2 inserted as comments) and the feff.inp file I've been
testing with. (Simple file from http://cars9.uchicago.edu/~
newville/adb/search.html) I'm currently an undergrad exploring the field of
XAFS, so sorry in advance if there is something obvious that I'm missing...
Also, let me know if any clarifications are needed.

Thank you for your time and sorry about the email being so long,
Alice
--
Hanyu (Alice) Zhang
CWRU Class of 2018 | Engineering Physics major
BS/MS program | Materials science
*Minors:* Mathematics | Materials science
*Honors societies:* National Society of Collegiate Scholars | Tau Beta Pi | Pi
Mu Epsilon
*Active Clubs:* Case Origami Circle | Case Rocket Team | CWRUbotix | Case
Physics and Astronomy club | Math club
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jan  8 22:11:48 2018

@author: alicezhang
"""

# Import stuff
import matplotlib.pyplot as plt
from pylab import loadtxt
from larch import Group
from larch import Interpreter
from larch_plugins.xafs import autobk
from larch_plugins.xafs import feffrunner
from larch_plugins.xafs import feffdat

# 1
# How do I get line 21 to work and return a path group?
session = Interpreter()
feff = feffrunner.feffrunner('Co.inp',_larch=session)
feff.run('rdinp')

# 2
# geom = long list... 
# I think it might be easier to pass in a feff.dat file, but how?
testPath = feffdat.FeffPathGroup(reff = 2,_larch = session)
feffdat._path2chi(testPath,_larch = session)
# Throws: AttributeError: 'FeffPathGroup' object has no attribute 'geom'

Co.inp
Description: Binary data
___
Ifeffit mailing list
Ifeffit@millenia.cars.aps.anl.gov
http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit
Unsubscribe: http://millenia.cars.aps.anl.gov/mailman/options/ifeffit