From 40088f558cf5ea8cfa574fbea835daddfca41eb4 Mon Sep 17 00:00:00 2001 From: Oliver Henrich Date: Thu, 2 Jul 2020 23:11:50 +0100 Subject: [PATCH] Revert "Added fix bond/create/angle code and docu" This reverts commit 16eab647d44680e9962118c3e1211850cb529b5c. --- doc/src/Commands_fix.rst | 1 - doc/src/fix_bond_create.rst | 28 +----- src/MC/fix_bond_create.cpp | 32 ------- src/MC/fix_bond_create.h | 5 - src/MC/fix_bond_create_angle.cpp | 151 ------------------------------- src/MC/fix_bond_create_angle.h | 40 -------- 6 files changed, 5 insertions(+), 252 deletions(-) delete mode 100644 src/MC/fix_bond_create_angle.cpp delete mode 100644 src/MC/fix_bond_create_angle.h diff --git a/doc/src/Commands_fix.rst b/doc/src/Commands_fix.rst index d5cfdf4ef4..1f42d3530d 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -42,7 +42,6 @@ OPT. * :doc:`bocs ` * :doc:`bond/break ` * :doc:`bond/create ` - * :doc:`bond/create/angle ` * :doc:`bond/react ` * :doc:`bond/swap ` * :doc:`box/relax ` diff --git a/doc/src/fix_bond_create.rst b/doc/src/fix_bond_create.rst index fab5d6f0f0..0c48a800c9 100644 --- a/doc/src/fix_bond_create.rst +++ b/doc/src/fix_bond_create.rst @@ -2,8 +2,6 @@ fix bond/create command ======================= -fix bond/create/angle command -============================= Syntax """""" @@ -19,8 +17,8 @@ Syntax * Rmin = 2 atoms separated by less than Rmin can bond (distance units) * bondtype = type of created bonds * zero or more keyword/value pairs may be appended to args -* keyword = *iparam* or *jparam* or *prob* or *atype* or *dtype* or *itype* or *aconstrain* - +* keyword = *iparam* or *jparam* or *prob* or *atype* or *dtype* or *itype* + .. parsed-literal:: *iparam* values = maxbond, newtype @@ -38,9 +36,6 @@ Syntax dihedraltype = type of created dihedrals *itype* value = impropertype impropertype = type of created impropers - *aconstrain* value = amin amax - amin = minimal angle at which new bonds can be created - amax = maximal angle at which new bonds can be created Examples """""""" @@ -50,7 +45,6 @@ Examples fix 5 all bond/create 10 1 2 0.8 1 fix 5 all bond/create 1 3 3 0.8 1 prob 0.5 85784 iparam 2 3 fix 5 all bond/create 1 3 3 0.8 1 prob 0.5 85784 iparam 2 3 atype 1 dtype 2 - fix 5 all bond/create/angle 10 1 2 1.122 1 aconstrain 120 180 prob 1 4928459 iparam 2 1 jparam 2 2 Description """"""""""" @@ -116,16 +110,7 @@ actually created. The *fraction* setting must be a value between 0.0 and 1.0. A uniform random number between 0.0 and 1.0 is generated and the eligible bond is only created if the random number < fraction. -The *aconstrain* keyword allows to specify a minimal and maximal angle -*amin* and *amax* between the two prospective bonding partners and a -third particle that is already bonded to one of the two partners. -Such a criterion can be important, for instance when new angle -potentials are simultaneously introduced after the formation of the -new bond. Without a restriction on the permissible angle, and for -stiffer angle potentials very large energies can arise and lead to -uncontrolled behavior. - -Any bond that is created is assigned a bond type of *bondtype*. +Any bond that is created is assigned a bond type of *bondtype* When a bond is created, data structures within LAMMPS that store bond topology are updated to reflect the creation. If the bond is part of @@ -252,11 +237,8 @@ Restrictions """""""""""" This fix is part of the MC package. It is only enabled if LAMMPS was -built with that package. See the :doc:`Build package ` doc page for more info. - -The *aconstrain* keyword is only available -when LAMMPS was built with the FixBondCreateAngle class. - +built with that package. See the :doc:`Build package ` +doc page for more info. Related commands """""""""""""""" diff --git a/src/MC/fix_bond_create.cpp b/src/MC/fix_bond_create.cpp index 7078fcad2a..629e6defff 100644 --- a/src/MC/fix_bond_create.cpp +++ b/src/MC/fix_bond_create.cpp @@ -79,11 +79,6 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) : int seed = 12345; atype = dtype = itype = 0; - constrainflag = 0; - constrainpass = 0; - amin = 0; - amax = 180; - int iarg = 8; while (iarg < narg) { if (strcmp(arg[iarg],"iparam") == 0) { @@ -125,20 +120,6 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) : itype = force->inumeric(FLERR,arg[iarg+1]); if (itype < 0) error->all(FLERR,"Illegal fix bond/create command"); iarg += 2; - } else if (strcmp(arg[iarg],"aconstrain") == 0) { - if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/create command"); - amin = force->numeric(FLERR,arg[iarg+1]); - amax = force->inumeric(FLERR,arg[iarg+2]); - if (amin >= amax) - error->all(FLERR,"Illegal fix bond/create command"); - if (amin < 0 || amin > 180) - error->all(FLERR,"Illegal fix bond/create command"); - if (amax < 0 || amax > 180) - error->all(FLERR,"Illegal fix bond/create command"); - amin = (3.14159265358979323846/180.0) * amin; - amax = (3.14159265358979323846/180.0) * amax; - constrainflag = 1; - iarg += 3; } else error->all(FLERR,"Illegal fix bond/create command"); } @@ -453,11 +434,6 @@ void FixBondCreate::post_integrate() rsq = delx*delx + dely*dely + delz*delz; if (rsq >= cutsq) continue; - if (constrainflag) { - constrainpass = constrain(i,j,amin,amax); - if (!constrainpass) continue; - } - if (rsq < distsq[i]) { partner[i] = tag[j]; distsq[i] = rsq; @@ -466,7 +442,6 @@ void FixBondCreate::post_integrate() partner[j] = tag[i]; distsq[j] = rsq; } - } } @@ -1431,13 +1406,6 @@ double FixBondCreate::memory_usage() /* ---------------------------------------------------------------------- */ -int FixBondCreate::constrain(int i, int j, double amin, double amax) -{ - return 1; -} - -/* ---------------------------------------------------------------------- */ - void FixBondCreate::print_bb() { for (int i = 0; i < atom->nlocal; i++) { diff --git a/src/MC/fix_bond_create.h b/src/MC/fix_bond_create.h index 2fc286623d..1e4b9a11c1 100644 --- a/src/MC/fix_bond_create.h +++ b/src/MC/fix_bond_create.h @@ -52,12 +52,9 @@ class FixBondCreate : public Fix { int btype,seed; int imaxbond,jmaxbond; int inewtype,jnewtype; - int constrainflag,constrainpass; - double amin,amax; double cutsq,fraction; int atype,dtype,itype; int angleflag,dihedralflag,improperflag; - int overflow; tagint lastcheck; @@ -87,8 +84,6 @@ class FixBondCreate : public Fix { void create_impropers(int); int dedup(int, int, tagint *); - virtual int constrain(int, int, double, double); - // DEBUG void print_bb(); diff --git a/src/MC/fix_bond_create_angle.cpp b/src/MC/fix_bond_create_angle.cpp deleted file mode 100644 index 7be5f2e276..0000000000 --- a/src/MC/fix_bond_create_angle.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------- - Contributing authors: - Joao Gregorio, Oliver Henrich (University of Strathclyde, Glasgow, UK) -------------------------------------------------------------------------- */ - -#include "fix_bond_create_angle.h" -#include "atom.h" -#include - -using namespace LAMMPS_NS; - -/* ---------------------------------------------------------------------- */ - -FixBondCreateAngle::FixBondCreateAngle(LAMMPS *lmp, int narg, char **arg) : - FixBondCreate(lmp, narg, arg) -{ - -} - -/* ---------------------------------------------------------------------- */ - -FixBondCreateAngle::~FixBondCreateAngle() -{ - -} - -/* ---------------------------------------------------------------------- */ - -int FixBondCreateAngle::constrain(int i, int j, double amin, double amax) -{ - double **x = atom->x; - tagint *tag = atom->tag; - tagint **bond_atom = atom->bond_atom; - int *num_bond = atom->num_bond; - int **nspecial = atom->nspecial; - tagint **special = atom->special; - int *mask = atom->mask; - int *type = atom->type; - - double v1x = 0.0; - double v1y = 0.0; - double v1z = 0.0; - double v2x = 0.0; - double v2y = 0.0; - double v2z = 0.0; - - int flag = 0; - - // pass if both atoms have no neighbors: bond is always formed - if (nspecial[i][0] == 0 && nspecial[j][0] == 0){ - flag = 1; - } - - // pass if i has at least one neighbor and angle constraint is met - if (nspecial[i][0] != 0 && nspecial[j][0] == 0){ - - // calculate first vector between i and j - v1x = x[i][0] - x[j][0]; - v1y = x[i][1] - x[j][1]; - v1z = x[i][2] - x[j][2]; - - // calculate second vector between i and its first neighbor - v2x = x[i][0] - x[atom->map(special[i][0])][0]; - v2y = x[i][1] - x[atom->map(special[i][0])][1]; - v2z = x[i][2] - x[atom->map(special[i][0])][2]; - - // calculate angle between both vectors - angle1 = acos((v1x*v2x + v1y*v2y + v1z*v2z)/ - (sqrt(v1x*v1x + v1y*v1y + v1z*v1z)*sqrt(v2x*v2x + v2y*v2y + v2z*v2z))); - // set flag if the angle constraint is met - if (amin <= angle1 && angle1 <= amax) { - flag = 1; - } - } - - // pass if j has at least one neighbor and angle constraint is met - if (nspecial[j][0] != 0 && nspecial[i][0] == 0){ - - // calculate first vector between j and i - v1x = x[j][0] - x[i][0]; - v1y = x[j][1] - x[i][1]; - v1z = x[j][2] - x[i][2]; - // calculate second vector between j and its first neighbor - v2x = x[j][0] - x[atom->map(special[j][0])][0]; - v2y = x[j][1] - x[atom->map(special[j][0])][1]; - v2z = x[j][2] - x[atom->map(special[j][0])][2]; - - // calculate angle between both vectors - angle1 = acos((v1x*v2x + v1y*v2y + v1z*v2z)/ - (sqrt(v1x*v1x + v1y*v1y + v1z*v1z)*sqrt(v2x*v2x + v2y*v2y + v2z*v2z))); - // set flag if angle constraint is met - if (amin <= angle1 && angle1 <= amax) { - flag = 1; - } - } - - // pass if both i and j have at least one neighbor and angle constraint is met - if (nspecial[i][0] != 0 && nspecial[j][0] != 0){ - - // Calculate 1st angle - // calculate first vector between i and j - v1x = x[i][0] - x[j][0]; - v1y = x[i][1] - x[j][1]; - v1z = x[i][2] - x[j][2]; - - // calculate second vector between i and its first neighbor - v2x = x[i][0] - x[atom->map(special[i][0])][0]; - v2y = x[i][1] - x[atom->map(special[i][0])][1]; - v2z = x[i][2] - x[atom->map(special[i][0])][2]; - - // calculate angle between both vectors - angle1 = acos((v1x*v2x + v1y*v2y + v1z*v2z)/ - (sqrt(v1x*v1x + v1y*v1y + v1z*v1z)*sqrt(v2x*v2x + v2y*v2y + v2z*v2z))); - - // Calculate 2nd angle - // calculate first vector between i and j - v1x = x[j][0] - x[i][0]; - v1y = x[j][1] - x[i][1]; - v1z = x[j][2] - x[i][2]; - - // calculate second vector between i and its first neighbor - v2x = x[j][0] - x[atom->map(special[j][0])][0]; - v2y = x[j][1] - x[atom->map(special[j][0])][1]; - v2z = x[j][2] - x[atom->map(special[j][0])][2]; - - // calculate angle between both vectors - angle2 = acos((v1x*v2x + v1y*v2y + v1z*v2z)/ - (sqrt(v1x*v1x + v1y*v1y + v1z*v1z)*sqrt(v2x*v2x + v2y*v2y + v2z*v2z))); - // set flag if the angle constraint is met - - if ((amin <= angle1 && angle1 <= amax) && (amin <= angle2 && angle2 <= amax)){ - flag = 1; - } - - } - - return flag; - -} diff --git a/src/MC/fix_bond_create_angle.h b/src/MC/fix_bond_create_angle.h deleted file mode 100644 index 6c5d607a0d..0000000000 --- a/src/MC/fix_bond_create_angle.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#ifdef FIX_CLASS - -FixStyle(bond/create/angle,FixBondCreateAngle) - -#else - -#ifndef LMP_FIX_BOND_CREATE_ANGLE_H -#define LMP_FIX_BOND_CREATE_ANGLE_H - -#include "fix_bond_create.h" - -namespace LAMMPS_NS { - -class FixBondCreateAngle : public FixBondCreate { - public: - FixBondCreateAngle(class LAMMPS *, int, char **); - ~FixBondCreateAngle(); - - private: - double angle1,angle2,amin,amax; - int constrain(int,int,double,double); -}; - -} - -#endif -#endif