Learning how to write script for lammps in python – LAMMPS Beginners

Good day to all,
I am trying to apply Monte Carlo method within the intervals of MD simulation.
Specifically, I am trying to write python code that could be invoked from lammps(or vice versa) so that I could add a new calculation method.

To begin with, I am currently running Lammps on Windows and trying to compile Python package with cmake. I read on the manual that Lammps library should be first built as “shared mode” which I heard that Windows isn’t capable of. Are there any ways to run Lammps with Python (or vice versa) on Windows?

Also,
I lack the knowledge of how the structures of the Python script should be. Are there any manuals like the Lammps Doc pages that I could possibly make use of while Python coding?

Please give me some advices or suggestions to “where should I start?”

My apologies in advance if any of my questions were not related to the community…
Thanks to all.


You heard wrong. Windows is very much capable of producing shared libraries. Just look at all the .dll files.

There is an entire chapter of the LAMMPS manual dedicated to using Python with LAMMPS
docs.lammps.org/Python_head.html

That would only be required if you want to call out to python from LAMMPS, otherwise you “just” need the LAMMPS python wrapper. There also is only a need to compile LAMMPS in case you want to use a specific, already installed python version. Otherwise, you can download a pre-compiled Windows binary package with its own Python included. All provided pre-compiled installer packages contain the LAMMPS shared library and are set up to integrate with an existing python installation.

There are explanations and some small examples in the LAMMPS manual and there are additional examples in the LAMMPS source distribution in the LAMMPS python/examples and examples/python folders (the former has examples for the LAMMPS python module, the latter for calling out to python with the LAMMPS PYTHON package features).

Thanks for your answers.

I am once again indebted to you.

Read more here: Source link