Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating FEFF input from CIF Files #523

Closed
Senjou123 opened this issue Jul 18, 2024 · 7 comments
Closed

Generating FEFF input from CIF Files #523

Senjou123 opened this issue Jul 18, 2024 · 7 comments

Comments

@Senjou123
Copy link

Hello, I am trying to generate a FEFF file from a CIF file, ICSD database code 64918, which is for metallic Pd. I tried with both Larix 0.9.78 and 0.9.8 and in both cases the following error appears :
Elements: ['Pd']
Sites: [0. 0. 0.] Pd0+
Traceback (most recent calls last):
File "C:\Users\nrw23216\AppData\Local\xraylarch\Lib\site-packages\larch\wxlib\structure2feff_browser.py", line 415, in onImportStructure
sites = ['%d' % (i+1) for i in range(len(sites))]
^^^^^^^^^^
TypeError: object of type 'PeriodicSite' has no len()

Is there a way to fix this problem?

Kind regards

Donato Decarolis

@newville
Copy link
Member

@Senjou123 Sorry for the trouble. In general, CIF is a poorly defined format. The tools we use for parsing them can parse many things called "CIF", but they sometimes fail. We know that many from the COD do work. I don't know about ICSD.

The CIF database provided with Larix does have several structures for Pd.

But: for a problem reading some other CIF file, you would have to provide an example.

@maurov
Copy link
Member

maurov commented Jul 18, 2024

@Senjou123 I have tested with the following CIF file (ICSD 64918) and it works nicely with Larix 0.9.80

Pd_fcc_ICSD_CollCode64918.zip

@Senjou123
Copy link
Author

Hi,

Thank you both for your reply. I used that CIF file as an example. I have the same issue when trying to run other CIF files using the "Generate FEFF input from general structures, Run FEFF". I tried for example to run PdCl2 (ICSD 421215), Au3Pd, (ICSD 180873), PdO2 (ICSD 647283), and they all show up with the same error as the one I posted before
" File "C:\Users\nrw23216\AppData\Local\xraylarch\Lib\site-packages\larch\wxlib\structure2feff_browser.py", line 415, in onImportStructure
sites = ['%d' % (i+1) for i in range(len(sites))]
^^^^^^^^^^
TypeError: object of type 'PeriodicSite' has no len()"

Oddly enough I redownloaded the files and now it works. Could there be a problem with importing the files from OneDrive?

@newville
Copy link
Member

@Senjou123 I doubt that the file's location is the issue -- your report shows that the file's content was read, and the problem occurs when it is being parsed.

But (again) for a problem reading some external CIF file, you will have to provide an example file.

@Senjou123
Copy link
Author

Hi Matt,

Sorry here are the CIF Files I was talking about.

Kind regards

Donato
CIFS.zip

@maurov
Copy link
Member

maurov commented Jul 19, 2024

@Senjou123 it took me a while to correctly understand your issue, but I have found it now! Unfortunately, we currently have two pieces of code in Larch which are able to generate a FEFF input from CIF, all wrapping Pymatgen, but in a slightly different way. The first version was implemented by @newville, the second by @Ameyanagi (structure2feff). Actually, there is also a third one (struct2xas), but this is not available in the GUI, only as a Jupyter notebook.

To quickly fix your problem, simply use the first version by @newville, as shown in the screenshot here:

image

@maurov
Copy link
Member

maurov commented Sep 23, 2024

@Senjou123 no feedback from your side for months. I close the issue then.

@maurov maurov closed this as completed Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants