Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lammps
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
multiscale
lammps
Commits
79e142b2
Commit
79e142b2
authored
9 years ago
by
sjplimp
Browse files
Options
Downloads
Patches
Plain Diff
git-svn-id:
svn://svn.icms.temple.edu/lammps-ro/trunk@13511
f3b2605a-c512-4ea7-a41b-209d697bcdaa
parent
050244f2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/install.py
+9
-28
9 additions, 28 deletions
python/install.py
python/lammps.py
+7
-2
7 additions, 2 deletions
python/lammps.py
with
16 additions
and
30 deletions
python/install.py
+
9
−
28
View file @
79e142b2
...
...
@@ -3,42 +3,20 @@
# copy LAMMPS src/liblammps.so and lammps.py to system dirs
instructions
=
"""
Syntax: python install.py [-h]
[libdir]
[pydir]
lib
dir = target dir for
src/liblammps.so, default = /usr/local/lib
pydir = target dir for lammps.py,
default = Python site-packages dir
Syntax: python install.py [-h] [pydir]
py
dir = target dir for
lammps.py and liblammps.so
default = Python site-packages dir
"""
import
sys
,
os
,
commands
if
(
len
(
sys
.
argv
)
>
1
and
sys
.
argv
[
1
]
==
"
-h
"
)
or
len
(
sys
.
argv
)
>
3
:
if
(
len
(
sys
.
argv
)
>
1
and
sys
.
argv
[
1
]
==
"
-h
"
)
or
len
(
sys
.
argv
)
>
2
:
print
instructions
sys
.
exit
()
if
len
(
sys
.
argv
)
>=
2
:
libdir
=
sys
.
argv
[
1
]
else
:
libdir
=
"
/usr/local/lib
"
if
len
(
sys
.
argv
)
==
3
:
pydir
=
sys
.
argv
[
2
]
if
len
(
sys
.
argv
)
==
2
:
pydir
=
sys
.
argv
[
1
]
else
:
pydir
=
""
# copy C lib to libdir if it exists
# warn if not in LD_LIBRARY_PATH or LD_LIBRARY_PATH is undefined
if
not
os
.
path
.
isdir
(
libdir
):
print
"
ERROR: libdir %s does not exist
"
%
libdir
sys
.
exit
()
if
"
LD_LIBRARY_PATH
"
not
in
os
.
environ
:
print
"
WARNING: LD_LIBRARY_PATH undefined, cannot check libdir %s
"
%
libdir
else
:
libpaths
=
os
.
environ
[
'
LD_LIBRARY_PATH
'
].
split
(
'
:
'
)
if
libdir
not
in
libpaths
:
print
"
WARNING: libdir %s not in LD_LIBRARY_PATH
"
%
libdir
str
=
"
cp ../src/liblammps.so %s
"
%
libdir
print
str
outstr
=
commands
.
getoutput
(
str
)
if
len
(
outstr
.
strip
()):
print
outstr
# copy lammps.py to pydir if it exists
# if pydir not specified, install in site-packages via distutils setup()
...
...
@@ -50,6 +28,9 @@ if pydir:
print
str
outstr
=
commands
.
getoutput
(
str
)
if
len
(
outstr
.
strip
()):
print
outstr
str
=
"
cp ../src/liblammps.so %s
"
%
pydir
print
str
outstr
=
commands
.
getoutput
(
str
)
sys
.
exit
()
print
"
installing lammps.py in Python site-packages dir
"
...
...
@@ -59,7 +40,7 @@ os.chdir('../python') # in case invoked via make in src dir
from
distutils.core
import
setup
sys
.
argv
=
[
"
setup.py
"
,
"
install
"
]
# as if had run "python setup.py install"
setup
(
name
=
"
lammps
"
,
version
=
"
15
Aug12
"
,
version
=
"
15
May15
"
,
author
=
"
Steve Plimpton
"
,
author_email
=
"
sjplimp@sandia.gov
"
,
url
=
"
http://lammps.sandia.gov
"
,
...
...
This diff is collapsed.
Click to expand it.
python/lammps.py
+
7
−
2
View file @
79e142b2
...
...
@@ -15,16 +15,21 @@
import
sys
,
traceback
,
types
from
ctypes
import
*
from
os.path
import
dirname
,
abspath
,
join
from
inspect
import
getsourcefile
class
lammps
:
def
__init__
(
self
,
name
=
""
,
cmdargs
=
None
,
ptr
=
None
):
# determine module location
modpath
=
dirname
(
abspath
(
getsourcefile
(
lambda
:
0
)))
# load liblammps.so by default
# if name = "g++", load liblammps_g++.so
try
:
if
not
name
:
self
.
lib
=
CDLL
(
"
liblammps.so
"
,
RTLD_GLOBAL
)
else
:
self
.
lib
=
CDLL
(
"
liblammps_%s.so
"
%
name
,
RTLD_GLOBAL
)
if
not
name
:
self
.
lib
=
CDLL
(
join
(
modpath
,
"
liblammps.so
"
)
,
RTLD_GLOBAL
)
else
:
self
.
lib
=
CDLL
(
join
(
modpath
,
"
/
liblammps_%s.so
"
%
name
)
,
RTLD_GLOBAL
)
except
:
type
,
value
,
tb
=
sys
.
exc_info
()
traceback
.
print_exception
(
type
,
value
,
tb
)
...
...
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