1 |
< |
/* |
2 |
< |
* Shapes_FF.cpp |
3 |
< |
* oopse |
1 |
> |
/* |
2 |
> |
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
|
* |
4 |
< |
* Created by Chris Fennell on 10/20/04. |
5 |
< |
* Copyright 2004 __MyCompanyName__. All rights reserved. |
4 |
> |
* The University of Notre Dame grants you ("Licensee") a |
5 |
> |
* non-exclusive, royalty free, license to use, modify and |
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 |
19 |
+ |
* notice, this list of conditions and the following disclaimer. |
20 |
+ |
* |
21 |
+ |
* 3. Redistributions in binary form must reproduce the above copyright |
22 |
+ |
* notice, this list of conditions and the following disclaimer in the |
23 |
+ |
* documentation and/or other materials provided with the |
24 |
+ |
* distribution. |
25 |
+ |
* |
26 |
+ |
* This software is provided "AS IS," without a warranty of any |
27 |
+ |
* kind. All express or implied conditions, representations and |
28 |
+ |
* warranties, including any implied warranty of merchantability, |
29 |
+ |
* fitness for a particular purpose or non-infringement, are hereby |
30 |
+ |
* excluded. The University of Notre Dame and its licensors shall not |
31 |
+ |
* be liable for any damages suffered by licensee as a result of |
32 |
+ |
* using, modifying or distributing the software or its |
33 |
+ |
* derivatives. In no event will the University of Notre Dame or its |
34 |
+ |
* licensors be liable for any lost revenue, profit or data, or for |
35 |
+ |
* direct, indirect, special, consequential, incidental or punitive |
36 |
+ |
* damages, however caused and regardless of the theory of liability, |
37 |
+ |
* arising out of the use of or inability to use software, even if the |
38 |
+ |
* University of Notre Dame has been advised of the possibility of |
39 |
+ |
* such damages. |
40 |
|
*/ |
41 |
< |
|
41 |
> |
|
42 |
|
#include <stdlib.h> |
43 |
|
#include <stdio.h> |
44 |
|
#include <string.h> |
65 |
|
#include "UseTheForce/mpiForceField.h" |
66 |
|
#endif // is_mpi |
67 |
|
|
68 |
< |
using namespace std; |
68 |
> |
|
69 |
|
using namespace oopse; |
70 |
|
|
71 |
|
Shapes_FF::~Shapes_FF(){ |
104 |
|
|
105 |
|
char readLine[1024]; |
106 |
|
|
107 |
< |
string fileName; |
108 |
< |
string shapeFileName; |
109 |
< |
string tempString; |
107 |
> |
std::string fileName; |
108 |
> |
std::string shapeFileName; |
109 |
> |
std::string tempString; |
110 |
|
|
111 |
|
char *nameToken; |
112 |
|
char *delim = " ,;\t\n"; |
116 |
|
int nStrength = 0; |
117 |
|
int myATID; |
118 |
|
int isError; |
119 |
< |
string nameString; |
119 |
> |
std::string nameString; |
120 |
|
AtomType* at; |
121 |
|
DirectionalAtomType* dat; |
122 |
|
ShapeAtomType* st; |
123 |
|
|
124 |
< |
map<string, AtomType*>::iterator iter; |
124 |
> |
std::map<string, AtomType*>::iterator iter; |
125 |
|
|
126 |
|
// vectors for shape transfer to fortran |
127 |
< |
vector<RealSphericalHarmonic*> tempSHVector; |
128 |
< |
vector<int> contactL; |
129 |
< |
vector<int> contactM; |
130 |
< |
vector<int> contactFunc; |
131 |
< |
vector<double> contactCoeff; |
132 |
< |
vector<int> rangeL; |
133 |
< |
vector<int> rangeM; |
134 |
< |
vector<int> rangeFunc; |
135 |
< |
vector<double> rangeCoeff; |
136 |
< |
vector<int> strengthL; |
137 |
< |
vector<int> strengthM; |
138 |
< |
vector<int> strengthFunc; |
139 |
< |
vector<double> strengthCoeff; |
127 |
> |
std::vector<RealSphericalHarmonic*> tempSHVector; |
128 |
> |
std::vector<int> contactL; |
129 |
> |
std::vector<int> contactM; |
130 |
> |
std::vector<int> contactFunc; |
131 |
> |
std::vector<double> contactCoeff; |
132 |
> |
std::vector<int> rangeL; |
133 |
> |
std::vector<int> rangeM; |
134 |
> |
std::vector<int> rangeFunc; |
135 |
> |
std::vector<double> rangeCoeff; |
136 |
> |
std::vector<int> strengthL; |
137 |
> |
std::vector<int> strengthM; |
138 |
> |
std::vector<int> strengthFunc; |
139 |
> |
std::vector<double> strengthCoeff; |
140 |
|
|
141 |
|
// generate the force file name |
142 |
|
fileName = "Shapes.frc"; |
211 |
|
atomTypeMap.insert(make_pair(nameString, st)); |
212 |
|
|
213 |
|
} else { |
214 |
< |
// atomType map already contained this string (i.e. it was |
214 |
> |
// atomType map already contained this std::string (i.e. it was |
215 |
|
// declared in a previous block, and we just need to add |
216 |
|
// the shape-specific information for this AtomType: |
217 |
|
|
336 |
|
void Shapes_FF::initializeAtoms( int nAtoms, Atom** the_atoms ){ |
337 |
|
|
338 |
|
int i,j,k; |
339 |
< |
map<string, AtomType*>::iterator iter; |
339 |
> |
std::map<string, AtomType*>::iterator iter; |
340 |
|
|
341 |
|
// initialize the atoms |
342 |
|
DirectionalAtom* dAtom; |
347 |
|
double ji[3]; |
348 |
|
double inertialMat[3][3]; |
349 |
|
Mat3x3d momInt; |
350 |
< |
string myTypeString; |
350 |
> |
std::string myTypeString; |
351 |
|
|
352 |
|
bigContact = 0.0; |
353 |
|
|
354 |
|
for( i=0; i<nAtoms; i++ ){ |
355 |
|
|
356 |
< |
myTypeString = the_atoms[i]->getType(); |
356 |
> |
myTypeString = the_atoms[i]->getType().c_str(); |
357 |
|
iter = atomTypeMap.find(myTypeString); |
358 |
|
|
359 |
|
if (iter == atomTypeMap.end()) { |
360 |
|
sprintf( painCave.errMsg, |
361 |
|
"AtomType error, %s not found in force file.\n", |
362 |
< |
the_atoms[i]->getType() ); |
362 |
> |
the_atoms[i]->getType().c_str() ); |
363 |
|
painCave.isFatal = 1; |
364 |
|
simError(); |
365 |
|
} else { |
449 |
|
int nTokens; |
450 |
|
Mat3x3d momInert; |
451 |
|
RealSphericalHarmonic* rsh; |
452 |
< |
vector<RealSphericalHarmonic*> functionVector; |
452 |
> |
std::vector<RealSphericalHarmonic*> functionVector; |
453 |
|
ifstrstream shapeFile; |
454 |
< |
string tempString; |
454 |
> |
std::string tempString; |
455 |
|
|
456 |
|
shapeFile.open( shapeFileName.c_str() ); |
457 |
|
|
716 |
|
sigma = st->getContactValueAt(costheta, phi); |
717 |
|
range = st->getRangeValueAt(costheta, phi); |
718 |
|
|
719 |
< |
// cutoff for a shape is taken to be (2.5*rangeVal + contactVal) |
719 |
> |
// cutoff for a shape is taken to be (1.5*rangeVal + contactVal) |
720 |
|
tempCut = 1.5*range + sigma; |
721 |
|
|
722 |
|
if (tempCut > bigCut) bigCut = tempCut; |