Julia bindings
See original GitHub issueTaken from https://wiki.openchemistry.org/GSoC_Ideas_2021:
Brief explanation: The Julia programming language (https://julialang.org/) is growing in popularity for computational chemistry as a language that both production-level computation and analysis can be performed in seamlessly. In order to analyze computational chemistry outputs from traditional programs in Julia, rather than reimplement all cclib functionality in Julia, we should be able to call cclib from Julia directly and reuse its core functionality.
Expected results: Julia bindings to cclib IO functionality and a Julia-native representation of cclib data objects, with each cclib attribute accessible as a native Julia type. The bindings should be available on the default Julia package registry. The remainder of the project is more open-ended, but an example application of using the bindings would be ideal.
In retrospect, this may have been a bad GSoC project idea. It looks like using PyCall like
using PyCall
cclib = pyimport("cclib")
p = "/home/eric/development/cclib_berquist/data/QChem/basicQChem5.1/dvb_gopt.out"
data = cclib.io.ccread
# use keys(data) to see all attributes
just works:
julia> data.atomcoords
5×20×3 Array{Float64, 3}:
[:, :, 1] =
1.36681 0.441649 -0.924918 -1.36681 -0.441649 0.924918 0.790222 -1.6542 -0.790222 1.6542 -2.87586 -3.80079 -3.12383 -4.87694 -3.55281 2.87586 3.80079 3.12383 4.87694 3.55281
1.41641 0.495705 -0.895149 -1.41641 -0.495705 0.895149 0.879445 -1.57416 -0.879445 1.57416 -2.89877 -3.90815 -3.12116 -4.95754 -3.75036 2.89877 3.90815 3.12116 4.95754 3.75036
1.41536 0.486544 -0.898104 -1.41536 -0.486544 0.898104 0.865075 -1.58625 -0.865075 1.58625 -2.87799 -3.88297 -3.11503 -4.93074 -3.71352 2.87799 3.88297 3.11503 4.93074 3.71352
1.41529 0.484334 -0.898219 -1.41529 -0.484334 0.898219 0.861887 -1.58835 -0.861887 1.58835 -2.88202 -3.8854 -3.12554 -4.93362 -3.7126 2.88202 3.8854 3.12554 4.93362 3.7126
1.4151 0.484141 -0.898537 -1.4151 -0.484141 0.898537 0.86146 -1.58895 -0.86146 1.58895 -2.8817 -3.88463 -3.12527 -4.93286 -3.71174 2.8817 3.88463 3.12527 4.93286 3.71174
[:, :, 2] =
0.278769 1.32306 1.04428 -0.278769 -1.32306 -1.04428 2.36601 1.86735 -2.36601 -1.86735 -0.586781 0.363252 -1.65668 0.143975 1.43315 0.586781 -0.363252 1.65668 -0.143975 -1.43315
0.233001 1.31613 1.09069 -0.233001 -1.31613 -1.09069 2.34496 1.94941 -2.34496 -1.94941 -0.542141 0.345349 -1.61915 0.026949 1.42784 0.542141 -0.345349 1.61915 -0.026949 -1.42784
0.237409 1.31605 1.08646 -0.237409 -1.31605 -1.08646 2.34751 1.94215 -2.34751 -1.94215 -0.541685 0.350403 -1.6166 0.0276862 1.43396 0.541685 -0.350403 1.6166 -0.0276862 -1.43396
0.240074 1.3155 1.08321 -0.240074 -1.3155 -1.08321 2.34743 1.93676 -2.34743 -1.93676 -0.543308 0.351237 -1.61643 0.03009 1.4337 0.543308 -0.351237 1.61643 -0.03009 -1.4337
0.240682 1.31611 1.08311 -0.240682 -1.31611 -1.08311 2.34812 1.93631 -2.34812 -1.93631 -0.543525 0.351663 -1.61668 0.0306818 1.43403 0.543525 -0.351663 1.61668 -0.0306818 -1.43403
[:, :, 3] =
-0.0 -0.0 -0.0 0.0 0.0 0.0 -0.0 -0.0 0.0 0.0 0.0 -0.0 0.0 -0.0 -0.0 -0.0 0.0 -0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
julia> data.atomcoords[1, :, :]
20×3 Matrix{Float64}:
1.36681 0.278769 -0.0
0.441649 1.32306 -0.0
-0.924918 1.04428 -0.0
-1.36681 -0.278769 0.0
-0.441649 -1.32306 0.0
0.924918 -1.04428 0.0
0.790222 2.36601 -0.0
-1.6542 1.86735 -0.0
-0.790222 -2.36601 0.0
1.6542 -1.86735 0.0
-2.87586 -0.586781 0.0
-3.80079 0.363252 -0.0
-3.12383 -1.65668 0.0
-4.87694 0.143975 -0.0
-3.55281 1.43315 -0.0
2.87586 0.586781 -0.0
3.80079 -0.363252 0.0
3.12383 1.65668 -0.0
4.87694 -0.143975 0.0
3.55281 -1.43315 0.0
If the interface provided by PyCall doesn’t require any extra work, then we don’t need to provide bindings.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:13 (12 by maintainers)
Top GitHub Comments
It’s done. Very simple documentation is available here.
Thanks for the tag! Definitely check out our AtomsBase package! Connecting that up with this CClib stuff would be 🔥