> Personally, a rewrite of the python module would be helpful for me,
I'm not sure what you have in mind, but the python/lammps.py file
(Python wrapper) is meant to simply wrap the C interface to
LAMMPS, provided in src/library.cpp/h.
I'm sorry, I do realize that. Actually that's what I wrote previously but
it got lost
in the hyperspace and it looks like I didn't cc lammps-users, sorry for
that.
If you want to add more functions to library.cpp (and add
the wrap function to lammps.py), then great.
That's exactly what I have in mind
If you want to add more external Python-based tools
that use python/lammps.py to access LAMMPS, then great.
But if you want to change lammps.py, then I don't see
why that would be necessary or useful. It's functional and complete
for anything that LAMMPS exposes thru its lib interface.
I think that the problem is the lib interface. In case it got lost, I'll
quote what I
wrote previously as an example
"""
I will give an (extremely naïve) example: lammps has, as you know, a run
method, implemented in run.cpp
<https://github.com/lammps/lammps/blob/master/src/run.cpp>. It does a whole
bunch of syntax-checking stuff and then it goes to the run itself. Then it
does the run itself, a bit more checks ,an initialization, etc. But what if
I want to do a run from any other code (say python, for example). The
problem is that I don't have the run part isolated, so I have to either
call every method or use an interface to the "run". There is currently no
interface to the run method, the only way I can run is through the
"command" method, so I have to call this in my code:
lmp.command("run 1000")
which i don't like. I can define this method [which i have done]:
def run(self, Nsteps): """ Wrapper for the "run" command in
lammps """ self.lmp.command("run {ns}".format(ns=Nsteps))
but once again, using Python as a wrapper to a scripting language written
in c++ embedded in LAMMPS sourcecode. well, doesn't /feel/ right.
Just imagine how this works when you want to compute something and extract
its value for post-processing on the fly.
I insist, bottomline it's a matter of taste, I think it is an extremely
convoluted way, but I admit it does work.
"""
And it uses ctypes which is included in Python and is much
simpler than SWIG which Andrew raised as an idea.
I agree, ctypes > SWIG