From 46e7b6417603602bd02d2d104208e3204b06705a Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 21 Oct 2015 23:13:53 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@14157 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/force.cpp | 7 +++++-- src/force.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/force.cpp b/src/force.cpp index aa70874adf..f51b0c1818 100644 --- a/src/force.cpp +++ b/src/force.cpp @@ -198,10 +198,11 @@ Pair *Force::pair_creator(LAMMPS *lmp) return ptr to Pair class if matches word or matches hybrid sub-style if exact, then style name must be exact match to word if not exact, style name must contain word - return NULL if no match or multiple sub-styles match + if nsub > 0, match Nth hybrid sub-style + return NULL if no match or if nsub=0 and multiple sub-styles match ------------------------------------------------------------------------- */ -Pair *Force::pair_match(const char *word, int exact) +Pair *Force::pair_match(const char *word, int exact, int nsub) { int iwhich,count; @@ -216,6 +217,7 @@ Pair *Force::pair_match(const char *word, int exact) (!exact && strstr(hybrid->keywords[i],word))) { iwhich = i; count++; + if (nsub == count) return hybrid->styles[iwhich]; } if (count == 1) return hybrid->styles[iwhich]; @@ -227,6 +229,7 @@ Pair *Force::pair_match(const char *word, int exact) (!exact && strstr(hybrid->keywords[i],word))) { iwhich = i; count++; + if (nsub == count) return hybrid->styles[iwhich]; } if (count == 1) return hybrid->styles[iwhich]; } diff --git a/src/force.h b/src/force.h index a3fca51020..54b6612689 100644 --- a/src/force.h +++ b/src/force.h @@ -80,7 +80,7 @@ class Force : protected Pointers { void create_pair(const char *, int); class Pair *new_pair(const char *, int, int &); - class Pair *pair_match(const char *, int); + class Pair *pair_match(const char *, int, int nsub=0); void create_bond(const char *, int); class Bond *new_bond(const char *, int, int &);