LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Mailing List Archives
Re: [lammps-users] Running LAMMPS from PYTHON via python interface to Lammps
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lammps-users] Running LAMMPS from PYTHON via python interface to Lammps


From: Axel Kohlmeyer <akohlmey@...24...>
Date: Wed, 18 Oct 2017 14:09:14 -0400



On Wed, Oct 18, 2017 at 1:43 PM, Dundar Yilmaz <duy42@...122...> wrote:
Hi,

​first off. in the future, please consider this piece of mailing list etiquette:
if you want to write a post on a new topic. write a completely new e-mail. do *not* reply to a previous​ e-mail on a different topic and particularly do not reply to a digest e-mail leaving all the (pointless) other e-mails in your quoted body. remember, that you are e-mailing to hundreds of people that do not care about this quoted content (and neither do you). thanks for your consideration.


In a project I am trying to run lammps from python and between each simulation step I would like to do some analysis.
In a loop:
lmp=lammps()
for i in range(10000):
lmp.command(“ run 1”)
analysis_function ( lmp)

Assuming that analysis function wont take much time is it a good approach? Is there any overhead running lammps step by step?

​it is a decent approach. another approach would be using fix python to have a python function/variable called regularly during ​a run.
yes, there is overhead, but if you only do analysis and not any modification, you can use lmp.command("run 1 pre no post no") to significantly reduce the overhead. with "pre yes", you essentially repeat step 0, even though the data from the previous step is still valid.
 
I tested this for a very small system:

lmp.command(“ run 10000)

vs
for i in range(10000):
lmp.command(“run 1”)

Time spent for the latter case was three times of the first one.

To be more specific I would like to compare bonding information at each step to detect chemical reactions. If there is a way to access fix reax/bond data through lammps during the simulation
I could save it to a different variable and analyze it after the md simulation.

​that sounds like it would be simpler to do the whole analysis in post-processing.​

​axel.​

 

Thanks for your time.


Dundar Yilmaz, Ph. D.
Post Doctoral Researcher 
Department of Mechanical and Nuclear Engineering 
138 Research East Building 
Penn State University 
University Park, PA 16802





--
Dr. Axel Kohlmeyer  akohlmey@...24...  http://goo.gl/1wk0
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.