[Ifeffit] Larch version up problem

정은석 eunsuk1986 at jbnu.ac.kr
Mon Feb 5 02:09:13 CST 2024


Hello Matt

I changed my original code to simple code for you as below.
I found the problem of larch 0.9.74 in multi-processing.
You can check it with the below code. How can I fix this problem?

------------------------------------------------------------------------------------------------------------
############# Multi-processing test ########################
import larch
from larch import Group
from larch.utils import *
from larch.xafs import *
from larch.io import *

import numpy as np
import os
import torch.multiprocessing as mp

dPath = r'C:\Users\Administrator\Desktop\RL\feffit_error_test'
os.chdir(dPath)
fname1 = 'feff0001.dat'  # N=1, Reff=1.9 N

path1 = feffpath(os.path.join(dPath,'FEFF1', fname1))
#################################
path_lists=[path1]
path_lists[0].s02=0.86
################################################

class Func():
    def __init__(self, path_lists):
        self.path_lists=path_lists

    def step(self):
        self.path_lists[0].e0, self.path_lists[0].degen,
self.path_lists[0].deltar, self.path_lists[0].sigma2 = [2, 5, 0.001, 0.004]
    ## Theory path들의 합과 theory FFT
        theory_sum=Group(label='theory_group_sum')
        ff2chi(self.path_lists, group=theory_sum)
        new_state=theory_sum.chi
        return new_state

class TestClass():
    def __init__(self, path_lists):
        self.path_lists=path_lists

    def test(self):
        func1 = Func(self.path_lists)
        s=func1.step()
############################################

T_func=TestClass(path_lists)
F_func=Func(path_lists)

if __name__ == '__main__':
    process_list=[]
    p_N =mp.Process(target=T_func.test,)
    p_N.start()
    process_list.append(p_N)
    for process in process_list:
        process.join()
##################################################################
#####Problem##########
  File
"C:\ProgramData\anaconda3\envs\xraylarch\Lib\multiprocessing\process.py",
line 314, in _bootstrap
    self.run()
  File
"C:\ProgramData\anaconda3\envs\xraylarch\Lib\multiprocessing\process.py",
line 108, in run
    self._target(*self._args, **self._kwargs)
  File
"c:\Users\Administrator\Desktop\RL\feffit_error_test\test-ff2chi-problem.py",
line 40, in test
    s=func1.step()
      ^^^^^^^^^^^^
  File
"c:\Users\Administrator\Desktop\RL\feffit_error_test\test-ff2chi-problem.py",
line 30, in step
    ff2chi(self.path_lists, group=theory_sum)
  File
"C:\ProgramData\anaconda3\envs\xraylarch\Lib\site-packages\larch\xafs\feffdat.py",
line 658, in ff2chi
    path.create_path_params(params=params)
  File
"C:\ProgramData\anaconda3\envs\xraylarch\Lib\site-packages\larch\xafs\feffdat.py",
line 392, in create_path_params
    parname = self.pathpar_name(pname)
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File
"C:\ProgramData\anaconda3\envs\xraylarch\Lib\site-packages\larch\xafs\feffdat.py",
line 331, in pathpar_name
    return f'{parname}_{self.dataset}_{self.hashkey}'
                        ^^^^^^^^^^^^
AttributeError: 'FeffPathGroup' object has no attribute 'dataset'


2024년 2월 5일 (월) 오전 4:44, Matt Newville <newville at cars.uchicago.edu>님이 작성:

> Hi Eun-Suk,
>
> All the examples with ff2chi and running feffit work for me.   I sort
> of don't understand how that could happen (a FeffPathGroup does -- or
> should -- have a `dataset` attribute).
>
> Can you provide an example that shows the problem?
>
> --Matt
> _______________________________________________
> Ifeffit mailing list
> Ifeffit at millenia.cars.aps.anl.gov
> http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit
> Unsubscribe: http://millenia.cars.aps.anl.gov/mailman/options/ifeffit
>


-- 
Best regards,

Ph. D. Eun-Suk Jeong
X-ray absorption fine structure(EXAFS+XANES)
Mobile:+82-10-4628-9896
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://millenia.cars.aps.anl.gov/pipermail/ifeffit/attachments/20240205/750b797a/attachment.htm>


More information about the Ifeffit mailing list