Code Monkey home page Code Monkey logo

xcrysdenstructureformat.jl's People

Contributors

azadoks avatar

Watchers

 avatar

Forkers

qiaojunfeng

xcrysdenstructureformat.jl's Issues

Bug: Specifying atoms by symbol

TIL that the XSF format also allows for specifying atoms by their symbols instead of the atomic number. Quoting the spec (http://www.xcrysden.org/doc/XSF.html):

An entry for an atom looks like:
AtNum X Y Z
where AtNum stands for atomic number (or symbol)

I noticed this trying to parse this file using AtomsIO: https://github.com/aiidateam/acwf-verification-scripts/blob/main/0-preliminary-do-not-run/oxides/xsfs-oxides-verification-PBE-v1/Li-XO.xsf

julia> using AtomsIO

julia> system = load_system("data/Li-XO.xsf")
ERROR: ArgumentError: invalid base 10 digit 'L' in "Li"
Stacktrace:
  [1] tryparse_internal(::Type{Int64}, s::SubString{String}, startpos::Int64, endpos::Int64, base_::Int64, raise::Bool)
    @ Base ./parse.jl:143
  [2] parse(::Type{Int64}, s::SubString{String}; base::Nothing)
    @ Base ./parse.jl:254
  [3] parse
    @ ./parse.jl:253 [inlined]
  [4] parse_coord_line(T::Type{Float64}, line::String)
    @ XCrySDenStructureFormat ~/.julia/packages/XCrySDenStructureFormat/1Yzsb/src/fileio.jl:84
  [5] (::XCrySDenStructureFormat.var"#3#4"{DataType, Base.EachLine{IOStream}})(::Int64)
    @ XCrySDenStructureFormat ~/.julia/packages/XCrySDenStructureFormat/1Yzsb/src/fileio.jl:101
  [6] iterate
    @ ./generator.jl:47 [inlined]
  [7] _collect(c::UnitRange{…}, itr::Base.Generator{…}, ::Base.EltypeUnknown, isz::Base.HasShape{…})
    @ Base ./array.jl:854
  [8] collect_similar
    @ ./array.jl:763 [inlined]
  [9] map
    @ ./abstractarray.jl:3285 [inlined]
 [10] parse_coord_block(T::Type{Float64}, lines::Base.EachLine{IOStream})
    @ XCrySDenStructureFormat ~/.julia/packages/XCrySDenStructureFormat/1Yzsb/src/fileio.jl:100
 [11] parse_xsf_block(T::Type{Float64}, keyword::SubString{String}, lines::Base.EachLine{IOStream})
    @ XCrySDenStructureFormat ~/.julia/packages/XCrySDenStructureFormat/1Yzsb/src/fileio.jl:112
 [12] parse_periodic_frame(T::Type{Float64}, lines::Base.EachLine{IOStream}, bcs::Vector{Periodic}, previous_frame::Nothing)
    @ XCrySDenStructureFormat ~/.julia/packages/XCrySDenStructureFormat/1Yzsb/src/fileio.jl:140
 [13] load_xsf(T::Type{Float64}, file::String)
    @ XCrySDenStructureFormat ~/.julia/packages/XCrySDenStructureFormat/1Yzsb/src/fileio.jl:202
 [14] load_xsf
    @ ~/.julia/packages/XCrySDenStructureFormat/1Yzsb/src/fileio.jl:208 [inlined]
 [15] load_system
    @ ~/.julia/packages/AtomsIO/NAVEQ/src/xsf.jl:19 [inlined]
 [16] load_system(file::String, index::Nothing; kwargs::@Kwargs{})
    @ AtomsIO ~/.julia/packages/AtomsIO/NAVEQ/src/saveload.jl:45
 [17] load_system
    @ ~/.julia/packages/AtomsIO/NAVEQ/src/saveload.jl:44 [inlined]
 [18] load_system(file::String)
    @ AtomsIO ~/.julia/packages/AtomsIO/NAVEQ/src/saveload.jl:44
 [19] top-level scope
    @ REPL[2]:1
Some type information was truncated. Use `show(err)` to see complete types.

It looks like the current implementation does not handle the case of atomic symbols. For comparison, here is the corresponding line in ASE https://wiki.fysik.dtu.dk/ase/_modules/ase/io/xsf.html:

tokens = positionline.split()
symbol = tokens[0]
if symbol.isdigit():
    numbers.append(int(symbol))
else:
    numbers.append(atomic_numbers[symbol.capitalize()])

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Consolidating support for XSF file I/O provided by Electrum.jl

I'm currently working on Electrum.jl, which has some support for reading XSF files. There's support for some functionality that isn't implemented in this package (primarily reading/writing of data grids), and some that I'd like to implement (animated XSFs/band grids).

I do think it's good for a package to exist independently of Electrum that provides support for XSF file I/O; I just want to make sure that we can benefit from each other and not have to reinvent the wheel too many times. Feel free to just pull code straight from Electrum and adapt it as needed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.