开发者社区> 问答> 正文

实践LAMMPS


官网
http://lammps.sandia.gov/

简介
LAMMPS(Large-scale Atomic/Molecular Massively Parallel Simulator)是一款经典分子动力学软件。LAMMPS包含的势可用于固体材料(金属、半导体)、软物质(生物大分子,聚合物)、粗粒化或介观尺度模型体系。

算例 1 “3d Lennard-Jones melt”
准备工作

运行以下示例需要在创建集群时选择安装LAMMPS相关软件包。


同时还需选择所依赖的相关MPI库


操作步骤
1.运行 module avail,查看是否已安装 LAMMPS 软件。
  1. [backcolor=transparent]$ export MODULEPATH[backcolor=transparent]=/[backcolor=transparent]opt[backcolor=transparent]/[backcolor=transparent]ehpcmodulefiles[backcolor=transparent]/
  2. [backcolor=transparent]$ module avail
  3. [backcolor=transparent]------------------------------[backcolor=transparent] [backcolor=transparent]/[backcolor=transparent]opt[backcolor=transparent]/[backcolor=transparent]ehpcmodulefiles [backcolor=transparent]-------------------------------------
  4. [backcolor=transparent]lammps[backcolor=transparent]/[backcolor=transparent]31Mar17[backcolor=transparent]-[backcolor=transparent]mpich   lammps[backcolor=transparent]/[backcolor=transparent]31Mar17[backcolor=transparent]-[backcolor=transparent]openmpi mpich[backcolor=transparent]/[backcolor=transparent]3.2[backcolor=transparent].[backcolor=transparent]2[backcolor=transparent]            openmpi[backcolor=transparent]/[backcolor=transparent]1.10[backcolor=transparent].[backcolor=transparent]7

2.运行 module load 加载LAMMPS。
  1. [backcolor=transparent]$ module load lammps[backcolor=transparent]/[backcolor=transparent]31Mar17[backcolor=transparent]-[backcolor=transparent]mpich
  2. [backcolor=transparent]$ module load mpich
  3. [backcolor=transparent]$ which lmp
  4. [backcolor=transparent]/[backcolor=transparent]opt[backcolor=transparent]/[backcolor=transparent]lammps[backcolor=transparent]/[backcolor=transparent]31Mar17[backcolor=transparent]-[backcolor=transparent]mpich[backcolor=transparent]/[backcolor=transparent]lmp

3.进入算例目录,有以下作业提交方式。
  • 命令行直接提交。
  1. [backcolor=transparent]$ srun [backcolor=transparent]--[backcolor=transparent]mpi[backcolor=transparent]=[backcolor=transparent]pmi2 [backcolor=transparent]-[backcolor=transparent]N [backcolor=transparent]2[backcolor=transparent] [backcolor=transparent]-[backcolor=transparent]n [backcolor=transparent]4[backcolor=transparent] lmp [backcolor=transparent]-[backcolor=transparent]in[backcolor=transparent] [backcolor=transparent]in[backcolor=transparent].[backcolor=transparent]intel[backcolor=transparent].[backcolor=transparent]lj
  2. [backcolor=transparent]LAMMPS [backcolor=transparent]([backcolor=transparent]31[backcolor=transparent] [backcolor=transparent]Mar[backcolor=transparent] [backcolor=transparent]2017[backcolor=transparent])
  3. [backcolor=transparent]Lattice[backcolor=transparent] spacing [backcolor=transparent]in[backcolor=transparent] x[backcolor=transparent],[backcolor=transparent]y[backcolor=transparent],[backcolor=transparent]z [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]1.6796[backcolor=transparent] [backcolor=transparent]1.6796[backcolor=transparent] [backcolor=transparent]1.6796
  4. [backcolor=transparent]Created[backcolor=transparent] orthogonal box [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]([backcolor=transparent]0[backcolor=transparent] [backcolor=transparent]0[backcolor=transparent] [backcolor=transparent]0[backcolor=transparent])[backcolor=transparent] to [backcolor=transparent]([backcolor=transparent]134.368[backcolor=transparent] [backcolor=transparent]67.1838[backcolor=transparent] [backcolor=transparent]67.1838[backcolor=transparent])
  5. [backcolor=transparent]2[backcolor=transparent] by [backcolor=transparent]1[backcolor=transparent] by [backcolor=transparent]2[backcolor=transparent] MPI processor grid
  6. [backcolor=transparent]Created[backcolor=transparent] [backcolor=transparent]512000[backcolor=transparent] atoms
  7. [backcolor=transparent]...[backcolor=transparent] [backcolor=transparent]...
  • 作业形式提交。
  1. [backcolor=transparent]$ cat job[backcolor=transparent].[backcolor=transparent]sh [backcolor=transparent]# 作业内容
  2. [backcolor=transparent]#!/usr/bin/env bash
  3. [backcolor=transparent]mpirun lmp [backcolor=transparent]-[backcolor=transparent]in[backcolor=transparent] [backcolor=transparent]./[backcolor=transparent]in[backcolor=transparent].[backcolor=transparent]intel[backcolor=transparent].[backcolor=transparent]lj
  4. [backcolor=transparent]$ sbatch [backcolor=transparent]-[backcolor=transparent]N [backcolor=transparent]2[backcolor=transparent] [backcolor=transparent]-[backcolor=transparent]n [backcolor=transparent]4[backcolor=transparent] [backcolor=transparent]./[backcolor=transparent]job[backcolor=transparent].[backcolor=transparent]sh [backcolor=transparent]# 提交作业
  5. [backcolor=transparent]Submitted[backcolor=transparent] batch job [backcolor=transparent]235
  6. [backcolor=transparent]$ squeue [backcolor=transparent]# 查看作业
  7. [backcolor=transparent]             JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST[backcolor=transparent]([backcolor=transparent]REASON[backcolor=transparent])
  8. [backcolor=transparent]               [backcolor=transparent]235[backcolor=transparent]      comp   job[backcolor=transparent].[backcolor=transparent]sh     user  R       [backcolor=transparent]0[backcolor=transparent]:[backcolor=transparent]03[backcolor=transparent]      [backcolor=transparent]2[backcolor=transparent] s[backcolor=transparent][[backcolor=transparent]02[backcolor=transparent]-[backcolor=transparent]03[backcolor=transparent]]
  • 分配资源后提交
  1. [backcolor=transparent]$ salloc [backcolor=transparent]-[backcolor=transparent]N [backcolor=transparent]2[backcolor=transparent] mpirun [backcolor=transparent]-[backcolor=transparent]n [backcolor=transparent]4[backcolor=transparent] lmp [backcolor=transparent]-[backcolor=transparent]in[backcolor=transparent] [backcolor=transparent]in[backcolor=transparent].[backcolor=transparent]intel[backcolor=transparent].[backcolor=transparent]lj
  2. [backcolor=transparent]salloc[backcolor=transparent]:[backcolor=transparent] [backcolor=transparent]Granted[backcolor=transparent] job allocation [backcolor=transparent]236
  3. [backcolor=transparent]salloc[backcolor=transparent]:[backcolor=transparent] [backcolor=transparent]Waiting[backcolor=transparent] [backcolor=transparent]for[backcolor=transparent] resource configuration
  4. [backcolor=transparent]salloc[backcolor=transparent]:[backcolor=transparent] [backcolor=transparent]Nodes[backcolor=transparent] s[backcolor=transparent][[backcolor=transparent]02[backcolor=transparent]-[backcolor=transparent]03[backcolor=transparent]][backcolor=transparent] are ready [backcolor=transparent]for[backcolor=transparent] job
  5. [backcolor=transparent]LAMMPS [backcolor=transparent]([backcolor=transparent]31[backcolor=transparent] [backcolor=transparent]Mar[backcolor=transparent] [backcolor=transparent]2017[backcolor=transparent])
  • 提交PBS作业(GPU加速版)
  1. [backcolor=transparent]$ cat [backcolor=transparent]>[backcolor=transparent] lammps_single_node[backcolor=transparent].[backcolor=transparent]pbs
  2. [backcolor=transparent]#!/bin/sh
  3. [backcolor=transparent]#PBS -l ncpus=28,mem=12gb
  4. [backcolor=transparent]#PBS -l walltime=00:10:00
  5. [backcolor=transparent]#PBS -o lammps_pbs.log
  6. [backcolor=transparent]#PBS -j oe
  7. [backcolor=transparent]cd [backcolor=transparent]/[backcolor=transparent]opt[backcolor=transparent]/[backcolor=transparent]lammps[backcolor=transparent]/[backcolor=transparent]31Mar17[backcolor=transparent]-[backcolor=transparent]openmpi[backcolor=transparent]/[backcolor=transparent]src
  8. [backcolor=transparent]/[backcolor=transparent]opt[backcolor=transparent]/[backcolor=transparent]openmpi[backcolor=transparent]/[backcolor=transparent]bin[backcolor=transparent]/[backcolor=transparent]mpirun [backcolor=transparent]-[backcolor=transparent]np [backcolor=transparent]28[backcolor=transparent] [backcolor=transparent]/[backcolor=transparent]opt[backcolor=transparent]/[backcolor=transparent]lammps[backcolor=transparent]/[backcolor=transparent]31Mar17[backcolor=transparent]-[backcolor=transparent]openmpi[backcolor=transparent]/[backcolor=transparent]bin[backcolor=transparent]/[backcolor=transparent]lmp_mpi [backcolor=transparent]-[backcolor=transparent]sf gpu [backcolor=transparent]-[backcolor=transparent]pk gpu [backcolor=transparent]2[backcolor=transparent] [backcolor=transparent]-[backcolor=transparent]in[backcolor=transparent] [backcolor=transparent]./[backcolor=transparent]in[backcolor=transparent].[backcolor=transparent]intel[backcolor=transparent].[backcolor=transparent]lj [backcolor=transparent]-[backcolor=transparent]v m [backcolor=transparent]0.1
  9. [backcolor=transparent]$ qsub lammps_single_node[backcolor=transparent].[backcolor=transparent]pbs

展开
收起
反向一觉 2017-10-26 13:55:35 2982 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
开发者专场-刘力华 代码智能化的探索与实践 立即下载
《ALPD- 云原生时代研发新范式及案例集发布》 立即下载
动手实验:基于飞天专有云敏捷版 构建应用DevOps实践 立即下载