#!/bin/bash
#SBATCH --job-name=lammps_job
#SBATCH --partition=small      # Specify the partition (small, medium, etc.)
#SBATCH --nodes=2            # Number of nodes to be used
#SBATCH --ntasks=144          # Number of MPI processes ((min=1, max= number of nodes*number of cores in each node))
#SBATCH --cpus-per-task=1    # number of cpus(cores) per process(min=1, max=36)
#If you were to use --cpus-per-task=36, it would mean that each MPI process would use all available cores on a CPU, which might not be efficient for most applications.

#SBATCH --time=23:00:00      # Maximum wall clock limit for job execution (10 minutes)
#SBATCH --output=lammps_output_%j.log # Log file for job output

# Load necessary modules
module load USER-SPACK/0.18.1 gcc/12.1.0 intel-oneapi-mpi/2021.6.0

# Set the OMP_NUM_THREADS environment variable
export OMP_NUM_THREADS=1 

# Go to the directory containing the input file
cd /beegfs/home/d/daneshba

# Define the path to the LAMMPS executable
LAMMPS_EXEC=/beegfs/home/d/daneshba/USER-SPACK/0.18.1/opt/spack/linux-rocky8-icelake/gcc-12.1.0/lammps-20220107-lbrdsq57xvbrxgrnsxgqo3fcjpmsg3ij/bin/lmp

# Execute LAMMPS with the input file
srun -n $SLURM_NTASKS  $LAMMPS_EXEC -in in.19.10.2023

# Move generated files to output directory
#mkdir -p /beegfs/home/d/daneshba/output_files
#mv avg_disp_y.dat dump.dat /beegfs/home/d/daneshba/output_files

#The "--ntasks" options specifies how many instances of your command are executed. For a common cluster setup and if you start your command with "srun" this corresponds to the number of MPI ranks.
#In contrast the option "--cpus-per-task" specify how many CPUs or CPU Core each task can use.