Skip to content

Commit

Permalink
strip some input lines
Browse files Browse the repository at this point in the history
  • Loading branch information
simonp0420 committed Nov 24, 2024
1 parent e4003ec commit 552586c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/TEP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ depends on the type of TEP file encountered:
the file may not contain swept geometrical parameters.
"""
function read_tepfile(filename::AbstractString)
line = readline(filename) # Obtain title line
line = strip(readline(filename)) # Obtain title line
if line == "TICRA-EL_PROP-V1.0"
return _read_tepfile_scatter(filename)
elseif uppercase(line) == "[TITLE] ELECTRICAL PROPERTIES OF PERIODIC UNIT CELL"
Expand All @@ -248,11 +248,11 @@ end

function _read_tepfile_scatter(filename::AbstractString)
teps = open(filename, "r") do fid
filev = readline(fid)
filev = strip(readline(fid))
filev == "TICRA-EL_PROP-V1.0" || error("Incorrect title line: \"$filev\"")
firstfreq = true
while !eof(fid)
title = readline(fid)
title = strip(readline(fid))

strs = split(readline(fid), x -> isspace(x) || x == ','; keepempty=false)
nth = parse(Int, strs[1])
Expand Down Expand Up @@ -309,7 +309,7 @@ end

function _read_tepfile_periodic(filename::AbstractString)
tep = open(filename, "r") do fid
line = readline(fid)
line = strip(readline(fid))
uppercase(line) == "[TITLE] ELECTRICAL PROPERTIES OF PERIODIC UNIT CELL" || error("Incorrect title line: \"$line\"")

_get_puc_str2(fid, "[Version]") == "1.0.0" || error("Incorrect version string")
Expand Down

0 comments on commit 552586c

Please sign in to comment.