SunnySuite / Sunny.jl

Spin dynamics and generalization to SU(N) coherent states
Other
87 stars 19 forks source link

Consider replacing CrystalInfoFramework.jl with cif_api_jll #31

Open kbarros opened 2 years ago

kbarros commented 2 years ago

CrystalInfoFramework.jl is a fairly heavy dependency, and accounts for almost half of the load time for using Sunny, even if the user never reads any .cif files.

Should we move to the C library cif-api? https://comcifs.github.io/cif_api/index.html

It is already distributed by Julia package manager as cif_api_jll . Example code is here: https://github.com/jamesrhester/CrystalInfoFramework.jl/blob/master/src/libcifapi.jl

Current blocker: It seems that cif-api is not currently working on Windows? For details, see: https://github.com/search?q=repo%3Ajamesrhester%2FCrystalInfoFramework.jl%20windows&type=code

kbarros commented 2 years ago

Progress in Julia itself may reduce load time issues https://sciml.ai/news/2022/09/21/compile_time/ , so I think this becomes very low priority.

kbarros commented 2 years ago

There is some renewed motivation for this, because cif-api may be more robust to errors in the CIF files. Xiaojian found a CIF file which causes Sunny to error with Lerche.UnexpectedToken (probably a parsing error). Bi3FeO4Mo2O8_setting2.cif.zip

kbarros commented 1 year ago

Regarding timing, situation seems to be improved in Julia 1.10. On my machine using Sunny is 1.3s, while using CrystalInfoFramework is 0.6s. However, most of the dependencies of CrystalInfoFramework would be required by Sunny anyway, which can be inspected using:

@time_imports using CrystalInfoFramework

Perhaps we wouldn't need DataFrames and Lerche, which combined account for about 0.23s of loading time on my machine.