Invoke lammsp calculation after a Matlab/c++/Fortran evaluation

Hi LAMMPS users,

I meet a problem in which the evaluation requires three separated packages. The first package, as shown in following image, is a Molecular Dynamics (MD) program. The second one is a Quantum Dynamics (DFT) program, and the last one is a Matlab/c++/Fortran program.

I would like to run a MD simulation followed by a DFT calculation. Then a comparison between MD and DFT results will be carried out using a Matlab/c++/Fortran program. This procedure, as shown in following image, is repeated until a certain criteria is satisfied.

I mean that: when the MD simulation finishes, it will automatically call the DFT task. Then when the DFT task finishes, the Matlab/c++/Fortran program will be called. Finally, when the Matlab/c++/Fortran program finishes, the MD simulation will be carried out again.

Is it possible to do this ?

Best regards,

Thi Dinh TA

PhD Candidate

School of Mechanical, Materials & Mechatronic Engineering

University of Wollongong

NSW 2522, Australia

Phone : (+61) 405 234 812

Email: [email protected]…3974…

Hi Arun,

Thanks for your helpful information.

The DFT will takes the .xyz files from LAMMPS that contains element types and coordinates of each atom.

It is possible to run multiple jobs one after the other using bash script using ‘flat’ chain or ‘looped’ chain. For my case, the ‘looped’ chain is preferred. However, I am struggling in assigning a criteria to quit this loop.

Why ?

Because a third-body program (Matlab/c++/fortran) will be used to compare the results obtained from previous runs of LAMMPS and Quantum expresso (QE). There are two possibilities for this comparison:

i) If A = [LAMMPS_results – QE_results]/ QE_results > 1%, the running will continue.

ii) If A < 1%, the running will stop and all jobs will be killed.

Bash programming supports “Loops for, while and until” to conditionally run a job, but how do I include the variable A, that obtained from the third-body program (Matlab/c++/fortran), into the control expression of these Loops.

Can bash script do this ?

Best regards,

Thi Dinh TA

PhD Candidate

School of Mechanical, Materials & Mechatronic Engineering

University of Wollongong

NSW 2522, Australia

Phone : (+61) 405 234 812

Email: [email protected]…3974…

Hi Thi Dinh,

One question I have in mind is: what is the role of the Matlab stage? To optimize force field parameters of the force field/potential used in the LAMMPS stage? If yes, then you probably don’t need to call the QM stage every iteration as the only changing number in your equation below is “LAMMPS_results”, correct?

Dear Ray Shan, Dr Steven, and Arun,

Thank you very much for your valuable support !

I would like to use Matlab to optimize the force field parameters using Genetic algorithm. And the results from Quantum (adsorption energies, coordinate of atoms, or force components on each direction) can be used as reference. Actually, an optimization procedure similar with that worked by Kong et al. 2009 "The adsorption energies, coordinate of atoms, or force components on each direction " is preferred. From your advice, there are many approaches to do this. However, I prefer using an opensource C/C++ GA algorithm and build LAMMPS as a library. C/C++ GA code will calls LAMMPS as a fitness function using Python interface.

May be, I should work around further and consider which approach is suitable to my application.

Again, thanks for your kindly help !