dragonyanglong / diffpy.pdfgui

graphical user interface for real space structure refinement to PDF
Other
0 stars 0 forks source link

change atom type #29

Open dragonyanglong opened 6 years ago

dragonyanglong commented 6 years ago

After the calculation, user change the atomtype. it will give error.

No error when change Uij, xyz, or occupancies.

Exception in thread Thread-3: Traceback (most recent call last): File "/home/ly0/anaconda3/envs/pdfgui2/lib/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "diffpy/pdfgui/control/fitting.py", line 102, in run self.fitting.run() File "diffpy/pdfgui/control/fitting.py", line 677, in run calc.start() File "diffpy/pdfgui/control/calculation.py", line 129, in start self.calculate() File "diffpy/pdfgui/control/calculation.py", line 216, in calculate r, g = pc_temp(nometa(struc)) File "/home/ly0/anaconda3/envs/pdfgui2/lib/python2.7/site-packages/diffpy.srreal-1.2-py2.7-linux-x86_64.egg/diffpy/srreal/structureadapter.py", line 52, in createStructureAdapter return factory(stru) File "/home/ly0/anaconda3/envs/pdfgui2/lib/python2.7/site-packages/diffpy.srreal-1.2-py2.7-linux-x86_64.egg/diffpy/srreal/structureconverters.py", line 47, in convertDiffPyStructure _fetchDiffPyStructureData(adpt, stru) File "/home/ly0/anaconda3/envs/pdfgui2/lib/python2.7/site-packages/diffpy.srreal-1.2-py2.7-linux-x86_64.egg/diffpy/srreal/structureconverters.py", line 155, in _fetchDiffPyStructureData aa.atomtype = a0.element ArgumentError: Python argument types in None.None(Atom, unicode) did not match C++ signature: None(diffpy::srreal::Atom {lvalue}, std::string)

dragonyanglong commented 6 years ago

actually, this problem happens even before the calculation. user cannot change the atom type in the phase panel.

dragonyanglong commented 6 years ago

problem is. when change the atom type. it becomes unicode type, not str type anymore. we want string type.

a0 in sreal _fetchDiffPyStructureData C 0.000000 0.500000 0.500000 1.0000 (u'C', <type 'unicode'>) ('Ni', <type 'str'>) 1.0

dragonyanglong commented 6 years ago

Temp solution:

In difpfy/srreal/structureconverters.py, https://github.com/diffpy/diffpy.srreal/blob/master/src/diffpy/srreal/structureconverters.py#L144 aa.atomtype = str(a0.element)