Packmol.jl

Currently this Julia package serves as a multi-platform runner for packmol. In the future this will be an independent package with a faster and improved version of the Packmol package.

Installation

Install the latest Julia version in your system, with juliaup

Interactive use

Install the Packmol package within Julia:

julia> import Pkg; Pkg.add("Packmol")

Run packmol in your input file with:

julia> using Packmol

julia> run_packmol()

This will open a file browser, from which you can choose the input file for packmol. Packmol will run immediately once the file is open.

Alternatively, you can provide the path to the file explicitly, with:

julia> run_packmol(raw"C:\users\my_user\my_files\my_input_file.inp")

Command line interface

Install the packmol app with:

julia -e 'import Pkg; Pkg.Apps.add("Packmol")'

Add the directory of julia binaries ($HOME/.julia/bin) to your path, and use packmol with:

packmol -i input.inp

as a standalone application.

Updating

To keep Packmol up-to-date, use:

julia> import Pkg; Pkg.update()

(or type ] 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.

See also

MolSimToolkit.jl/Packmol-Input-Creator

Reference

Packmol.run_packmolFunction
run_packmol()
run_packmol(input_file::String)

Runs the packmol executable with the input file input_file. This will run the classical http://m3g.iqm.unicamp.br/packmol program, which is a 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.

To disable the file explorer, set the environment variable PACKMOL_GUI="false".

source
Packmol.pack_monoatomic!Function
pack_monoatomic!(positions::AbstractVector{<:SVector{N,T}}, unitcell, tol)

Pack a monoatomic system with iniital positions x and distance tolerance tol, into the unitcell defined by unitcell, considering periodic boundary conditions.

The unitcell can be a vector, in the case of orthorhombic cells, or a matrix, in the case of triclinic cells.

The coordinates and the unitcells can be two- or three-dimensional.

Example

julia> using Packmol, StaticArrays

julia> coordinates = 100 * rand(SVector{3,Float64}, 10^5);

julia> unitcell = [100.0, 100.0, 100.0]; tolerance = 2.0;

julia> pack_monoatomic!(coordinates, unitcell, tolerance)

After packing, the coordinates array will have updated positions for the atoms without overlaps.

source