Skip to content

Commit

Permalink
Merge branch 'neighlist' of github.com:Joroks/LAMMPS.jl into neighlist
Browse files Browse the repository at this point in the history
  • Loading branch information
Joroks committed Sep 5, 2024
2 parents 832331e + 2012847 commit b09a459
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 34 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*.jl.mem

Manifest.toml
LocalPreferences.toml

# generated docs
docs/build/
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "LAMMPS"
uuid = "ee2e13b9-eee9-4449-aafa-cfa6a2dbe14d"
authors = ["Valentin Churavy <[email protected]>"]
version = "0.7.1"
version = "0.7.2"

[deps]
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
Expand All @@ -12,7 +12,7 @@ MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"

[compat]
CEnum = "0.4, 0.5"
LAMMPS_jll = "2.5"
LAMMPS_jll = "2.6.0"
Preferences = "1"
MPI = "0.20"
julia = "1.8"
22 changes: 11 additions & 11 deletions res/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ version = "0.5.0"

[[Clang]]
deps = ["CEnum", "Clang_jll", "Downloads", "Pkg", "TOML"]
git-tree-sha1 = "c67b4867f04eba5b202e010fa4cdff817549d69c"
git-tree-sha1 = "aa03729cc19fc581d21b33c7b4a1bab5c96f6345"
repo-rev = "master"
repo-url = "https://github.com/JuliaInterop/Clang.jl.git"
uuid = "40e3b903-d033-50b4-a0cc-940c62c95e31"
Expand Down Expand Up @@ -48,25 +48,25 @@ uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"

[[Hwloc_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "ca0f6bf568b4bfc807e7537f081c81e35ceca114"
git-tree-sha1 = "5e19e1e4fa3e71b774ce746274364aef0234634e"
uuid = "e33a78d0-f292-5ffc-b300-72abe9b543c8"
version = "2.10.0+0"
version = "2.11.1+0"

[[InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

[[JLLWrappers]]
deps = ["Artifacts", "Preferences"]
git-tree-sha1 = "7e5d6779a1e09a36db2a7b6cff50942a0a7d0fca"
git-tree-sha1 = "f389674c99bfcde17dc57454011aa44d5a260a40"
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
version = "1.5.0"
version = "1.6.0"

[[LAMMPS_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "MPICH_jll", "MPIPreferences", "MPItrampoline_jll", "MicrosoftMPI_jll", "OpenMPI_jll", "TOML"]
git-tree-sha1 = "f3437b3282fa653f1abb9632cdeca53013194bc8"
git-tree-sha1 = "088be028d89853390a3f4eaf36d459a78ac843e5"
uuid = "5b3ab26d-9607-527c-88ea-8fe5ba57cafe"
version = "2.5.0+0"
version = "2.6.0+0"

[[LazyArtifacts]]
deps = ["Artifacts", "Pkg"]
Expand Down Expand Up @@ -104,9 +104,9 @@ uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"

[[MPICH_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Hwloc_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "MPIPreferences", "TOML"]
git-tree-sha1 = "4099bb6809ac109bfc17d521dad33763bcf026b7"
git-tree-sha1 = "19d4bd098928a3263693991500d05d74dbdc2004"
uuid = "7cb0a576-ebde-5e09-9194-50597f1243b4"
version = "4.2.1+1"
version = "4.2.2+0"

[[MPIPreferences]]
deps = ["Libdl", "Preferences"]
Expand Down Expand Up @@ -145,9 +145,9 @@ version = "1.2.0"

[[OpenMPI_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Hwloc_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "MPIPreferences", "TOML", "Zlib_jll"]
git-tree-sha1 = "a9de2f1fc98b92f8856c640bf4aec1ac9b2a0d86"
git-tree-sha1 = "bfce6d523861a6c562721b262c0d1aaeead2647f"
uuid = "fe0851c0-eecd-5654-98d4-656369965a5c"
version = "5.0.3+0"
version = "5.0.5+0"

[[Pkg]]
deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
Expand Down
11 changes: 11 additions & 0 deletions src/LAMMPS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ function __init__()
error("The size of the LAMMPS integer type TAGINT has changed! To fix this, you need to manually invalidate the LAMMPS.jl cache.")
IMAGEINT != (API.lammps_extract_setting(C_NULL, "tagint") == 4 ? Int32 : Int64) &&
error("The size of the LAMMPS integer type IMAGEINT has changed! To fix this, you need to manually invalidate the LAMMPS.jl cache.")

if API.lammps_config_has_mpi_support() == 0
@warn "The currently loaded LAMMPS installation does not have MPI enabled! \n" *
"Please provide your own LAMMPS installation with `LAMMPS.set_library()` if you \n" *
"want to run LAMMPS in parallel using MPI."
end

if API.lammps_config_has_exceptions() == 0
@warn "The currently loaded LAMMPS installation doesn't have exceptions enabled! \n" *
"This causes the REPL to crash whenever LAMMPS encounters an error."
end
end


Expand Down
65 changes: 47 additions & 18 deletions src/api.jl
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,18 @@ function lammps_extract_global(handle, name)
ccall((:lammps_extract_global, liblammps), Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cchar}), handle, name)
end

function lammps_extract_pair_dimension(handle, name)
ccall((:lammps_extract_pair_dimension, liblammps), Cint, (Ptr{Cvoid}, Ptr{Cchar}), handle, name)
end

function lammps_extract_pair(handle, name)
ccall((:lammps_extract_pair, liblammps), Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cchar}), handle, name)
end

function lammps_map_atom(handle, id)
ccall((:lammps_map_atom, liblammps), Cint, (Ptr{Cvoid}, Ptr{Cvoid}), handle, id)
end

function lammps_extract_atom_datatype(handle, name)
ccall((:lammps_extract_atom_datatype, liblammps), Cint, (Ptr{Cvoid}, Ptr{Cchar}), handle, name)
end
Expand All @@ -151,24 +163,36 @@ function lammps_extract_atom(handle, name)
ccall((:lammps_extract_atom, liblammps), Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cchar}), handle, name)
end

function lammps_extract_compute(handle, arg2, arg3, arg4)
ccall((:lammps_extract_compute, liblammps), Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cchar}, Cint, Cint), handle, arg2, arg3, arg4)
function lammps_extract_compute(handle, id, style, type)
ccall((:lammps_extract_compute, liblammps), Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cchar}, Cint, Cint), handle, id, style, type)
end

function lammps_extract_fix(handle, arg2, arg3, arg4, arg5, arg6)
ccall((:lammps_extract_fix, liblammps), Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cchar}, Cint, Cint, Cint, Cint), handle, arg2, arg3, arg4, arg5, arg6)
function lammps_extract_fix(handle, id, style, type, nrow, ncol)
ccall((:lammps_extract_fix, liblammps), Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cchar}, Cint, Cint, Cint, Cint), handle, id, style, type, nrow, ncol)
end

function lammps_extract_variable(handle, arg2, arg3)
ccall((:lammps_extract_variable, liblammps), Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cchar}, Ptr{Cchar}), handle, arg2, arg3)
function lammps_extract_variable(handle, name, group)
ccall((:lammps_extract_variable, liblammps), Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cchar}, Ptr{Cchar}), handle, name, group)
end

function lammps_extract_variable_datatype(handle, name)
ccall((:lammps_extract_variable_datatype, liblammps), Cint, (Ptr{Cvoid}, Ptr{Cchar}), handle, name)
end

function lammps_set_variable(arg1, arg2, arg3)
ccall((:lammps_set_variable, liblammps), Cint, (Ptr{Cvoid}, Ptr{Cchar}, Ptr{Cchar}), arg1, arg2, arg3)
function lammps_set_variable(handle, name, str)
ccall((:lammps_set_variable, liblammps), Cint, (Ptr{Cvoid}, Ptr{Cchar}, Ptr{Cchar}), handle, name, str)
end

function lammps_set_string_variable(handle, name, str)
ccall((:lammps_set_string_variable, liblammps), Cint, (Ptr{Cvoid}, Ptr{Cchar}, Ptr{Cchar}), handle, name, str)
end

function lammps_set_internal_variable(handle, name, value)
ccall((:lammps_set_internal_variable, liblammps), Cint, (Ptr{Cvoid}, Ptr{Cchar}, Cdouble), handle, name, value)
end

function lammps_variable_info(handle, idx, buf, bufsize)
ccall((:lammps_variable_info, liblammps), Cint, (Ptr{Cvoid}, Cint, Ptr{Cchar}, Cint), handle, idx, buf, bufsize)
end

function lammps_gather_atoms(handle, name, type, count, data)
Expand Down Expand Up @@ -259,32 +283,37 @@ function lammps_get_os_info(buffer, buf_size)
ccall((:lammps_get_os_info, liblammps), Cvoid, (Ptr{Cchar}, Cint), buffer, buf_size)
end

# no prototype is found for this function at library.h:233:5, please use with caution
# no prototype is found for this function at library.h:241:5, please use with caution
function lammps_config_has_mpi_support()
ccall((:lammps_config_has_mpi_support, liblammps), Cint, ())
end

# no prototype is found for this function at library.h:234:5, please use with caution
# no prototype is found for this function at library.h:242:5, please use with caution
function lammps_config_has_gzip_support()
ccall((:lammps_config_has_gzip_support, liblammps), Cint, ())
end

# no prototype is found for this function at library.h:235:5, please use with caution
# no prototype is found for this function at library.h:243:5, please use with caution
function lammps_config_has_png_support()
ccall((:lammps_config_has_png_support, liblammps), Cint, ())
end

# no prototype is found for this function at library.h:236:5, please use with caution
# no prototype is found for this function at library.h:244:5, please use with caution
function lammps_config_has_jpeg_support()
ccall((:lammps_config_has_jpeg_support, liblammps), Cint, ())
end

# no prototype is found for this function at library.h:237:5, please use with caution
# no prototype is found for this function at library.h:245:5, please use with caution
function lammps_config_has_ffmpeg_support()
ccall((:lammps_config_has_ffmpeg_support, liblammps), Cint, ())
end

# no prototype is found for this function at library.h:238:5, please use with caution
# no prototype is found for this function at library.h:246:5, please use with caution
function lammps_config_has_curl_support()
ccall((:lammps_config_has_curl_support, liblammps), Cint, ())
end

# no prototype is found for this function at library.h:247:5, please use with caution
function lammps_config_has_exceptions()
ccall((:lammps_config_has_exceptions, liblammps), Cint, ())
end
Expand All @@ -293,7 +322,7 @@ function lammps_config_has_package(arg1)
ccall((:lammps_config_has_package, liblammps), Cint, (Ptr{Cchar},), arg1)
end

# no prototype is found for this function at library.h:241:5, please use with caution
# no prototype is found for this function at library.h:250:5, please use with caution
function lammps_config_package_count()
ccall((:lammps_config_package_count, liblammps), Cint, ())
end
Expand All @@ -306,7 +335,7 @@ function lammps_config_accelerator(arg1, arg2, arg3)
ccall((:lammps_config_accelerator, liblammps), Cint, (Ptr{Cchar}, Ptr{Cchar}, Ptr{Cchar}), arg1, arg2, arg3)
end

# no prototype is found for this function at library.h:245:5, please use with caution
# no prototype is found for this function at library.h:254:5, please use with caution
function lammps_has_gpu_device()
ccall((:lammps_has_gpu_device, liblammps), Cint, ())
end
Expand Down Expand Up @@ -339,7 +368,7 @@ function lammps_id_name(arg1, arg2, arg3, arg4, arg5)
ccall((:lammps_id_name, liblammps), Cint, (Ptr{Cvoid}, Ptr{Cchar}, Cint, Ptr{Cchar}, Cint), arg1, arg2, arg3, arg4, arg5)
end

# no prototype is found for this function at library.h:256:5, please use with caution
# no prototype is found for this function at library.h:265:5, please use with caution
function lammps_plugin_count()
ccall((:lammps_plugin_count, liblammps), Cint, ())
end
Expand Down Expand Up @@ -415,7 +444,7 @@ function lammps_get_last_error_message(handle, buffer, buf_size)
ccall((:lammps_get_last_error_message, liblammps), Cint, (Ptr{Cvoid}, Ptr{Cchar}, Cint), handle, buffer, buf_size)
end

# no prototype is found for this function at library.h:299:5, please use with caution
# no prototype is found for this function at library.h:308:5, please use with caution
function lammps_python_api_version()
ccall((:lammps_python_api_version, liblammps), Cint, ())
end
Expand Down
6 changes: 4 additions & 2 deletions test/mpitest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ using MPI
MPI.Init()

LMP(["-screen", "none"], MPI.COMM_WORLD) do lmp
@test LAMMPS.version(lmp) >= 0
extract_setting(lmp, "world_size") == 2 || MPI.Abort(MPI.COMM_WORLD, 1)
command(lmp, "clear")
end
end

MPI.Finalize()
6 changes: 5 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -378,4 +378,8 @@ end
end
end

@test success(pipeline(`$(MPI.mpiexec()) -n 2 $(Base.julia_cmd()) mpitest.jl`, stderr=stderr, stdout=stdout))
if !Sys.iswindows()
@testset "MPI" begin
@test success(pipeline(`$(MPI.mpiexec()) -n 2 $(Base.julia_cmd()) mpitest.jl`, stderr=stderr, stdout=stdout))
end
end

0 comments on commit b09a459

Please sign in to comment.