Commit a4dbac63 authored by Steven J. Plimpton's avatar Steven J. Plimpton
Browse files

more updates to the new MESSAGE package

parent 1aa8307f
Loading
Loading
Loading
Loading
+14953 −0

File added.

Preview size limit exceeded, changes collapsed.

+35 −13
Original line number Diff line number Diff line
@@ -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
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
"client" code to perform ab initio MD.  LAMMPS performs the MD
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.

----------------

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:

Both the client (LAMMPS) and server (vasp_wrap.py) must use the same
@@ -76,15 +110,3 @@ ZMQ mode of messaging:

% mpirun -np 2 lmp_mpi -v mode zmq < in.client.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.
+17 −16
Original line number Diff line number Diff line
@@ -23,13 +23,15 @@
# could make syntax for launching VASP more flexible
#   e.g. command-line arg for # of procs

import sys
import commands
import sys,subprocess
import xml.etree.ElementTree as ET  
from cslib import CSlib

# comment out 2nd line once 1st line is correct for your system

vaspcmd = "srun -N 1 --ntasks-per-node=4 " + \
          "-n 4 /projects/vasp/2017-build/cts1/vasp5.4.4/vasp_tfermi/bin/vasp_std"
vaspcmd = "touch tmp"

# enums matching FixClientMD class in LAMMPS

@@ -84,18 +86,18 @@ def poscar_write(poscar,natoms,ntypes,types,coords,box):

  # header, including box size
  
  print >>psnew,psold[0],
  print >>psnew,psold[1],
  print >>psnew,"%g 0.0 0.0" % box[0]
  print >>psnew,"0.0 %g 0.0" % box[1]
  print >>psnew,"0.0 0.0 %g" % box[2]
  print >>psnew,psold[5],
  print >>psnew,psold[6],
  psnew.write(psold[0])
  psnew.write(psold[1])
  psnew.write("%g 0.0 0.0\n" % box[0])
  psnew.write("0.0 %g 0.0\n" % box[1])
  psnew.write("0.0 0.0 %g\n" % box[2])
  psnew.write(psold[5])
  psnew.write(psold[6])

  # per-atom coords
  # grouped by types

  print >>psnew,"Cartesian"
  psnew.write("Cartesian\n")

  for itype in range(1,ntypes+1):
    for i in range(natoms):
@@ -103,8 +105,8 @@ def poscar_write(poscar,natoms,ntypes,types,coords,box):
      x = coords[3*i+0]
      y = coords[3*i+1]
      z = coords[3*i+2]
      aline = "  %g %g %g" % (x,y,z)
      print >>psnew,aline
      aline = "  %g %g %g\n" % (x,y,z)
      psnew.write(aline)

  psnew.close()

@@ -209,10 +211,9 @@ while 1:

  # invoke VASP
  
  print "Launching VASP ..."
  print "\nLaunching VASP ..."
  print vaspcmd
  out = commands.getoutput(vaspcmd)
  print out
  subprocess.check_output(vaspcmd,stderr=subprocess.STDOUT,shell=True)
  
  # process VASP output
    
+2 −2
Original line number Diff line number Diff line
@@ -6,8 +6,8 @@
#   Copyright 2018 National Technology & Engineering Solutions of
#   Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
#   NTESS, the U.S. Government retains certain rights in this software.
#   This software is distributed under the GNU Lesser General Public
#   License (LGPL).
#   This software is distributed under the modified Berkeley Software
#   Distribution (BSD) License.
#
#   See the README file in the top-level CSlib directory.
# -------------------------------------------------------------------------
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@
   See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */

#include <cstring.h>
#include <cstring>
#include "message.h"
#include "error.h"

Loading