Commit 89cbe1ce authored by sjplimp's avatar sjplimp
Browse files

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5591 f3b2605a-c512-4ea7-a41b-209d697bcdaa
parent 3ad614b0
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -144,6 +144,7 @@ void PPPM::init()
  cutoff = *p_cutoff;

  // if kspace is TIP4P, extract TIP4P params from pair style
  // bond/angle are not yet init(), so insure equilibrium request is valid

  qdist = 0.0;

@@ -165,6 +166,12 @@ void PPPM::init()

    if (force->angle == NULL || force->bond == NULL)
      error->all("Bond and angle potentials must be defined for TIP4P");
    if (typeA < 1 || typeA > atom->nangletypes || 
	force->angle->setflag[typeA] == 0)
      error->all("Bad TIP4P angle type for PPPM/TIP4P");
    if (typeB < 1 || typeA > atom->nbondtypes || 
	force->bond->setflag[typeB] == 0)
      error->all("Bad TIP4P bond type for PPPM/TIP4P");
    double theta = force->angle->equilibrium_angle(typeA);
    double blen = force->bond->equilibrium_distance(typeB);
    alpha = qdist / (2.0 * cos(0.5*theta) * blen);
+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ class Error : protected Pointers {
  void all(const char *);
  void one(const char *);
  void warning(const char *, int = 1);
  void message(char *, int = 1);
};

}
+47 −4
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@
#include "stdlib.h"
#include "string.h"
#include "ctype.h"
#include "unistd.h"
#include "sys/stat.h"
#include "input.h"
#include "style_command.h"
#include "universe.h"
@@ -81,10 +83,13 @@ Input::Input(LAMMPS *lmp, int argc, char **argv) : Pointers(lmp)

  int iarg = 0;
  while (iarg < argc) {
    if (strcmp(argv[iarg],"-var") == 0) {
      variable->set(argv[iarg+1],argv[iarg+2]);
      iarg += 3;
    } else if (strcmp(argv[iarg],"-echo") == 0) {
    if (strcmp(argv[iarg],"-var") == 0 || strcmp(argv[iarg],"-v") == 0) {
      int jarg = iarg+2;
      while (jarg < argc && argv[jarg][0] != '-') jarg++;
      variable->set(argv[iarg+1],jarg-iarg-2,&argv[iarg+2]);
      iarg = jarg;
    } else if (strcmp(argv[iarg],"-echo") == 0 || 
	       strcmp(argv[iarg],"-e") == 0) {
      narg = 1;
      char **tmp = arg;        // trick echo() into using argv instead of arg
      arg = &argv[iarg+1];
@@ -409,6 +414,7 @@ int Input::execute_command()
  else if (!strcmp(command,"log")) log();
  else if (!strcmp(command,"next")) next_command();
  else if (!strcmp(command,"print")) print();
  else if (!strcmp(command,"shell")) shell();
  else if (!strcmp(command,"variable")) variable_command();

  else if (!strcmp(command,"angle_coeff")) angle_coeff();
@@ -752,6 +758,43 @@ void Input::print()

/* ---------------------------------------------------------------------- */

void Input::shell()
{
  if (narg < 1) error->all("Illegal shell command");

  if (strcmp(arg[0],"cd") == 0) {
    if (narg != 2) error->all("Illegal shell command");
    chdir(arg[1]);

  } else if (strcmp(arg[0],"mkdir") == 0) {
    if (narg < 2) error->all("Illegal shell command");
#if !defined(WINDOWS) && !defined(__MINGW32_VERSION) 
    if (me == 0)
      for (int i = 1; i < narg; i++)
	mkdir(arg[i], S_IRWXU | S_IRGRP | S_IXGRP);
#endif

  } else if (strcmp(arg[0],"mv") == 0) {
    if (narg != 3) error->all("Illegal shell command");
    if (me == 0) rename(arg[1],arg[2]);

  } else if (strcmp(arg[0],"rm") == 0) {
    if (narg < 2) error->all("Illegal shell command");
    if (me == 0)
      for (int i = 1; i < narg; i++)
	unlink(arg[i]);

  } else if (strcmp(arg[0],"rmdir") == 0) {
    if (narg < 2) error->all("Illegal shell command");
    if (me == 0)
      for (int i = 1; i < narg; i++)
	rmdir(arg[i]);

  } else error->all("Illegal shell command");
}

/* ---------------------------------------------------------------------- */

void Input::variable_command()
{
  variable->set(narg,arg);
+1 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ class Input : protected Pointers {
  void log();
  void next_command();
  void print();
  void shell();
  void variable_command();

  void angle_coeff();          // LAMMPS commands
+14 −7
Original line number Diff line number Diff line
@@ -57,7 +57,8 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
  int iarg = 1;

  while (iarg < narg) {
    if (strcmp(arg[iarg],"-partition") == 0) {
    if (strcmp(arg[iarg],"-partition") == 0 || 
	strcmp(arg[iarg],"-p") == 0) {
      universe->existflag = 1;
      if (iarg+2 > narg) 
	error->universe_all("Invalid command-line argument");
@@ -66,26 +67,32 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
	universe->add_world(arg[iarg]);
	iarg++;
      }
    } else if (strcmp(arg[iarg],"-in") == 0) {
    } else if (strcmp(arg[iarg],"-in") == 0 || 
	       strcmp(arg[iarg],"-i") == 0) {
      if (iarg+2 > narg) 
	error->universe_all("Invalid command-line argument");
      inflag = iarg + 1;
      iarg += 2;
    } else if (strcmp(arg[iarg],"-screen") == 0) {
    } else if (strcmp(arg[iarg],"-screen") == 0 || 
	       strcmp(arg[iarg],"-s") == 0) {
      if (iarg+2 > narg) 
	error->universe_all("Invalid command-line argument");
      screenflag = iarg + 1;
      iarg += 2;
    } else if (strcmp(arg[iarg],"-log") == 0) {
    } else if (strcmp(arg[iarg],"-log") == 0 || 
	       strcmp(arg[iarg],"-l") == 0) {
      if (iarg+2 > narg) 
	error->universe_all("Invalid command-line argument");
      logflag = iarg + 1;
      iarg += 2;
    } else if (strcmp(arg[iarg],"-var") == 0) {
    } else if (strcmp(arg[iarg],"-var") == 0 || 
	       strcmp(arg[iarg],"-v") == 0) {
      if (iarg+3 > narg) 
	error->universe_all("Invalid command-line argument");
      iarg += 3;
    } else if (strcmp(arg[iarg],"-echo") == 0) {
      iarg += 2;
      while (iarg < narg && arg[iarg][0] != '-') iarg++;
    } else if (strcmp(arg[iarg],"-echo") == 0 || 
	       strcmp(arg[iarg],"-e") == 0) {
      if (iarg+2 > narg) 
	error->universe_all("Invalid command-line argument");
      iarg += 2;
Loading