Re: [Phonopy-users] Building lammps as a library of phonopy
Brought to you by:
atztogo
|
From: Atz T. <atz...@gm...> - 2010-06-30 02:48:40
|
Hi,
It is difficult for me to answer, because I don't know lammps.
I know at least I have to prepare the document for the phonopy module,
but unfortunately I don't have enough time to do it now. If you want
to start it right now, please read phonopy/__init__.py, and
script/phonopy is an example of usage of __init__.py. Also you may
find some feeling from example/ase/*.
Togo
2010/6/30 Xiaoliang Zhang <zha...@ie...>:
> Dear Togo,
>
> I want to use lammps to generate "FORCES" file for phonopy computation, so I
> want to build lammps as a libarary of phonopy.
>
>
>
> According to the following materials, I do it step by step.
>
>
>
> First, in lammps/src, through the command of "make makelib" and "make -f
> Makefile.lib g++" to get the file "liblmp_g++.a"
>
> Second, I think I have to modify the "setup.py" in phonopy to extend lammps
> as a library of phonopy.
>
> In setup.py file, I add the following codes:
>
>
>
> extension_lammps = Extension('phonopy.lammps',
> include_dirs = ['/home_soft/home/dwtang/lammps/src/'],
> library_dirs = ['/home_soft/home/dwtang/lammps/src/'],
> sources =
> ['/home_soft/home/dwtang/lammps/src/library.cpp'],
> libraries = ['lmp_g++'])
>
> I don't know if the codes are right.
>
>
>
> And according to the first material in the following, I think I have to
> extend MPI in setup.py, but I don't know how to add it into setup.py file.
>
> I try to add it like this:
>
> extension_mpi = Extension('phonopy.mpi',
> include_dirs =
> ['/home_soft/soft/x86_64/mpi/openmpi/1.3.3/include/openmpi/ompi/mpi/cxx'],
> library_dirs =
> ['/home_soft/soft/x86_64/mpi/openmpi/1.3.3/lib'],
> libraries = ['mpi'])
>
> (under the include_dirs, there is a "mpi.h" file; under the library_dirs,
> there is a "libmpi.a" file)
>
> I also modify the ext_modules as
>
> ext_modules = [extension, extension_spglib, extension_lammps,
> extension_mpi]
> but it not work when I execute "python setup.py install --home=."
>
>
>
> Please see the following materials and give me some suggestions, thanks
>
>
>
> Python wrapping of LAMMPS (from Steve Plimpton's "Quick Tutorial on
> Modifying/Extending LAMMPS" )
>
> • Use Python ctypes (2.5 or later) to wrap C-interface in src/library.h
>
> • Build LAMMPS (and MPI, FFTW, etc) as shared library via setup.py
>
> • Can instantiate one or more LAMMPS:
>
> invoke LAMMPS scripts or commands from Python
>
> grab/change atom coords or other properties, etc
>
>>>> from lammps import lammps
>
>>>> lmp = lammps(sys.argv)
>
>>>> lmp.file(“in.lj”)
>
>>>> lmp.command(“run 1000”)
>
>>>> del lammps
>
> def file(self,file):
>
> self.lib.lammps_file(self.lmp,file)
>
> def command(self,cmd):
>
> self.lib.lammps_command(self.lmp,cmd)
>
> • Extend by adding to 2 files: src/library.cpp and python/lammps.py
>
> • Could wrap LAMMPS in a GUI or do Python-based viz
>
> • Can run in parallel, if your Python is extended with MPI (e.g. PyPar)
>
>
>
>
>
> 2.4 Building LAMMPS as a library can be
> seen http://lammps.sandia.gov/doc/Section_start.html
>
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Phonopy-users mailing list
> Pho...@li...
> https://lists.sourceforge.net/lists/listinfo/phonopy-users
>
>
--
Atsushi Togo
http://atztogo.users.sourceforge.net/
atz...@gm...
|