From b41e0b2036c6688f720e9c31e75c7ce7a18f9cc7 Mon Sep 17 00:00:00 2001 From: Tao Cheng Date: Sun, 2 Nov 2014 23:21:36 -0800 Subject: [PATCH] debug --- lib/cons.py | 2 +- tools/Lammps/lammps_eos.py | 3 +- tools/Lammps/template.py | 9 ++-- tools/pbs/exLammps | 85 ++++++++++++++++++++++++++++++++++++++ tools/vasp/get_potcar.py | 2 +- 5 files changed, 94 insertions(+), 7 deletions(-) create mode 100755 tools/pbs/exLammps diff --git a/lib/cons.py b/lib/cons.py index 91891cc..57ba064 100644 --- a/lib/cons.py +++ b/lib/cons.py @@ -3,7 +3,7 @@ # Atom number - Atom name map ELEMENT = {1:"H", 3:"Li", 6:"C", 7:"N", 8:"O", 9:"F", 12: "Mg", 13: "Al", 14:"Si", - 15:"P", 16:"S", 17:"Cl", 20:"Ca", 22:"Ti", 31:"Ga", 32:"Ge"} + 15:"P", 16:"S", 17:"Cl", 20:"Ca", 22:"Ti", 28:"Ni", 31:"Ga", 32:"Ge"} # Atom name - Atom number map ELEMENT2ATN = {"H":1, "Li":3, "C":6, "N":7, "O":8, 9:"F", "Na":11, 12: "Mg", "Al":13, "Si":14, "P":15, "S":16, "Cl":17, "Ca":20, "Ti":22, "V":23,"Ni":28, "Pt":78, 32:"Ge", "MO":42, "Mo":42, diff --git a/tools/Lammps/lammps_eos.py b/tools/Lammps/lammps_eos.py index 0767701..940deb4 100644 --- a/tools/Lammps/lammps_eos.py +++ b/tools/Lammps/lammps_eos.py @@ -35,6 +35,7 @@ for j in lines: o.write(j) o.close() - shutil.copy("../min.rst", ".") + if os.path.exists("../min.rst"): + shutil.copy("../min.rst", ".") shutil.copy("../ffield", ".") os.chdir("..") diff --git a/tools/Lammps/template.py b/tools/Lammps/template.py index 19398e4..1de6b6b 100644 --- a/tools/Lammps/template.py +++ b/tools/Lammps/template.py @@ -77,7 +77,7 @@ #pair_style reax/c control #pair_style reax/c NULL lgvdw yes -pair_style %reax_potential% +pair_style %reax_potential% safezone 1.8 mincap 180 #----Neighbor Section----# @@ -108,22 +108,23 @@ #--------Output info-------- thermo 400 -thermo_style custom step etotal ke pe temp press vol v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq cella cellb cellc cellalpha cellbeta cellgamma +thermo_style custom step etotal ke pe temp press vol v_eb v_ea v_elp v_emol v_ev v_epen v_ecoa v_ehb v_et v_eco v_ew v_ep v_efi v_eqeq cella cellb cellc cellalpha cellbeta cellgamma pxx pyy pzz thermo_modify line multi dump 100 all custom 400 dump.lammpstrj id type x y z vx vy vz dump_modify 100 sort id dump 101 all cfg 400 dump.*.cfg mass type xs ys zs vx vy vz fx fy fz -dump_modify 101 element %elements% +dump_modify 101 element %elements% sort id #--------Analysis----------- -fix 200 all reax/c/bonds 400 bonds.reax +#fix 200 all reax/c/bonds 400 bonds.reax #fix 201 all reax/c/species 1 1 400 species.out #--------Simulation-------- velocity all create 300.0 4928459 rot yes dist gaussian +restart 40000 restart_*.rst fix 401 all nvt temp 300 300 50 timestep 0.25 run 80000 diff --git a/tools/pbs/exLammps b/tools/pbs/exLammps new file mode 100755 index 0000000..622d55e --- /dev/null +++ b/tools/pbs/exLammps @@ -0,0 +1,85 @@ +#!/usr/bin/env python + +""" +Generate pbs script for LAMMPS calculation on HPC. +exLAMMPS ncpu +""" + +import sys +import os +import shutil + +INP = """#!/bin/bash + +#PBS -A ONRDC33663C5T +#PBS -V +#PBS -j oe +#PBS -N LAMMPS +#PBS -q challenge +#PBS -l select=%nnode%:ncpus=32:mpiprocs=32 +#PBS -l walltime=168:00:00 + +export LAMMPSLOC=/u/taocheng/SOFT/lammps-1Feb14/src +export exe=$LAMMPSLOC/lmp_pgi +echo "The LAMMPS executable is: " $exe + +export DATADIR=$PBS_O_WORKDIR + +export NPROCS=`wc -l $PBS_NODEFILE | cut -f1 -d " "` +export JOBID=`echo $PBS_JOBID | awk -F'.' '{print $1}'` +export OUTPUTDIR=$WORKDIR/LAMMPS/$JOBID +echo "The LAMMPS output will temporarily be written to :" $OUTPUTDIR +echo "LAMMPS Job: " $JOBID "is starting with " $NPROCS "cores on:" +cat $PBS_NODEFILE +echo + +# Create Directories +# +mkdir -p $OUTPUTDIR + +# export job info +# +echo $PBS_JOBID > $DATADIR/jobinfo +cat $PBS_NODEFILE >> $DATADIR/jobinfo +echo $OUTPUTDIR >> $DATADIR/jobinfo + +# Copy executable and any required input files to your work directory +# +cp $DATADIR/* $OUTPUTDIR +cd $OUTPUTDIR + +# +# Run LAMMPS +# +date +aprun -n %ncpu% $exe -in lammps_input > log +echo +date +echo "LAMMPS has finished." +echo "The LAMMPS output is being copied back to: " $PBS_O_WORKDIR +cd .. +tar -cvzf $JOBID.tar.gz $JOBID +cp -r $JOBID.tar.gz $PBS_O_WORKDIR +rm $JOBID.tar.gz + +exit 0 + +""" + +def main(): + if len(sys.argv) == 1: + ncpu = 32 + else: + ncpu = int(sys.argv[1]) + nnode = ncpu/32 + + o = open("runLAMMPS.in", "w") + lines = INP + lines = lines.replace("%nnode%", "%d"%nnode) + lines = lines.replace("%ncpu%", "%d"%ncpu) + o.write(lines) + o.close() + os.system("chmod +x runLAMMPS.in") + +if __name__ == "__main__": + main() diff --git a/tools/vasp/get_potcar.py b/tools/vasp/get_potcar.py index d497335..b7a9b55 100644 --- a/tools/vasp/get_potcar.py +++ b/tools/vasp/get_potcar.py @@ -23,7 +23,7 @@ POT = {"N":"N", "O":"O", "H":"H", "C":"C", "Li":"Li", "S":"S", "Ti":"Ti", "P":"P", "Ca":"Ca_pv", "Al":"Al", "Cu":"Cu", "Na":"Na", "Cl":"Cl", "Cr":"Cr", "Ga":"Ga", - "Br":"Br", "D": "H", "Si": "Si", "Ni": "Ni"} + "Br":"Br", "D": "H", "Si": "Si", "Ni": "Ni", "Pt":"Pt"} POT_DATA_BASE = "/project/source/VASP/vasp.5.2/potcar/potpaw_PBE" o = open("POTCAR", "w")