Skip to content

Commit

Permalink
Merge branch 'release-0.1.11'
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiq committed Nov 12, 2024
2 parents 319157b + 0d4c795 commit 585d8bd
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Packmol"
uuid = "6cdf86f9-9676-4cea-a42d-19f9a563443f"
authors = ["Leandro Martinez <[email protected]> and contributors"]
version = "0.1.11-DEV"
version = "0.2.0-DEV"

[deps]
CellListMap = "69e1c6dd-3888-40e6-b3c8-31ac5f578864"
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ julia> import Pkg; Pkg.activate("Packmol"; shared=true); Pkg.update()

(or type `] activate @Packmol` and then `] up`, at the `julia>` prompt).

Additionally, it is possible to disable the loading of the file-dialog machinery
by setting the system environment variable `PACKMOL_GUI="false"`. This might be
important to run packmol through this interface in computers without a GUI.






26 changes: 18 additions & 8 deletions src/packmol_runner.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Packmol_jll
import NativeFileDialog

packmol_runner = Packmol_jll.packmol()

Expand All @@ -15,7 +14,9 @@ pre-compiled binary. The input file is a text file with the same syntax as
the packmol input files.
If no input file is provided, a file explorer will be opened to choose the
input file.
input file.
To disable the file explorer, set the environment variable `PACKMOL_GUI="false"`.
"""
function run_packmol end
Expand Down Expand Up @@ -51,12 +52,6 @@ function run_packmol(input_file::String)
return nothing
end

@doc (@doc run_packmol)
function run_packmol()
input_file = NativeFileDialog.pick_file()
run_packmol(input_file)
end

@testitem "run_packmol" begin
using Packmol
test_dir = Packmol.src_dir*"/../test/run_packmol"
Expand All @@ -70,4 +65,19 @@ end
@test isfile("water_box.pdb")
end

@static if haskey(ENV, "PACKMOL_GUI") && ENV["PACKMOL_GUI"] == "false"
function run_packmol()
throw(ArgumentError("""\n
Environment variable PACKMOL_GUI is set to false. Set it to true to use the file dialog.
"""))
end
else
import NativeFileDialog
@doc (@doc run_packmol)
function run_packmol()
input_file = NativeFileDialog.pick_file()
run_packmol(input_file)
end
end

0 comments on commit 585d8bd

Please sign in to comment.