tschoonj / xraylib

A library for X-ray matter interaction cross sections for X-ray fluorescence applications
https://github.com/tschoonj/xraylib/wiki
Other
120 stars 54 forks source link

Problem encountered in using the function “AtomicNumber(string name)” #119

Closed ZhouChaoCN closed 4 years ago

ZhouChaoCN commented 4 years ago
            int a = XrayLib.Instance.AtomicNumber("Cd");  //a=-99
            int b = XrayLib.Instance.AtomicNumber("Sr");   //b=-99
            int c = XrayLib.Instance.AtomicNumber("Vd");   //c=48,Cadmium(Cd)

            As shown above, the results of the first two items are incorrect.
            How to solve this problem?Thank you.
tschoonj commented 4 years ago

Hi,

What programming language is this written in??

ZhouChaoCN commented 4 years ago

C#, Visual Studio 2017.

tschoonj commented 4 years ago

You are using the latest stable release xraylib-3.3.0-win64.exe?

ZhouChaoCN commented 4 years ago

I have tried the following three versions: xraylib-3.1.0-win32.exe xraylib-3.3.0-win32.exe xraylib-3.3.0-win64.exe The results are the same.

tschoonj commented 4 years ago

I think you need to use CompoundData.SymbolToAtomicNumber:

https://github.com/tschoonj/xraylib/blob/b0a313d025c2e69b34cce7d74b3119dcfc808d96/example/xrlexample8.cs#L90-L92

ZhouChaoCN commented 4 years ago

Yes!That's right, thank you for your guidance. There is another question.

ElementData ED1 = XrayLib.Instance.GetElementData(38); //ED1 = {38, Strontium, Sr , 87.62, 5, 2, 2.54 ElementData ED2 = XrayLib.Instance.GetElementData(48);//ED2 = {48, Cadmium, Vd, 112.411, 5, 12, 8.65}

“Sr ”has an extra space. “Vd” should be “Cd”.

Is there another function available, just like the one above?

tschoonj commented 4 years ago

Those are bugs... I will make sure they are fixed for the next release.

Many thanks for reporting this!

ZhouChaoCN commented 4 years ago

OK,look forward to the next release. Xraylib has brought me great convenience and help. Thank you for your hard work.

tschoonj commented 4 years ago

Just got confirmation from the person building the .NET bindings that it will be fixed in the next release.

Thanks again for the bug report!