Complete Guide to LAMMPS Installation on WSL: Step-by-Step for Parallel Simulations

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ต.ค. 2024
  • Struggling with installing LAMMPS on WSL? We've got you covered! 💻
    Watch our step-by-step video, led by Fahmid Faiyaj Chowdhury, as he walks through the LAMMPS Installation on Windows Subsystem for Linux (WSL). Whether you’re a beginner or experienced researcher, this video will help you set up and run molecular dynamics simulations seamlessly.
    📽️ What’s Inside? 🔧 Installing WSL on Windows ⚙️ Compiling & Running LAMMPS Simulations 📈 Running Parallel Simulations using MPI and Multithreading
    Fahmid is a Mechanical Engineering senior at BUET, specializing in Ultrashort Laser Ablation research using MD simulations. His passion for numerical methods and LAMMPS expertise is sure to make your research journey smoother! 🌟
    👨‍💻 Watch now and elevate your simulation game! 🔗
    #LAMMPS #WSL #NanoMechanics #MolecularDynamics #MMMRN #BUET #Research #Simulation #MPI #Multithreading #LaserAblation
    Commands Used:
    Commands for installing wsl from command prompt:
    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart (installs wsl)
    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart (enables Virtual Machine Platform feature)
    wsl --set-default-version 2 (sets wsl version-2 as default)
    Other commands for wsl:
    wsl --unregister OS_name
    wsl --shutdown
    sudo commands for installing prerequisite packages for compiling LAMMPS:
    sudo apt update
    sudo apt upgrade -y
    sudo apt install -y cmake build-essential ccache gfortran openmpi-bin libopenmpi-dev \
    libfftw3-dev libjpeg-dev libpng-dev python3-dev python3-pip \
    python3-virtualenv libblas-dev liblapack-dev libhdf5-serial-dev \
    hdf5-tools
    Command for extracting files:
    tar xvzf stable_3Mar2020.tar.gz
    Command for compiling LAMMPS:
    cmake -C ../cmake/presets/basic.cmake ../cmake
    make -j 8
    Command for installing MPI:
    sudo apt install mpich
    Commands for running simulations:
    lmp -in in.melt(Serial run)
    mpirun -np 6 lmp -in in.melt(Parallel run)
    mpirun -np 6 lmp -pk omp 2 -sf omp -in in.melt(Parallel run with multithreading)
    Other Commands:
    ^C - Cancel a command
    ls - lists all files in current directory
    wget - takes an address as input and downloads it
    sudo chown user_name directory_name - change ownership of directory to username
    cd - used to change the current directory. The default directory is the home directory(Ubuntu/home/username)
    cd ../ - goes back once
    mkdir - used to create a directory
    pwd - shows current directory
    lmp -help: shows all installed LAMMPS modules
    sudo apt install module_name: installs module
    lmp -h - use this command while in build directory to check installed LAMMPS packages and Ubuntu version
    Installing Ubuntu:
    1)Download Ubuntu(not Ubuntu 22.04) from MS Store and open to trigger the installation
    2)Type Username(no CAPS) and password
    2)Download Terminal from MS Store
    4)Set Ubuntu as default tab from terminal settings
    5)Download prerequisites using sudo commands on Ubuntu terminal
    Downloading and installing LAMMPS tarball:
    1)Download the latest stable LAMMPS tarball(the LAMMPS source code) file from www.lammps.org... Aug 2023)
    2)Create a new folder in home/username directory named "lammps_new" and extract the turball file into lammps_new directory using appropriate command
    3)Create a new folder named "build" inside the extracted tarball directory
    LAMMPS Installation:
    1)Open the basic.cmake file from home/username/lammps_new/lammps-2Aug2023/cmake/presets and edit the source code to add 2 new packages
    2)Use cmake command for compiling a minimal version of LAMMPS while inside the "build" directory
    3)Use make command to configure the build. A file named "lmp", which is the main LAMMPS file, will appear inside "build" directory.
    4)Ubuntu cannot recognize "lmp" as a software. Open ".bashrc" from home directory and add-
    "PATH=~/lammps_new/lammps-2Aug2023/build:$PATH" at the end.
    Now "lmp" can be recognized by Ubuntu as a LAMMPS software.
    Note: Updated Cmake file will contain 2 extra packages-OPENMP(for Multithreading), EXTRA-FIX(for ttm)
    Installing MPI(for parallel computations):
    1)Install MPI using appropriate command
    Running a simulation:
    lmp -in in.melt(Serial run)
    mpirun -np 8 lmp -in in.melt(Parallel run)
    mpirun -np 8 lmp -pk omp 2 -sf omp -in in.melt(Parallel run Multithreading)
    For creating a new LAMMPS build with a different set of packages installed,
    1) Create a new build folder in the same directory as 'build' (ex: build2)
    2) Modify the basic.cmake file to include the new packages (cmake/presets/basic.cmake)
    3) Run the cmake and make commands from Ubuntu's terminal while in the new build directory
    4) Rename the new 'lmp' file (build2/lmp) and 'liblammps.a' to avoid confusion (ex: lmp2, liblammps2.a)
    5) Add the path for the new 'lmp2' file to bash.rc so that Ubuntu can recognize the new LAMMPS build

ความคิดเห็น •