Skip to content

Commit e983758

Browse files
committed
Cleanup and fixes
1 parent 8016433 commit e983758

File tree

3 files changed

+43
-20
lines changed

3 files changed

+43
-20
lines changed

docs/make.jl

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,6 @@ using Documenter
4040
using Literate
4141

4242
using UUIDs
43-
s = Server(name=gethostname(), port=8080, domain = "localhost", scheduler = Servers.Bash(), uuid = string(uuid4()), julia_exec=Sys.BINDIR * "/julia")
44-
if !exists(s)
45-
Servers.initialize_config_dir(s)
46-
save(s)
47-
else
48-
s = Servers.local_server()
49-
end
50-
if !isalive(s)
51-
@info "Starting server here"
52-
Servers.initialize_config_dir(s)
53-
@async DFC.Resource.run()
54-
end
5543

5644
# Collect examples from the example index (src/index.md)
5745
# The chosen examples are taken from the examples/ folder to be processed by Literate
@@ -78,6 +66,43 @@ for (dir, directories, files) in walkdir(SRCPATH)
7866
end
7967
end
8068

69+
using RemoteHPC: configure_local, julia_main
70+
import RemoteHPC: config_path
71+
if !isempty(literate_files)
72+
73+
tconfdir = tempname()
74+
if ispath(tconfdir)
75+
rm(tconfdir; recursive = true)
76+
end
77+
config_path(p...) = joinpath(tconfdir, p...)
78+
79+
paths = ["jobs",
80+
"logs/jobs",
81+
"logs/runtimes",
82+
"storage/servers",
83+
"storage/execs",
84+
"storage/environments"]
85+
86+
for p in paths
87+
mkpath(config_path(p))
88+
end
89+
90+
redirect_stdin(devnull) do
91+
redirect_stderr(devnull) do
92+
redirect_stdout(devnull) do
93+
configure_local(; interactive = false)
94+
return t = @async julia_main()
95+
end
96+
end
97+
end
98+
99+
while !isalive(local_server())
100+
sleep(0.1)
101+
end
102+
end
103+
104+
105+
81106
# Run Literate on them all
82107
for file in literate_files
83108
# preprocess = file.example ? add_badges : identity

src/FileIO/wannier.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ function wan_parse_calculation(file)
8787
contents = split(file, "\n")
8888
end
8989
lines = map(contents) do l
90-
id = findfirst(isequal('!'), l)
90+
id = findfirst(x->isequal('!',x) ||isequal('#',x) , l)
9191
if id !== nothing
92-
l[1:id]
92+
l[1:id-1]
9393
else
9494
l
9595
end
@@ -150,13 +150,12 @@ function wan_parse_calculation(file)
150150
option = :ang
151151
end
152152
cell_param = Matrix{Float64}(undef, 3, 3)
153-
for i in 1:3
154-
cell_param[i, :] = parse_line(Float64, line)
153+
for j in 1:3
154+
cell_param[j, :] = parse_line(Float64, line)
155155
i += 1
156156
line = lines[i]
157157
end
158158
cell_block = InputData(:unit_cell_cart, option, Mat3(cell_param))
159-
# line = readline(f)
160159

161160
elseif block_name == :atoms_frac || block_name == :atoms_cart
162161
i += 1
@@ -202,7 +201,6 @@ function wan_parse_calculation(file)
202201
end
203202
end
204203
i += 1
205-
line = lines[i]
206204
end
207205
structure = extract_structure(cell_block, atoms_block, proj_block,
208206
get(flags, :spinors, false))

test/runtests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using DFControl, Test
22
using RemoteHPC: configure_local, julia_main
33

4-
# tconfdir = tempname()
5-
tconfdir = "/tmp/remotehpc"
4+
# tconfdir = "/tmp/remotehpc"
5+
tconfdir = tempname()
66
if ispath(tconfdir)
77
rm(tconfdir; recursive = true)
88
end

0 commit comments

Comments
 (0)