NAMD is a parallel molecular dynamics code designed for the simulation of biomolecular systems. You should build an MPI version of the code from source instead of using one of the pre-compiled executables since these executables are not Slurm-aware.
Below is a sample Slurm script for a NAMD job on one of the CPU clusters:


#!/bin/sh
#SBATCH -N 3
#SBATCH --ntasks-per-node=24
#SBATCH --account=mechanical
#SBATCH --mem=10gb
#SBATCH --error=job.%J.err
#SBATCH --output=job.%J.out
#SBATCH --time=5-08:08:08
##SBATCH --no-requeue

module load apps/namd/parallel_studio_xe_2019.3.062/2.14

mpiexec.hydra -n 72 namd2 Ele.namd > Ele.log


#!/bin/sh
#BATCH -A
#SBATCH -N 5
#SBATCH --ntasks-per-node=24
#SBATCH --account=chemical
#SBATCH --mem=50gb
#SBATCH --error=job.%J.err
#SBATCH --output=job.%J.out
#SBATCH --time=5-00:00:00

module load apps/namd/parallel_studio_xe_2019.3.062/2.14

#export OMP_NUM_THREADS=1
#time srun -n 72 namd2 Ele.namd > Ele.log

#srun -n 72 namd2 Ele.namd > Ele.log
#INPUT=Ele.namd
#OUTPUT=Ele.out

#srun -n 72 namd2 Ele.namd > Ele.log
mpiexec.hydra -n 120 namd2 abeta_eq.conf > solution.log