Merge branch 'master' into lammps-icms
Resolved Conflicts: src/REPLICA/verlet_split.cpp src/USER-OMP/fix_omp.cpp
This commit is contained in:
@ -9,7 +9,7 @@ doc/Section_python.html and in doc/Section_start.html#start_5.
|
||||
Basically you need to follow these steps in the src directory:
|
||||
|
||||
% make makeshlib # creates Makefile.shlib
|
||||
% make -f Makefile.shlib g++ # or whatever machine target you wish
|
||||
% make -f Makefile.shlib g++ # build for whatever machine target you wish
|
||||
% make install-python # may need to do this via sudo
|
||||
|
||||
You can replace the last step with running the python/install.py
|
||||
|
||||
@ -22,11 +22,6 @@ me = 0
|
||||
#nprocs = pypar.size()
|
||||
|
||||
from lammps import lammps
|
||||
from lammps import LMPINT as INT
|
||||
from lammps import LMPDOUBLE as DOUBLE
|
||||
from lammps import LMPIPTR as IPTR
|
||||
from lammps import LMPDPTR as DPTR
|
||||
from lammps import LMPDPTRPTR as DPTRPTR
|
||||
|
||||
lmp = lammps()
|
||||
|
||||
@ -36,9 +31,9 @@ lmp.file("in.demo")
|
||||
|
||||
if me == 0: print "\nPython output:"
|
||||
|
||||
natoms = lmp.extract_global("natoms",DOUBLE)
|
||||
mass = lmp.extract_atom("mass",DPTR)
|
||||
x = lmp.extract_atom("x",DPTRPTR)
|
||||
natoms = lmp.extract_global("natoms",0)
|
||||
mass = lmp.extract_atom("mass",2)
|
||||
x = lmp.extract_atom("x",3)
|
||||
print "Natoms, mass, x[0][0] coord =",natoms,mass[1],x[0][0]
|
||||
|
||||
temp = lmp.extract_compute("thermo_temp",0,0)
|
||||
@ -53,13 +48,13 @@ print "Velocity component from atom-style variable =",vy[1]
|
||||
natoms = lmp.get_natoms()
|
||||
print "Natoms from get_natoms =",natoms
|
||||
|
||||
xc = lmp.get_coords()
|
||||
print "Global coords from get_coords =",xc[0],xc[1],xc[31]
|
||||
xc = lmp.gather_atoms("x",1,3)
|
||||
print "Global coords from gather_atoms =",xc[0],xc[1],xc[31]
|
||||
|
||||
xc[0] = xc[0] + 1.0
|
||||
lmp.put_coords(xc)
|
||||
lmp.scatter_atoms("x",1,3,xc)
|
||||
|
||||
print "Changed x[0][0] via put_coords =",x[0][0]
|
||||
print "Changed x[0][0] via scatter_atoms =",x[0][0]
|
||||
|
||||
# uncomment if running in parallel via Pypar
|
||||
#print "Proc %d out of %d procs has" % (me,nprocs), lmp
|
||||
|
||||
@ -24,8 +24,8 @@ class lammps:
|
||||
# if name = "g++", load liblammps_g++.so
|
||||
|
||||
try:
|
||||
if not name: self.lib = CDLL("liblammps.so")
|
||||
else: self.lib = CDLL("liblammps_%s.so" % name)
|
||||
if not name: self.lib = CDLL("liblammps.so",RTLD_GLOBAL)
|
||||
else: self.lib = CDLL("liblammps_%s.so" % name,RTLD_GLOBAL)
|
||||
except:
|
||||
type,value,tb = sys.exc_info()
|
||||
traceback.print_exception(type,value,tb)
|
||||
@ -89,11 +89,11 @@ class lammps:
|
||||
self.lib.lammps_extract_compute.restype = POINTER(c_double)
|
||||
ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type)
|
||||
return ptr[0]
|
||||
elif type == 1:
|
||||
if type == 1:
|
||||
self.lib.lammps_extract_compute.restype = POINTER(c_double)
|
||||
ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type)
|
||||
return ptr
|
||||
elif type == 2:
|
||||
if type == 2:
|
||||
self.lib.lammps_extract_compute.restype = POINTER(POINTER(c_double))
|
||||
ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type)
|
||||
return ptr
|
||||
@ -110,11 +110,11 @@ class lammps:
|
||||
result = ptr[0]
|
||||
self.lib.lammps_free(ptr)
|
||||
return result
|
||||
elif type == 1:
|
||||
if type == 1:
|
||||
self.lib.lammps_extract_fix.restype = POINTER(c_double)
|
||||
ptr = self.lib.lammps_extract_fix(self.lmp,id,style,type,i,j)
|
||||
return ptr
|
||||
elif type == 2:
|
||||
if type == 2:
|
||||
self.lib.lammps_extract_fix.restype = POINTER(POINTER(c_double))
|
||||
ptr = self.lib.lammps_extract_fix(self.lmp,id,style,type,i,j)
|
||||
return ptr
|
||||
|
||||
Reference in New Issue
Block a user