-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpair_hybrid_softcore.cpp
96 lines (76 loc) · 3.35 KB
/
pair_hybrid_softcore.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, [email protected]
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.
------------------------------------------------------------------------- */
#include <string.h>
#include "pair_hybrid_softcore.h"
#include "force.h"
#include "error.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
PairHybridSoftcore::PairHybridSoftcore(LAMMPS *lmp) : PairHybrid(lmp)
{
}
/* ----------------------------------------------------------------------
modify parameters of the pair style and its sub-styles
------------------------------------------------------------------------- */
void PairHybridSoftcore::modify_params(int narg, char **arg)
{
if (narg == 0) error->all(FLERR,"Illegal pair_modify command");
// if 1st keyword is pair, apply other keywords to one sub-style
if (strcmp(arg[0],"pair") == 0) {
if (narg < 2) error->all(FLERR,"Illegal pair_modify command");
int m;
for (m = 0; m < nstyles; m++)
if (strcmp(arg[1],keywords[m]) == 0) break;
if (m == nstyles) error->all(FLERR,"Unknown pair_modify hybrid sub-style");
int iarg = 2;
if (multiple[m]) {
if (narg < 3) error->all(FLERR,"Illegal pair_modify command");
int multiflag = force->inumeric(FLERR,arg[2]);
for (m = 0; m < nstyles; m++)
if (strcmp(arg[1],keywords[m]) == 0 && multiflag == multiple[m]) break;
if (m == nstyles)
error->all(FLERR,"Unknown pair_modify hybrid sub-style");
iarg = 3;
}
// if 2nd keyword (after pair) is special:
// invoke modify_special() for the sub-style
if (iarg < narg && strcmp(arg[iarg],"special") == 0) {
if (narg < iarg+5)
error->all(FLERR,"Illegal pair_modify special command");
modify_special(m,narg-iarg,&arg[iarg+1]);
iarg += 5;
}
// if 2nd keyword (after pair) is compute/tally:
// set flag to register USER-TALLY computes accordingly
if (iarg < narg && strcmp(arg[iarg],"compute/tally") == 0) {
if (narg < iarg+2)
error->all(FLERR,"Illegal pair_modify compute/tally command");
if (strcmp(arg[iarg+1],"yes") == 0) {
compute_tally[m] = 1;
} else if (strcmp(arg[iarg+1],"no") == 0) {
compute_tally[m] = 0;
} else error->all(FLERR,"Illegal pair_modify compute/tally command");
iarg += 2;
}
// apply the remaining keywords to the base pair style itself and the
// sub-style except for "pair" and "special".
// the former is important for some keywords like "tail" or "compute"
if (narg-iarg > 0) {
//Pair::modify_params(narg-iarg,&arg[iarg]);
styles[m]->modify_params(narg-iarg,&arg[iarg]);
}
// apply all keywords to pair hybrid itself and every sub-style
} else {
Pair::modify_params(narg,arg);
for (int m = 0; m < nstyles; m++) styles[m]->modify_params(narg,arg);
}
}
/* ---------------------------------------------------------------------- */