Skip to content

Commit

Permalink
Fixed slurm_isrunning and reading 3D arrays from input
Browse files Browse the repository at this point in the history
  • Loading branch information
Louis Ponet committed May 21, 2021
1 parent 517b9d6 commit 39c35e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
14 changes: 6 additions & 8 deletions src/qe/fileio.jl
Original file line number Diff line number Diff line change
Expand Up @@ -783,22 +783,20 @@ function qe_read_input(filename; execs=[Exec("pw.x")], run=true, structure_name=
if !haskey(parsed_flags, sym)
if typ <: AbstractMatrix
parsed_flags[sym] = length(parsedval) == 1 ? zeros(eltype(typ), ntyp, 10) : fill(zeros(eltype(typ), length(parsedval)), ntyp, 10) #arbitrary limit
else
elseif typ <: AbstractVector
parsed_flags[sym] = length(parsedval) == 1 ? zeros(eltype(typ), ntyp) : fill(zeros(eltype(typ), length(parsedval)), ntyp)
else
dims = fill(nat, ndims(typ)-1)
parsed_flags[sym] = zeros(eltype(typ), dims..., 3)
end
end
if length(ids) == 1
parsed_flags[sym][ids[1]] = length(parsedval) == 1 ? parsedval[1] : parsedval
else
parsed_flags[sym][ids[1], ids[2]] = length(parsedval) == 1 ? parsedval[1] : parsedval
end
parsed_flags[sym][ids...] = length(parsedval) == 1 ? parsedval[1] : parsedval
end
structure = extract_structure!(structure_name, parsed_flags, cell_block, atsyms, atom_block, pseudos)
delete!.((parsed_flags,), [:ibrav, :nat, :ntyp, :A, :celldm_1, :celldm])
delete!.((parsed_flags,), [:Hubbard_U, :Hubbard_J0, :Hubbard_alpha, :Hubbard_beta, :Hubbard_J])
delete!.((parsed_flags,), [:starting_magnetization, :angle1, :angle2]) #hubbard and magnetization flags
# elseif haskey(parsed_flags, :celldm) && parsed_flags[:celldm] !=


else
structure = nothing
end
Expand Down
8 changes: 3 additions & 5 deletions src/serverAPI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,10 @@ function slurm_isrunning(job::DFJob)
runslocal_assert(job)
id = slurm_jobid(job)
if id != -1
if slurm_process_command(`sacct -j $id --format=state`)[1] == "RUNNING"
return true
else
return false
end
line = getfirst(x -> occursin("JobState", x), slurm_process_command(`scontrol show job $id`))
return split(split(line)[1], "=")[2] == "RUNNING"
else
@warn "No jobid found. Was your job submitted through slurm?"
return false
end
end
Expand Down

0 comments on commit 39c35e4

Please sign in to comment.