Install lammps in conda environment
1. Create a new conda environment and enter
conda create --name YOUR_NAME python=3
conda activate YOUR_NAME
2. Install lammps package using pip
pip install lammps
Note that you must ensure that the pip package exists in the conda environment itself, which can be viewed through conda list
.
3. Test your installation
Prepare a simple lammps in.lj file:
# LAMMPS input script - in.lj
# Initialization
clear
units lj
dimension 3
atom_style atomic
# Atom definition
lattice fcc 1.0
region box block 0 10 0 10 0 10 units lattice
create_box 1 box
create_atoms 1 box
mass 1 1.0
# Potential
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0 2.5
# Run
run 1000
4. Execute the above in.lj file in python script
from lammps import lammps
lmp = lammps()
lmp.file("in.lj")
5. Exit the test environment
conda deactivate
Enjoy Reading This Article?
Here are some more articles you might like to read next: