[lammps-users] MOLTEMPLATE file error when trying to simulate NaClsolution on LAMMPS


I’m trying to simulate a NaCl solution on LAMMPS, using the example MOLTEMPLATE NaCl files. I was able to successfully simulate it the first time by following the instructions in the README files. However, I tried a second time and received this error when inputting the run commands from README_run.sh:

“Cannot open input script system.in.init”

Any suggestions? I’m pretty new to these softwares, and I’m using them on MacOS Terminal for a high school research project.


Aileen Huang

Hi Aileen,
What do you mean of second time?
Note that the “system.in.init” script should be in the lammps running directory. Following scripts are produced when you employ moltemlate:
You should keep all of them in the directory that lammps is running.


On my second try, I tried running the simulation by following the same commands as the first time (worked the first time). I think I may have had some issues with moving the moltemplate files to LAMMPS directory. I’ll try working on that. Thanks

Hi Aileen
If there is no “system.in.init” file in your directory after running moltemplate.sh, it means that moltemplate.sh did not run to completion. In that case you should hopefully get an error message at the moltemplate stage (ie. before you run LAMMPS).

If you haven’t made any modifications to the water+Na+Cl example, then it could mean that your moltemplate installation has become corrupted in some way. If you installed moltemplate by editing your .bashrc file, then if you moved your moltemplate files, you must edit that file again and update your PATH accordingly. Note that it’s a bad idea to reorganize the directory structure storing the moltemplate code. (The “moltemplate.sh” bash script must be in the “scripts” directory, and the “ttree.py” and other .py files must be in the parent directory.)

The safest thing to do is to uninstall moltemplate and reinstall it again. (If you used pip, then use “pip uninstall moltemplate” followed by “pip install moltemplate”. If you installed moltemplate by editing your .bashrc file, then delete the directory containing moltemplate and download it again. If you run into trouble, follow the (updated) instructions here.)