6 |
|
* redistribute this software in source and binary code form, provided |
7 |
|
* that the following conditions are met: |
8 |
|
* |
9 |
< |
* 1. Acknowledgement of the program authors must be made in any |
10 |
< |
* publication of scientific results based in part on use of the |
11 |
< |
* program. An acceptable form of acknowledgement is citation of |
12 |
< |
* the article in which the program was described (Matthew |
13 |
< |
* A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
14 |
< |
* J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
15 |
< |
* Parallel Simulation Engine for Molecular Dynamics," |
16 |
< |
* J. Comput. Chem. 26, pp. 252-271 (2005)) |
17 |
< |
* |
18 |
< |
* 2. Redistributions of source code must retain the above copyright |
9 |
> |
* 1. Redistributions of source code must retain the above copyright |
10 |
|
* notice, this list of conditions and the following disclaimer. |
11 |
|
* |
12 |
< |
* 3. Redistributions in binary form must reproduce the above copyright |
12 |
> |
* 2. Redistributions in binary form must reproduce the above copyright |
13 |
|
* notice, this list of conditions and the following disclaimer in the |
14 |
|
* documentation and/or other materials provided with the |
15 |
|
* distribution. |
28 |
|
* arising out of the use of or inability to use software, even if the |
29 |
|
* University of Notre Dame has been advised of the possibility of |
30 |
|
* such damages. |
31 |
+ |
* |
32 |
+ |
* SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your |
33 |
+ |
* research, please cite the appropriate papers when you publish your |
34 |
+ |
* work. Good starting points are: |
35 |
+ |
* |
36 |
+ |
* [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
37 |
+ |
* [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
38 |
+ |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
39 |
+ |
* [4] Vardeman & Gezelter, in progress (2009). |
40 |
|
*/ |
41 |
|
|
42 |
|
#include "io/MetalNonMetalInteractionsSectionParser.hpp" |
47 |
|
#include "types/RepulsiveMorseInteractionType.hpp" |
48 |
|
#include "UseTheForce/ForceField.hpp" |
49 |
|
#include "utils/simError.h" |
50 |
< |
namespace oopse { |
50 |
> |
namespace OpenMD { |
51 |
|
|
52 |
|
MetalNonMetalInteractionsSectionParser::MetalNonMetalInteractionsSectionParser(ForceFieldOptions& options) : options_(options){ |
53 |
|
setSectionName("MetalNonMetalInteractions"); |
75 |
|
std::string at2 = tokenizer.nextToken(); |
76 |
|
std::string itype = tokenizer.nextToken(); |
77 |
|
|
78 |
< |
MetalNonMetalInteractionTypeEnum nbit = getMetalNonMetalInteractionTypeEnum(itype); |
78 |
> |
MetalNonMetalInteractionTypeEnum nbit = getMetalNonMetalInteractionTypeEnum(itype); |
79 |
|
nTokens -= 3; |
80 |
< |
NonBondedInteractionType* interactionType; |
80 |
> |
NonBondedInteractionType* interactionType; |
81 |
|
|
82 |
|
//switch is a nightmare to maintain |
83 |
|
switch(nbit) { |
84 |
|
case MAW : |
85 |
< |
if (nTokens < 4) { |
86 |
< |
sprintf(painCave.errMsg, "MetalNonMetalInteractionsSectionParser Error: Not enough tokens at line %d\n", |
87 |
< |
lineNo); |
88 |
< |
painCave.isFatal = 1; |
89 |
< |
simError(); |
90 |
< |
} else { |
91 |
< |
RealType r_e = tokenizer.nextTokenAsDouble(); |
92 |
< |
RealType D_e = tokenizer.nextTokenAsDouble(); |
93 |
< |
RealType beta = tokenizer.nextTokenAsDouble(); |
94 |
< |
RealType alpha = tokenizer.nextTokenAsDouble(); |
95 |
< |
interactionType = new MAWInteractionType(D_e, beta, r_e, alpha); |
96 |
< |
} |
97 |
< |
break; |
98 |
< |
|
85 |
> |
if (nTokens < 5) { |
86 |
> |
sprintf(painCave.errMsg, "MetalNonMetalInteractionsSectionParser Error: Not enough tokens at line %d\n", |
87 |
> |
lineNo); |
88 |
> |
painCave.isFatal = 1; |
89 |
> |
simError(); |
90 |
> |
} else { |
91 |
> |
RealType r_e = tokenizer.nextTokenAsDouble(); |
92 |
> |
RealType D_e = tokenizer.nextTokenAsDouble(); |
93 |
> |
RealType beta = tokenizer.nextTokenAsDouble(); |
94 |
> |
RealType ca1 = tokenizer.nextTokenAsDouble(); |
95 |
> |
RealType cb1 = tokenizer.nextTokenAsDouble(); |
96 |
> |
interactionType = new MAWInteractionType(D_e, beta, r_e, ca1, cb1); |
97 |
> |
} |
98 |
> |
break; |
99 |
> |
|
100 |
|
case ShiftedMorse : |
101 |
< |
if (nTokens < 3) { |
102 |
< |
sprintf(painCave.errMsg, "MetalNonMetalInteractionsSectionParser Error: Not enough tokens at line %d\n", |
103 |
< |
lineNo); |
104 |
< |
painCave.isFatal = 1; |
105 |
< |
simError(); |
106 |
< |
} else { |
107 |
< |
RealType r0 = tokenizer.nextTokenAsDouble(); |
108 |
< |
RealType D0 = tokenizer.nextTokenAsDouble(); |
109 |
< |
RealType beta0 = tokenizer.nextTokenAsDouble(); |
110 |
< |
interactionType = new ShiftedMorseInteractionType(D0, beta0, r0); |
111 |
< |
} |
112 |
< |
break; |
101 |
> |
if (nTokens < 3) { |
102 |
> |
sprintf(painCave.errMsg, "MetalNonMetalInteractionsSectionParser Error: Not enough tokens at line %d\n", |
103 |
> |
lineNo); |
104 |
> |
painCave.isFatal = 1; |
105 |
> |
simError(); |
106 |
> |
} else { |
107 |
> |
RealType r0 = tokenizer.nextTokenAsDouble(); |
108 |
> |
RealType D0 = tokenizer.nextTokenAsDouble(); |
109 |
> |
RealType beta0 = tokenizer.nextTokenAsDouble(); |
110 |
> |
interactionType = new ShiftedMorseInteractionType(D0, beta0, r0); |
111 |
> |
} |
112 |
> |
break; |
113 |
|
|
114 |
< |
case RepulsiveMorse : |
115 |
< |
if (nTokens < 3) { |
116 |
< |
sprintf(painCave.errMsg, "MetalNonMetalInteractionsSectionParser Error: Not enough tokens at line %d\n", |
117 |
< |
lineNo); |
118 |
< |
painCave.isFatal = 1; |
119 |
< |
simError(); |
120 |
< |
} else { |
121 |
< |
RealType r0 = tokenizer.nextTokenAsDouble(); |
122 |
< |
RealType D0 = tokenizer.nextTokenAsDouble(); |
123 |
< |
RealType beta0 = tokenizer.nextTokenAsDouble(); |
124 |
< |
interactionType = new RepulsiveMorseInteractionType(D0, beta0, r0); |
125 |
< |
} |
126 |
< |
break; |
114 |
> |
case RepulsiveMorse : |
115 |
> |
if (nTokens < 3) { |
116 |
> |
sprintf(painCave.errMsg, "MetalNonMetalInteractionsSectionParser Error: Not enough tokens at line %d\n", |
117 |
> |
lineNo); |
118 |
> |
painCave.isFatal = 1; |
119 |
> |
simError(); |
120 |
> |
} else { |
121 |
> |
RealType r0 = tokenizer.nextTokenAsDouble(); |
122 |
> |
RealType D0 = tokenizer.nextTokenAsDouble(); |
123 |
> |
RealType beta0 = tokenizer.nextTokenAsDouble(); |
124 |
> |
interactionType = new RepulsiveMorseInteractionType(D0, beta0, r0); |
125 |
> |
} |
126 |
> |
break; |
127 |
|
|
128 |
|
case LennardJones : |
129 |
< |
if (nTokens < 2) { |
130 |
< |
sprintf(painCave.errMsg, "MetalNonMetalInteractionsSectionParser Error: Not enough tokens at line %d\n", |
131 |
< |
lineNo); |
132 |
< |
painCave.isFatal = 1; |
133 |
< |
simError(); |
134 |
< |
} else { |
135 |
< |
RealType sigma = tokenizer.nextTokenAsDouble(); |
136 |
< |
RealType epsilon = tokenizer.nextTokenAsDouble(); |
137 |
< |
interactionType = new LennardJonesInteractionType(sigma, epsilon); |
138 |
< |
} |
139 |
< |
break; |
129 |
> |
if (nTokens < 2) { |
130 |
> |
sprintf(painCave.errMsg, "MetalNonMetalInteractionsSectionParser Error: Not enough tokens at line %d\n", |
131 |
> |
lineNo); |
132 |
> |
painCave.isFatal = 1; |
133 |
> |
simError(); |
134 |
> |
} else { |
135 |
> |
RealType sigma = tokenizer.nextTokenAsDouble(); |
136 |
> |
RealType epsilon = tokenizer.nextTokenAsDouble(); |
137 |
> |
interactionType = new LennardJonesInteractionType(sigma, epsilon); |
138 |
> |
} |
139 |
> |
break; |
140 |
|
|
141 |
|
case Unknown : |
142 |
|
default: |
162 |
|
return i == stringToEnumMap_.end() ? Unknown : i->second; |
163 |
|
} |
164 |
|
|
165 |
< |
} //end namespace oopse |
165 |
> |
} //end namespace OpenMD |
166 |
|
|