diff --git a/Project.toml b/Project.toml index cbda28f..28614a8 100644 --- a/Project.toml +++ b/Project.toml @@ -7,12 +7,14 @@ version = "0.7.2" CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82" LAMMPS_jll = "5b3ab26d-9607-527c-88ea-8fe5ba57cafe" Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" -Preferences = "21216c6a-2e73-6563-6e65-726566657250" +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195" +OpenBLAS32_jll = "656ef2d0-ae68-5445-9ca0-591084a874a2" +Preferences = "21216c6a-2e73-6563-6e65-726566657250" [compat] CEnum = "0.4, 0.5" LAMMPS_jll = "2.6.0" -Preferences = "1" MPI = "0.20" +Preferences = "1" julia = "1.10" diff --git a/src/LAMMPS.jl b/src/LAMMPS.jl index 7516d9d..ea0c82d 100644 --- a/src/LAMMPS.jl +++ b/src/LAMMPS.jl @@ -1,5 +1,8 @@ module LAMMPS import MPI +import LinearAlgebra +import OpenBLAS32_jll + include("api.jl") export LMP, command, create_atoms, get_natoms, extract_atom, extract_compute, extract_global, @@ -84,6 +87,12 @@ const TAGINT = API.lammps_extract_setting(C_NULL, "tagint") == 4 ? Int32 : Int64 const IMAGEINT = API.lammps_extract_setting(C_NULL, "imageint") == 4 ? Int32 : Int64 function __init__() + # LAMMPS requires using LP64, default to OpenBLAS32 if not already available + config = LinearAlgebra.BLAS.lbt_get_config() + if !any(lib -> lib.interface == :lp64, config.loaded_libs) + LinearAlgebra.BLAS.lbt_forward(OpenBLAS32_jll.libopenblas_path) + end + BIGINT != (API.lammps_extract_setting(C_NULL, "bigint") == 4 ? Int32 : Int64) && error("The size of the LAMMPS integer type BIGINT has changed! To fix this, you need to manually invalidate the LAMMPS.jl cache.") TAGINT != (API.lammps_extract_setting(C_NULL, "tagint") == 4 ? Int32 : Int64) &&