How to Send a Notification from a LAMMPS Simulation to Your Email
Molecular dynamics simulations often take long computational times, from several hours to a few days. It is a boring job to monitor the progress of simulations. Very often, we switch to do other work on another computer, but you may be anxious to see the simulation results. So, how can we better spend our time and focus on our research work? Here is one solution to allow the LAMMPS to send you an email, so you can no longer actively checking the progress of simulations. It is also important to minimize the idle time and maximize the utility of your computer.
I run my LAMMPS in Ubuntu 12.04 LTS. Because I require the USER-CUDA and USER-REAXC Libraries. The Linux platform also allows me to work more efficiently on a low-end desktop computer that only consists of an Intel Core 2 Duo CPU and 2GB DDRII RAM. So, I am going to show you how to configure the email package and use the shell command of LAMMPS in Ubuntu. You may run the LAMMPS in Microsoft Windows. If so, please read the section at the end of this post.
First, you need an email account with supporting SMTP outgoing service. For example, Gmail. The following web page describes how to download and set up the Gmail SMTP service in Ubuntu.
Next, we have to add a line at the end of our LAMMPS input script.
shell echo “Email Content“ | mail -s "Title" to-this-email-address
shell echo "Simulation has completed" | mail -s "LAMMPS - simulation done" firstname.lastname@example.org
As a result, an email is sent to notify me of the end of a LAMMPS simulation. You can add this line in various places if you want to know the progress of a multi-stage simulation.
I have tested this method in Windows. But the same concept should also work in Windows. I found a web page here (https://www.wikihow.com/Send-Email-Using-Telnet), which describes how to use the cmd prompt and telnet command to ping an SMTP server and send an email. You can try this if you like running LAMMPS in Windows.