[lammps-users] coupling lammps to in-house code

Hi

I want to couple lammps to in-house code. I normally run my lammps (unmodified) simulations in parallel. While retaining parallel functioning, is it possible to execute in-house code in a serial fashion and lammps code in parallel or is it mandatory that in-house code has to run in parallel too?

Thanks in advance

regards

Chetan

It depends on what you mean by "couple". See
section 4.10 of the manual for several options.
If you have your own code and want to call
LAMMPS from it as a library, then you can do
whatever you want. I.e. your code can run
in serial or parallel.

Steve

Hi Steve

Thanks.
In this coupling, I am going to calculate forces on some molecules using
semi-quantum mechanical (valence bond) treatment upon which at some steps,
there will be changes in the bond topology, in addition to the forces on all
molecules using LAMMPS. So after going through coupling section in lammps
manual, it seems like this would involve defining a new fix or a command
which would be invoked every timestep. I guess this means, my self-written
code has to be parallelized, if I want to run a lammps in parallel. (since
the option of calling lammps as a library is ruled out)

Could you confirm this guess please? We are in the process of preparing a
logistics for this.

Thanks very much in advance
Chetan

You might want to look at section 4.10 of the manual
which discusses different coupling strategies. Basically
you have to decide if your code is going to call LAMMPS
or vice versa (e.g. thru a fix). In the latter case, if LAMMPS
is running in parallel, then each proc will typically call your code/library.
Whether your code/lib does something additional in parallel or not
is up to you.

Steve

Chetan,
We have found a linux platform solution to integrate LAMMPS output with our in-house analysis scripts. Essentially, we view the job as two related components:
1- lammps crunches through md steps, spitting out useful info (coords, energies, whatever)
2 - our analysis scripts take the info from 1 to do post-analysis
Of course, the crudest way to do this is to dump lammps output of interest into a file and then have your analysis scripts read from the dump file. This method quickly becomes impractical as the file size of the dump file limits the amount of averaging that can reasonably be done.
Our solution to this is to create a named pipe (see the mkfifo command) before running lammps and specifying this named pipe as the dump file in your lammps input script. As lammps runs, it is piping the output to this named pipe (like a phantom file). You can simultaneously run your in-house analysis script with stdin redirected from the named pipe. (In your in-house analysis script, just read from stdin stream). The result is that your script reads in the lammps output without that output ever going to a fixed file. Hope this helps,

Chris