Some ndarrays are not translated to Julia arrays
- Lingua principale
- Julia
- Stelle
- 1.5k
- Fork
- 186
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I am not sure how to reduce this. This requires `pymatgen` library which can be installed by `conda install --channel conda-forge pymatgen`.
```julia
julia> using PyCall
julia> pmg = pyimport("pymatgen")
PyObject
julia> structure = pmg.Structure.from_file("D:/Temp/C.vasp")
PyObject Structure Summary
Lattice
abc : 4.3635439873 4.363543987280233 69.108813801
angles : 90.0 90.0 60.00000381533356
volume : 1139.5747128269852
A : 4.3635439873 0.0 0.0
B : 2.181771742 3.7789400888 0.0
C : 0.0 0.0 69.108813801
PeriodicSite: C (-1.0909, -0.6298, 6.7636) [-0.1667, -0.1667, 0.0979]
PeriodicSite: C (-3.2727, -1.8895, 20.2908) [-0.5000, -0.5000, 0.2936]
PeriodicSite: C (-5.4544, -3.1491, 33.8180) [-0.8333, -0.8333, 0.4893]
PeriodicSite: C (-7.6362, -4.4088, 47.3452) [-1.1667, -1.1667, 0.6851]
julia> structure.lattice.matrix # expect a julia matrix here.
PyObject array([[ 4.36354399, 0. , 0. ],
[ 2.18177174, 3.77894009, 0. ],
[ 0. , 0. , 69.1088138 ]])
```
I was expecting a julia matrix in the last output. `D:/Temp/C.vasp` is here
```
C
1.0
4.3635439873 0.0000000000 0.0000000000
2.1817717420 3.7789400888 0.0000000000
0.0000000000 0.0000000000 69.1088138010
C
4
Cartesian
-1.090885694 -0.629823198 6.763601725
-3.272657083 -1.889469593 20.290805175
-5.454428472 -3.149115989 33.818008626
-7.636199861 -4.408762384 47.345212076
```
In Python
```python
In [3]: import pymatgen as pmg
In [4]: structure = pmg.Structure.from_file("D:/Temp/C.vasp")
In [5]: structure.lattice.matrix
Out[5]:
array([[ 4.36354399, 0. , 0. ],
[ 2.18177174, 3.77894009, 0. ],
[ 0. , 0. , 69.1088138 ]])
In [6]: type(structure.lattice.matrix)
Out[6]: numpy.ndarray
```
```julia
julia> versioninfo()
Julia Version 1.5.0
Commit 96786e22cc (2020-08-01 23:44 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
(@v1.5) pkg> st
Status `C:\Users\xxx\.julia\environments\v1.5\Project.toml`
[7073ff75] IJulia v1.21.2
[438e738f] PyCall v1.91.4
[d330b81b] PyPlot v2.9.0
[295af30f] Revise v2.7.3
```
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
No source file or test is named. Reproduce the Julia 1.5/Windows case with PyCall and pymatgen, then trace how structure.lattice.matrix, a numpy.ndarray, is returned; done means the ndarray is converted to the expected Julia matrix without breaking other Python array handling.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- julia, numpy, python
- Ambito
- data
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100