LAMMPS
Nesta seção:
Descrição
De acordo com a página do LAMMPS, LAMMPS (Large-scale Atomic/Molecular Massively Parallel Simulator) é um código de dinâmica molecular clássica focado em modelagem de materiais. Possui potenciais para materiais no estado sólido (metais, semicondutores), matéria mole (biomoléculas, polímeros) e sistemas mesoscópicos ou coarse-grained.
Versões Disponíveis
lammps/20170331
lammps/20180316
lammps/20200303 (default)
lammps/20230802
lammps/20250722/gpu
Submissão de Jobs Seriais
submit_lammps_serial.sh
#!/bin/bash
#SBATCH -J lammps_serial
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 05:00:00
#SBATCH --mem=4G
export INPUT="in.lj"
export OUTPUT="*.log *.dump"
module load lammps
job-nanny lmp -in in.lj
Submissão de Jobs MPI
submit_lammps_mpi.sh
#!/bin/bash
#SBATCH -J lammps_mpi
#SBATCH -N 2
#SBATCH --ntasks-per-node=28
#SBATCH -t 48:00:00
#SBATCH --mem-per-cpu=2G
export INPUT="in.reax.rdx"
export OUTPUT="*.log *.dump *.out"
module load lammps
job-nanny srun -n $SLURM_NTASKS lmp -in in.reax.rdx -log lammps.log
Exemplo de Arquivo de Entrada
in.lj
# Simulação Lennard-Jones 3D
units lj
atom_style atomic
# Criação da caixa
lattice fcc 0.8442
region box block 0 10 0 10 0 10
create_box 1 box
create_atoms 1 box
# Massas
mass 1 1.0
# Potencial
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0 2.5
# Configuração inicial
neighbor 0.3 bin
neigh_modify delay 10
# Minimização
fix 1 all nve
run 1000
# Produção
reset_timestep 0
thermo 100
thermo_style custom step temp pe etotal press
dump 1 all atom 1000 dump.lammpstrj
run 10000
Exemplo de Input para ReaxFF
in.reax.rdx
# Simulação ReaxFF de RDX
units real
atom_style charge
# Leitura de dados
read_data data.rdx
# Potencial ReaxFF
pair_style reaxff NULL
pair_coeff * * ffield.reax.rdx RDX
# Configurações
neighbor 2.0 bin
neigh_modify every 10 delay 0 check no
# Fixos
fix 1 all nve
fix 2 all qeq/reaxff 1 0.0 10.0 1e-6 param.qeq
# Termalização
velocity all create 300.0 4928459
fix 3 all temp/berendsen 300.0 300.0 100.0
thermo 100
thermo_style custom step temp pe etotal press vol
run 5000
unfix 3
# Produção NVT
fix 3 all nvt temp 300.0 300.0 100.0
dump 1 all custom 1000 dump.reax id type x y z vx vy vz
run 50000
Job Array para Varredura de Temperatura
submit_lammps_array.sh
#!/bin/bash
#SBATCH -J lammps_array
#SBATCH --array=1-5
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 24:00:00
#SBATCH --mem=8G
TEMPS=(300 400 500 600 700)
TEMP=${TEMPS[$SLURM_ARRAY_TASK_ID-1]}
export INPUT="template.in"
export OUTPUT="T${TEMP}/"
module load lammps
mkdir -p T${TEMP}
cd T${TEMP}
# Modificar temperatura no arquivo de entrada
sed "s/TEMPERATURE/$TEMP/g" ../template.in > in.${TEMP}
job-nanny lmp -in in.${TEMP} -log log.${TEMP}
Cálculo de Propriedades
submit_lammps_props.sh
#!/bin/bash
#SBATCH -J lammps_props
#SBATCH -N 2
#SBATCH --ntasks-per-node=28
#SBATCH -t 24:00:00
#SBATCH --mem-per-cpu=2G
export INPUT="in.production"
export OUTPUT="properties/"
module load lammps
mkdir -p properties
job-nanny srun -n $SLURM_NTASKS lmp -in in.production
# Análise pós-processamento
cat > post_process.py << 'EOF'
import numpy as np
import matplotlib.pyplot as plt
# Ler dados de log
data = np.loadtxt('log.lammps', skiprows=1)
step = data[:,0]
temp = data[:,1]
pe = data[:,2]
etotal = data[:,3]
press = data[:,4]
# Plotar
plt.figure()
plt.plot(step, temp)
plt.xlabel('Passo')
plt.ylabel('Temperatura (K)')
plt.savefig('properties/temperature.png')
plt.figure()
plt.plot(step, pe, label='Energia Potencial')
plt.plot(step, etotal, label='Energia Total')
plt.xlabel('Passo')
plt.ylabel('Energia')
plt.legend()
plt.savefig('properties/energy.png')
# Estatísticas
with open('properties/summary.txt', 'w') as f:
f.write(f"Temperatura média: {np.mean(temp):.2f} K\n")
f.write(f"Desvio temperatura: {np.std(temp):.2f} K\n")
f.write(f"Pressão média: {np.mean(press):.2f} bar\n")
f.write(f"Energia média: {np.mean(etotal):.2f}\n")
EOF
python post_process.py
Referências
Documentação: https://lammps.sandia.gov/doc/Manual.html
Tutoriais: https://lammps.sandia.gov/tutorials.html
Lista de discussão: https://lammps.sandia.gov/mail.html
Ver também
GROMACS - Dinâmica molecular para biomoléculas
NAMD - Dinâmica molecular escalável
Processando Simulações - Como submeter jobs