Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lammps_tutorial
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cchiang2
lammps_tutorial
Commits
ccb3e47a
Commit
ccb3e47a
authored
3 months ago
by
s1309877
Browse files
Options
Downloads
Patches
Plain Diff
Update script to compile the LAMMPS executable and shared library separately
parent
9b667297
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lammps/install.sh
+29
-22
29 additions, 22 deletions
lammps/install.sh
with
29 additions
and
22 deletions
lammps/install.sh
+
29
−
22
View file @
ccb3e47a
...
...
@@ -189,42 +189,49 @@ cp ${src_dir}/bond_harmlj.* ${lmp_src_dir}/MOLECULE
}
function
build
()
{
mkdir
-p
$lmp_build_dir
cd
$lmp_build_dir
# Build the executable
mkdir
-p
$lmp_build_dir
/exe
cd
$lmp_build_dir
/exe
if
[[
$is_macos
==
1
]]
;
then
cmake ../cmake/
-D
LAMMPS_MACHINE
=
serial
-D
BUILD_EXE
=
yes
-D
BUILD_MPI
=
no
-D
BUILD_OMP
=
yes
-D
BUILD_SHARED_LIBS
=
yes
-D
BUILD_LIB
=
yes
-D
PKG_MOLECULE
=
yes
-D
PKG_OPENMP
=
yes
-D
OpenMP_C_FLAGS
=
"
${
compile_flags
}
"
-D
OpenMP_CXX_FLAGS
=
"
${
compile_flags
}
"
-D
OpenMP_CXX_LIB_NAMES
=
"libomp"
-D
OpenMP_libomp_LIBRARY
=
"
${
omp_dylib
}
"
-D
CMAKE_SHARED_LINKER_FLAGS
=
"
${
link_flags
}
"
cmake
../
../cmake/
-D
LAMMPS_MACHINE
=
serial
-D
BUILD_EXE
=
yes
-D
BUILD_MPI
=
no
-D
BUILD_OMP
=
yes
-D
BUILD_SHARED_LIBS
=
no
-D
BUILD_LIB
=
no
-D
PKG_MOLECULE
=
yes
-D
PKG_OPENMP
=
yes
-D
OpenMP_C_FLAGS
=
"
${
compile_flags
}
"
-D
OpenMP_CXX_FLAGS
=
"
${
compile_flags
}
"
-D
OpenMP_CXX_LIB_NAMES
=
"libomp"
-D
OpenMP_libomp_LIBRARY
=
"
${
omp_dylib
}
"
-D
CMAKE_SHARED_LINKER_FLAGS
=
"
${
link_flags
}
"
else
cmake ../cmake/
-D
LAMMPS_MACHINE
=
serial
-D
BUILD_EXE
=
yes
-D
BUILD_MPI
=
no
-D
BUILD_OMP
=
yes
-D
BUILD_SHARED_LIBS
=
yes
-D
BUILD_LIB
=
yes
-D
PKG_MOLECULE
=
yes
-D
PKG_OPENMP
=
yes
-D
CMAKE_C_FLAGS
=
"
${
compile_flags
}
"
-D
CMAKE_CXX_FLAGS
=
"
${
compile_flags
}
"
-D
CMAKE_SHARED_LINKER_FLAGS
=
"
${
link_flags
}
"
-D
CMAKE_EXE_LINKER_FLAGS
=
"
${
link_flags
}
"
cmake ../../cmake/
-D
LAMMPS_MACHINE
=
serial
-D
BUILD_EXE
=
yes
-D
BUILD_MPI
=
no
-D
BUILD_OMP
=
yes
-D
BUILD_SHARED_LIBS
=
no
-D
BUILD_LIB
=
no
-D
PKG_MOLECULE
=
yes
-D
PKG_OPENMP
=
yes
-D
CMAKE_C_FLAGS
=
"
${
compile_flags
}
"
-D
CMAKE_CXX_FLAGS
=
"
${
compile_flags
}
"
-D
CMAKE_SHARED_LINKER_FLAGS
=
"
${
link_flags
}
"
-D
CMAKE_EXE_LINKER_FLAGS
=
"
${
link_flags
}
"
fi
make
-j
$nproc
cp
${
lmp_build_dir
}
/exe/lmp_serial
$out_dir
chmod
+x
${
out_dir
}
/lmp_serial
if
[[
$keep_lmp_build
==
0
]]
;
then
rm
-r
${
lmp_build_dir
}
/exe
fi
# Build the shared library
mkdir
-p
${
lmp_build_dir
}
/share
cd
${
lmp_build_dir
}
/share
if
[[
$is_macos
==
1
]]
;
then
cmake ../../cmake/
-D
LAMMPS_MACHINE
=
serial
-D
BUILD_EXE
=
no
-D
BUILD_MPI
=
no
-D
BUILD_OMP
=
yes
-D
BUILD_SHARED_LIBS
=
yes
-D
BUILD_LIB
=
yes
-D
PKG_MOLECULE
=
yes
-D
PKG_OPENMP
=
yes
-D
OpenMP_C_FLAGS
=
"
${
compile_flags
}
"
-D
OpenMP_CXX_FLAGS
=
"
${
compile_flags
}
"
-D
OpenMP_CXX_LIB_NAMES
=
"libomp"
-D
OpenMP_libomp_LIBRARY
=
"
${
omp_dylib
}
"
-D
CMAKE_SHARED_LINKER_FLAGS
=
"
${
link_flags
}
"
else
cmake ../../cmake/
-D
LAMMPS_MACHINE
=
serial
-D
BUILD_EXE
=
no
-D
BUILD_MPI
=
no
-D
BUILD_OMP
=
yes
-D
BUILD_SHARED_LIBS
=
yes
-D
BUILD_LIB
=
yes
-D
PKG_MOLECULE
=
yes
-D
PKG_OPENMP
=
yes
-D
CMAKE_C_FLAGS
=
"
${
compile_flags
}
"
-D
CMAKE_CXX_FLAGS
=
"
${
compile_flags
}
"
-D
CMAKE_SHARED_LINKER_FLAGS
=
"
${
link_flags
}
"
-D
CMAKE_EXE_LINKER_FLAGS
=
"
${
link_flags
}
"
fi
make
-j
$nproc
cd
$sh_dir
}
function
create_program
()
{
if
[[
$is_macos
==
1
]]
;
then
cp
${
lmp_build_dir
}
/liblammps_serial.dylib
$out_dir
chmod
+x
${
out_dir
}
/liblammps_serial.dylib
ln
-s
${
out_dir
}
/liblammps_serial.dylib
${
out_dir
}
/liblammps_serial.dylib.0
cp
${
lmp_build_dir
}
/share/liblammps_serial.dylib
${
out_dir
}
/liblammps.dylib
chmod
+x
${
out_dir
}
/liblammps.dylib
else
cp
${
lmp_build_dir
}
/liblammps_serial.so
$out_dir
chmod
+x
${
out_dir
}
/liblammps_serial.so
ln
-s
${
out_dir
}
/liblammps_serial.so
${
out_dir
}
/liblammps_serial.so.0
cp
${
lmp_build_dir
}
/share/liblammps_serial.so
${
out_dir
}
/liblammps.so
chmod
+x
${
out_dir
}
/liblammps.so
fi
cp
-r
${
lmp_dir
}
/python
$out_dir
cp
${
lmp_build_dir
}
/lmp_serial
$out_dir
chmod
+x
${
out_dir
}
/lmp_serial
}
function
clean_up
()
{
if
[[
$keep_lmp_build
==
0
]]
;
then
rm
-r
${
lmp_build_dir
}
/share
rm
-r
$lmp_dir
fi
cd
$sh_dir
}
extract
&&
build
&&
create_program
&&
clean_up
build
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment