Skip to content
Snippets Groups Projects
Commit a4dbac63 authored by Steven J. Plimpton's avatar Steven J. Plimpton
Browse files

more updates to the new MESSAGE package

parent 1aa8307f
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
...@@ -5,7 +5,7 @@ See the MESSAGE package (doc/Section_messages.html#MESSAGE) and ...@@ -5,7 +5,7 @@ See the MESSAGE package (doc/Section_messages.html#MESSAGE) and
Section_howto.html#howto10 for more details on how client/server Section_howto.html#howto10 for more details on how client/server
coupling works in LAMMPS. coupling works in LAMMPS.
In this dir, the vasp_warp.py is a wrapper on the VASP quantum DFT In this dir, the vasp_wrap.py is a wrapper on the VASP quantum DFT
code so it can work as a "server" code which LAMMPS drives as a code so it can work as a "server" code which LAMMPS drives as a
"client" code to perform ab initio MD. LAMMPS performs the MD "client" code to perform ab initio MD. LAMMPS performs the MD
timestepping, sends VASP a current set of coordinates each timestep, timestepping, sends VASP a current set of coordinates each timestep,
...@@ -34,6 +34,40 @@ You can leave off the -z if you do not have ZMQ on your system. ...@@ -34,6 +34,40 @@ You can leave off the -z if you do not have ZMQ on your system.
---------------- ----------------
Prepare to use VASP and the vasp_wrapper.py script
You can run the vasp_wrap.py script as-is to test that the
coupling between it and LAMMPS is functional. But the as-is
version will not attempt to run VASP.
To do this, you must edit the 1st vaspcmd line at the top of
vasp_wrapper.py to be the launch command needed to run VASP on your
system. It can be a command to run VASP in serial or in parallel,
e.g. an mpirun command. Then comment out the 2nd vaspcmd line
immediately following it.
Insure you have the necessary VASP input files in this
directory, suitable for the VASP calculation you want to perform:
INCAR
KPOINTS
POSCAR_template
POTCAR
Examples of all but the POTCAR file are provided. As explained below,
POSCAR_W is an input file for a 2-atom unit cell of tungsten and can
be used to test the LAMMPS/VASP coupling. The POTCAR file is a
proprietary VASP file, so use one from your VASP installation.
Note that the POSCAR_template file should be matched to the LAMMPS
input script (# of atoms and atom types, box size, etc). The provided
POSCAR_W matches in.client.W.
NOTE: explain how vasp_wrapper.py finds the cslib.py wrapper on the
CSlib to import.
----------------
To run in client/server mode: To run in client/server mode:
Both the client (LAMMPS) and server (vasp_wrap.py) must use the same Both the client (LAMMPS) and server (vasp_wrap.py) must use the same
...@@ -76,15 +110,3 @@ ZMQ mode of messaging: ...@@ -76,15 +110,3 @@ ZMQ mode of messaging:
% mpirun -np 2 lmp_mpi -v mode zmq < in.client.W % mpirun -np 2 lmp_mpi -v mode zmq < in.client.W
% python vasp_wrap.py zmq POSCAR_W % python vasp_wrap.py zmq POSCAR_W
--------------
The provided data.W file (for LAMMPS) and POSCAR_W file (for VASP) are
for a simple 2-atom unit cell of bcc tungsten (W). You could
replicate this with LAMMPS to create a larger system. The
vasp_wrap.py script needs to be generalized to create an appropriate
POSCAR_W file for a larger box.
VASP input file include the sample INCAR and KPOINTS files provided.
A POTCAR file is also needed, which should come from your VASP package
installation.
...@@ -23,13 +23,15 @@ ...@@ -23,13 +23,15 @@
# could make syntax for launching VASP more flexible # could make syntax for launching VASP more flexible
# e.g. command-line arg for # of procs # e.g. command-line arg for # of procs
import sys import sys,subprocess
import commands
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from cslib import CSlib from cslib import CSlib
# comment out 2nd line once 1st line is correct for your system
vaspcmd = "srun -N 1 --ntasks-per-node=4 " + \ vaspcmd = "srun -N 1 --ntasks-per-node=4 " + \
"-n 4 /projects/vasp/2017-build/cts1/vasp5.4.4/vasp_tfermi/bin/vasp_std" "-n 4 /projects/vasp/2017-build/cts1/vasp5.4.4/vasp_tfermi/bin/vasp_std"
vaspcmd = "touch tmp"
# enums matching FixClientMD class in LAMMPS # enums matching FixClientMD class in LAMMPS
...@@ -84,18 +86,18 @@ def poscar_write(poscar,natoms,ntypes,types,coords,box): ...@@ -84,18 +86,18 @@ def poscar_write(poscar,natoms,ntypes,types,coords,box):
# header, including box size # header, including box size
print >>psnew,psold[0], psnew.write(psold[0])
print >>psnew,psold[1], psnew.write(psold[1])
print >>psnew,"%g 0.0 0.0" % box[0] psnew.write("%g 0.0 0.0\n" % box[0])
print >>psnew,"0.0 %g 0.0" % box[1] psnew.write("0.0 %g 0.0\n" % box[1])
print >>psnew,"0.0 0.0 %g" % box[2] psnew.write("0.0 0.0 %g\n" % box[2])
print >>psnew,psold[5], psnew.write(psold[5])
print >>psnew,psold[6], psnew.write(psold[6])
# per-atom coords # per-atom coords
# grouped by types # grouped by types
print >>psnew,"Cartesian" psnew.write("Cartesian\n")
for itype in range(1,ntypes+1): for itype in range(1,ntypes+1):
for i in range(natoms): for i in range(natoms):
...@@ -103,8 +105,8 @@ def poscar_write(poscar,natoms,ntypes,types,coords,box): ...@@ -103,8 +105,8 @@ def poscar_write(poscar,natoms,ntypes,types,coords,box):
x = coords[3*i+0] x = coords[3*i+0]
y = coords[3*i+1] y = coords[3*i+1]
z = coords[3*i+2] z = coords[3*i+2]
aline = " %g %g %g" % (x,y,z) aline = " %g %g %g\n" % (x,y,z)
print >>psnew,aline psnew.write(aline)
psnew.close() psnew.close()
...@@ -209,10 +211,9 @@ while 1: ...@@ -209,10 +211,9 @@ while 1:
# invoke VASP # invoke VASP
print "Launching VASP ..." print "\nLaunching VASP ..."
print vaspcmd print vaspcmd
out = commands.getoutput(vaspcmd) subprocess.check_output(vaspcmd,stderr=subprocess.STDOUT,shell=True)
print out
# process VASP output # process VASP output
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
# Copyright 2018 National Technology & Engineering Solutions of # Copyright 2018 National Technology & Engineering Solutions of
# Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
# NTESS, the U.S. Government retains certain rights in this software. # NTESS, the U.S. Government retains certain rights in this software.
# This software is distributed under the GNU Lesser General Public # This software is distributed under the modified Berkeley Software
# License (LGPL). # Distribution (BSD) License.
# #
# See the README file in the top-level CSlib directory. # See the README file in the top-level CSlib directory.
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include <cstring.h> #include <cstring>
#include "message.h" #include "message.h"
#include "error.h" #include "error.h"
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include <cstring.h> #include <cstring>
#include "server.h" #include "server.h"
#include "error.h" #include "error.h"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment