Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
a1752463
Commit
a1752463
authored
Aug 18, 2009
by
Peter Eastman
Browse files
Fixed errors and warnings under Windows
parent
ae2a11aa
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
35 additions
and
56 deletions
+35
-56
examples/HelloArgon.cpp
examples/HelloArgon.cpp
+0
-5
examples/HelloEthane.cpp
examples/HelloEthane.cpp
+0
-1
examples/HelloSodiumChloride.cpp
examples/HelloSodiumChloride.cpp
+0
-1
examples/HelloWaterBox.cpp
examples/HelloWaterBox.cpp
+0
-1
libraries/lepton/src/ExpressionProgram.cpp
libraries/lepton/src/ExpressionProgram.cpp
+5
-5
libraries/lepton/src/ParsedExpression.cpp
libraries/lepton/src/ParsedExpression.cpp
+9
-8
libraries/lepton/src/Parser.cpp
libraries/lepton/src/Parser.cpp
+7
-7
olla/include/openmm/Platform.h
olla/include/openmm/Platform.h
+0
-14
openmmapi/include/openmm/internal/windowsExport.h
openmmapi/include/openmm/internal/windowsExport.h
+2
-2
platforms/reference/src/ReferenceKernels.cpp
platforms/reference/src/ReferenceKernels.cpp
+2
-2
platforms/reference/src/SimTKReference/ReferenceCustomNonbondedIxn.cpp
...erence/src/SimTKReference/ReferenceCustomNonbondedIxn.cpp
+8
-8
platforms/reference/src/SimTKReference/ReferenceLJCoulombIxn.cpp
...ms/reference/src/SimTKReference/ReferenceLJCoulombIxn.cpp
+2
-2
No files found.
examples/HelloArgon.cpp
View file @
a1752463
...
@@ -11,11 +11,6 @@
...
@@ -11,11 +11,6 @@
// other visualization tool to produce an animation of the resulting trajectory.
// other visualization tool to produce an animation of the resulting trajectory.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Suppress irrelevant warning from Microsoft's compiler.
#ifdef _MSC_VER
#pragma warning(disable:4251) // no dll interface for some classes
#endif
#include "OpenMM.h"
#include "OpenMM.h"
#include <cstdio>
#include <cstdio>
...
...
examples/HelloEthane.cpp
View file @
a1752463
...
@@ -202,7 +202,6 @@ int main() {
...
@@ -202,7 +202,6 @@ int main() {
// Suppress irrelevant warnings from Microsoft's compiler.
// Suppress irrelevant warnings from Microsoft's compiler.
#ifdef _MSC_VER
#ifdef _MSC_VER
#pragma warning(disable:4996) // sprintf is unsafe
#pragma warning(disable:4996) // sprintf is unsafe
#pragma warning(disable:4251) // no dll interface for some classes
#endif
#endif
#include "OpenMM.h"
#include "OpenMM.h"
...
...
examples/HelloSodiumChloride.cpp
View file @
a1752463
...
@@ -160,7 +160,6 @@ int main() {
...
@@ -160,7 +160,6 @@ int main() {
// Suppress irrelevant warnings from Microsoft's compiler.
// Suppress irrelevant warnings from Microsoft's compiler.
#ifdef _MSC_VER
#ifdef _MSC_VER
#pragma warning(disable:4996) // sprintf is unsafe
#pragma warning(disable:4996) // sprintf is unsafe
#pragma warning(disable:4251) // no dll interface for some classes
#endif
#endif
#include "OpenMM.h"
#include "OpenMM.h"
...
...
examples/HelloWaterBox.cpp
View file @
a1752463
...
@@ -170,7 +170,6 @@ int main() {
...
@@ -170,7 +170,6 @@ int main() {
// Suppress irrelevant warnings from Microsoft's compiler.
// Suppress irrelevant warnings from Microsoft's compiler.
#ifdef _MSC_VER
#ifdef _MSC_VER
#pragma warning(disable:4996) // sprintf is unsafe
#pragma warning(disable:4996) // sprintf is unsafe
#pragma warning(disable:4251) // no dll interface for some classes
#endif
#endif
#include "OpenMM.h"
#include "OpenMM.h"
...
...
libraries/lepton/src/ExpressionProgram.cpp
View file @
a1752463
...
@@ -42,7 +42,7 @@ ExpressionProgram::ExpressionProgram() : maxArgs(0), stackSize(0) {
...
@@ -42,7 +42,7 @@ ExpressionProgram::ExpressionProgram() : maxArgs(0), stackSize(0) {
ExpressionProgram
::
ExpressionProgram
(
const
ParsedExpression
&
expression
)
:
maxArgs
(
0
),
stackSize
(
0
)
{
ExpressionProgram
::
ExpressionProgram
(
const
ParsedExpression
&
expression
)
:
maxArgs
(
0
),
stackSize
(
0
)
{
buildProgram
(
expression
.
getRootNode
());
buildProgram
(
expression
.
getRootNode
());
int
currentStackSize
=
0
;
int
currentStackSize
=
0
;
for
(
int
i
=
0
;
i
<
operations
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
(
int
)
operations
.
size
();
i
++
)
{
int
args
=
operations
[
i
]
->
getNumArguments
();
int
args
=
operations
[
i
]
->
getNumArguments
();
if
(
args
>
maxArgs
)
if
(
args
>
maxArgs
)
maxArgs
=
args
;
maxArgs
=
args
;
...
@@ -53,7 +53,7 @@ ExpressionProgram::ExpressionProgram(const ParsedExpression& expression) : maxAr
...
@@ -53,7 +53,7 @@ ExpressionProgram::ExpressionProgram(const ParsedExpression& expression) : maxAr
}
}
ExpressionProgram
::~
ExpressionProgram
()
{
ExpressionProgram
::~
ExpressionProgram
()
{
for
(
int
i
=
0
;
i
<
operations
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
operations
.
size
();
i
++
)
delete
operations
[
i
];
delete
operations
[
i
];
}
}
...
@@ -65,7 +65,7 @@ ExpressionProgram& ExpressionProgram::operator=(const ExpressionProgram& program
...
@@ -65,7 +65,7 @@ ExpressionProgram& ExpressionProgram::operator=(const ExpressionProgram& program
maxArgs
=
program
.
maxArgs
;
maxArgs
=
program
.
maxArgs
;
stackSize
=
program
.
stackSize
;
stackSize
=
program
.
stackSize
;
operations
.
resize
(
program
.
operations
.
size
());
operations
.
resize
(
program
.
operations
.
size
());
for
(
int
i
=
0
;
i
<
operations
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
operations
.
size
();
i
++
)
operations
[
i
]
=
program
.
operations
[
i
]
->
clone
();
operations
[
i
]
=
program
.
operations
[
i
]
->
clone
();
return
*
this
;
return
*
this
;
}
}
...
@@ -93,10 +93,10 @@ double ExpressionProgram::evaluate() const {
...
@@ -93,10 +93,10 @@ double ExpressionProgram::evaluate() const {
}
}
double
ExpressionProgram
::
evaluate
(
const
std
::
map
<
std
::
string
,
double
>&
variables
)
const
{
double
ExpressionProgram
::
evaluate
(
const
std
::
map
<
std
::
string
,
double
>&
variables
)
const
{
vector
<
double
>
args
(
max
Args
);
vector
<
double
>
args
(
max
(
maxArgs
,
1
)
);
vector
<
double
>
stack
(
stackSize
);
vector
<
double
>
stack
(
stackSize
);
int
stackPointer
=
0
;
int
stackPointer
=
0
;
for
(
int
i
=
0
;
i
<
operations
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
(
int
)
operations
.
size
();
i
++
)
{
int
numArgs
=
operations
[
i
]
->
getNumArguments
();
int
numArgs
=
operations
[
i
]
->
getNumArguments
();
for
(
int
j
=
0
;
j
<
numArgs
;
j
++
)
for
(
int
j
=
0
;
j
<
numArgs
;
j
++
)
args
[
j
]
=
stack
[
--
stackPointer
];
args
[
j
]
=
stack
[
--
stackPointer
];
...
...
libraries/lepton/src/ParsedExpression.cpp
View file @
a1752463
...
@@ -54,8 +54,9 @@ double ParsedExpression::evaluate(const std::map<std::string, double>& variables
...
@@ -54,8 +54,9 @@ double ParsedExpression::evaluate(const std::map<std::string, double>& variables
}
}
double
ParsedExpression
::
evaluate
(
const
ExpressionTreeNode
&
node
,
const
map
<
string
,
double
>&
variables
)
{
double
ParsedExpression
::
evaluate
(
const
ExpressionTreeNode
&
node
,
const
map
<
string
,
double
>&
variables
)
{
vector
<
double
>
args
(
node
.
getChildren
().
size
());
int
numArgs
=
node
.
getChildren
().
size
();
for
(
int
i
=
0
;
i
<
args
.
size
();
i
++
)
vector
<
double
>
args
(
max
(
numArgs
,
1
));
for
(
int
i
=
0
;
i
<
numArgs
;
i
++
)
args
[
i
]
=
evaluate
(
node
.
getChildren
()[
i
],
variables
);
args
[
i
]
=
evaluate
(
node
.
getChildren
()[
i
],
variables
);
return
node
.
getOperation
().
evaluate
(
&
args
[
0
],
variables
);
return
node
.
getOperation
().
evaluate
(
&
args
[
0
],
variables
);
}
}
...
@@ -84,19 +85,19 @@ ExpressionTreeNode ParsedExpression::preevaluateVariables(const ExpressionTreeNo
...
@@ -84,19 +85,19 @@ ExpressionTreeNode ParsedExpression::preevaluateVariables(const ExpressionTreeNo
return
ExpressionTreeNode
(
new
Operation
::
Constant
(
iter
->
second
));
return
ExpressionTreeNode
(
new
Operation
::
Constant
(
iter
->
second
));
}
}
vector
<
ExpressionTreeNode
>
children
(
node
.
getChildren
().
size
());
vector
<
ExpressionTreeNode
>
children
(
node
.
getChildren
().
size
());
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
children
.
size
();
i
++
)
children
[
i
]
=
preevaluateVariables
(
node
.
getChildren
()[
i
],
variables
);
children
[
i
]
=
preevaluateVariables
(
node
.
getChildren
()[
i
],
variables
);
return
ExpressionTreeNode
(
node
.
getOperation
().
clone
(),
children
);
return
ExpressionTreeNode
(
node
.
getOperation
().
clone
(),
children
);
}
}
ExpressionTreeNode
ParsedExpression
::
precalculateConstantSubexpressions
(
const
ExpressionTreeNode
&
node
)
{
ExpressionTreeNode
ParsedExpression
::
precalculateConstantSubexpressions
(
const
ExpressionTreeNode
&
node
)
{
vector
<
ExpressionTreeNode
>
children
(
node
.
getChildren
().
size
());
vector
<
ExpressionTreeNode
>
children
(
node
.
getChildren
().
size
());
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
children
.
size
();
i
++
)
children
[
i
]
=
precalculateConstantSubexpressions
(
node
.
getChildren
()[
i
]);
children
[
i
]
=
precalculateConstantSubexpressions
(
node
.
getChildren
()[
i
]);
ExpressionTreeNode
result
=
ExpressionTreeNode
(
node
.
getOperation
().
clone
(),
children
);
ExpressionTreeNode
result
=
ExpressionTreeNode
(
node
.
getOperation
().
clone
(),
children
);
if
(
node
.
getOperation
().
getId
()
==
Operation
::
VARIABLE
)
if
(
node
.
getOperation
().
getId
()
==
Operation
::
VARIABLE
)
return
result
;
return
result
;
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
children
.
size
();
i
++
)
if
(
children
[
i
].
getOperation
().
getId
()
!=
Operation
::
CONSTANT
)
if
(
children
[
i
].
getOperation
().
getId
()
!=
Operation
::
CONSTANT
)
return
result
;
return
result
;
return
ExpressionTreeNode
(
new
Operation
::
Constant
(
evaluate
(
result
,
map
<
string
,
double
>
())));
return
ExpressionTreeNode
(
new
Operation
::
Constant
(
evaluate
(
result
,
map
<
string
,
double
>
())));
...
@@ -104,7 +105,7 @@ ExpressionTreeNode ParsedExpression::precalculateConstantSubexpressions(const Ex
...
@@ -104,7 +105,7 @@ ExpressionTreeNode ParsedExpression::precalculateConstantSubexpressions(const Ex
ExpressionTreeNode
ParsedExpression
::
substituteSimplerExpression
(
const
ExpressionTreeNode
&
node
)
{
ExpressionTreeNode
ParsedExpression
::
substituteSimplerExpression
(
const
ExpressionTreeNode
&
node
)
{
vector
<
ExpressionTreeNode
>
children
(
node
.
getChildren
().
size
());
vector
<
ExpressionTreeNode
>
children
(
node
.
getChildren
().
size
());
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
children
.
size
();
i
++
)
children
[
i
]
=
substituteSimplerExpression
(
node
.
getChildren
()[
i
]);
children
[
i
]
=
substituteSimplerExpression
(
node
.
getChildren
()[
i
]);
switch
(
node
.
getOperation
().
getId
())
{
switch
(
node
.
getOperation
().
getId
())
{
case
Operation
::
ADD
:
case
Operation
::
ADD
:
...
@@ -212,7 +213,7 @@ ParsedExpression ParsedExpression::differentiate(const std::string& variable) co
...
@@ -212,7 +213,7 @@ ParsedExpression ParsedExpression::differentiate(const std::string& variable) co
ExpressionTreeNode
ParsedExpression
::
differentiate
(
const
ExpressionTreeNode
&
node
,
const
std
::
string
&
variable
)
{
ExpressionTreeNode
ParsedExpression
::
differentiate
(
const
ExpressionTreeNode
&
node
,
const
std
::
string
&
variable
)
{
vector
<
ExpressionTreeNode
>
childDerivs
(
node
.
getChildren
().
size
());
vector
<
ExpressionTreeNode
>
childDerivs
(
node
.
getChildren
().
size
());
for
(
int
i
=
0
;
i
<
childDerivs
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
childDerivs
.
size
();
i
++
)
childDerivs
[
i
]
=
differentiate
(
node
.
getChildren
()[
i
],
variable
);
childDerivs
[
i
]
=
differentiate
(
node
.
getChildren
()[
i
],
variable
);
return
node
.
getOperation
().
differentiate
(
node
.
getChildren
(),
childDerivs
,
variable
);
return
node
.
getOperation
().
differentiate
(
node
.
getChildren
(),
childDerivs
,
variable
);
}
}
...
@@ -231,7 +232,7 @@ ostream& Lepton::operator<<(ostream& out, const ExpressionTreeNode& node) {
...
@@ -231,7 +232,7 @@ ostream& Lepton::operator<<(ostream& out, const ExpressionTreeNode& node) {
out
<<
node
.
getOperation
().
getName
();
out
<<
node
.
getOperation
().
getName
();
if
(
node
.
getChildren
().
size
()
>
0
)
{
if
(
node
.
getChildren
().
size
()
>
0
)
{
out
<<
"("
;
out
<<
"("
;
for
(
int
i
=
0
;
i
<
node
.
getChildren
().
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
(
int
)
node
.
getChildren
().
size
();
i
++
)
{
if
(
i
>
0
)
if
(
i
>
0
)
out
<<
", "
;
out
<<
", "
;
out
<<
node
.
getChildren
()[
i
];
out
<<
node
.
getChildren
()[
i
];
...
...
libraries/lepton/src/Parser.cpp
View file @
a1752463
...
@@ -76,7 +76,7 @@ ParseToken Parser::getNextToken(string expression, int start) {
...
@@ -76,7 +76,7 @@ ParseToken Parser::getNextToken(string expression, int start) {
if
(
c
==
' '
)
{
if
(
c
==
' '
)
{
// White space
// White space
for
(
int
pos
=
start
+
1
;
pos
<
expression
.
size
();
pos
++
)
{
for
(
int
pos
=
start
+
1
;
pos
<
(
int
)
expression
.
size
();
pos
++
)
{
if
(
expression
[
pos
]
!=
' '
)
if
(
expression
[
pos
]
!=
' '
)
return
ParseToken
(
expression
.
substr
(
start
,
pos
-
start
),
ParseToken
::
Whitespace
);
return
ParseToken
(
expression
.
substr
(
start
,
pos
-
start
),
ParseToken
::
Whitespace
);
}
}
...
@@ -88,7 +88,7 @@ ParseToken Parser::getNextToken(string expression, int start) {
...
@@ -88,7 +88,7 @@ ParseToken Parser::getNextToken(string expression, int start) {
bool
foundDecimal
=
(
c
==
'.'
);
bool
foundDecimal
=
(
c
==
'.'
);
bool
foundExp
=
false
;
bool
foundExp
=
false
;
int
pos
;
int
pos
;
for
(
pos
=
start
+
1
;
pos
<
expression
.
size
();
pos
++
)
{
for
(
pos
=
start
+
1
;
pos
<
(
int
)
expression
.
size
();
pos
++
)
{
c
=
expression
[
pos
];
c
=
expression
[
pos
];
if
(
Digits
.
find
(
c
)
!=
string
::
npos
)
if
(
Digits
.
find
(
c
)
!=
string
::
npos
)
continue
;
continue
;
...
@@ -98,7 +98,7 @@ ParseToken Parser::getNextToken(string expression, int start) {
...
@@ -98,7 +98,7 @@ ParseToken Parser::getNextToken(string expression, int start) {
}
}
if
((
c
==
'e'
||
c
==
'E'
)
&&
!
foundExp
)
{
if
((
c
==
'e'
||
c
==
'E'
)
&&
!
foundExp
)
{
foundExp
=
true
;
foundExp
=
true
;
if
(
pos
<
expression
.
size
()
-
1
&&
expression
[
pos
+
1
]
==
'-'
)
if
(
pos
<
(
int
)
expression
.
size
()
-
1
&&
expression
[
pos
+
1
]
==
'-'
)
pos
++
;
pos
++
;
continue
;
continue
;
}
}
...
@@ -109,7 +109,7 @@ ParseToken Parser::getNextToken(string expression, int start) {
...
@@ -109,7 +109,7 @@ ParseToken Parser::getNextToken(string expression, int start) {
// A variable, function, or left parenthesis
// A variable, function, or left parenthesis
for
(
int
pos
=
start
;
pos
<
expression
.
size
();
pos
++
)
{
for
(
int
pos
=
start
;
pos
<
(
int
)
expression
.
size
();
pos
++
)
{
c
=
expression
[
pos
];
c
=
expression
[
pos
];
if
(
c
==
'('
)
if
(
c
==
'('
)
return
ParseToken
(
expression
.
substr
(
start
,
pos
-
start
+
1
),
ParseToken
::
Function
);
return
ParseToken
(
expression
.
substr
(
start
,
pos
-
start
+
1
),
ParseToken
::
Function
);
...
@@ -122,7 +122,7 @@ ParseToken Parser::getNextToken(string expression, int start) {
...
@@ -122,7 +122,7 @@ ParseToken Parser::getNextToken(string expression, int start) {
vector
<
ParseToken
>
Parser
::
tokenize
(
string
expression
)
{
vector
<
ParseToken
>
Parser
::
tokenize
(
string
expression
)
{
vector
<
ParseToken
>
tokens
;
vector
<
ParseToken
>
tokens
;
int
pos
=
0
;
int
pos
=
0
;
while
(
pos
<
expression
.
size
())
{
while
(
pos
<
(
int
)
expression
.
size
())
{
ParseToken
token
=
getNextToken
(
expression
,
pos
);
ParseToken
token
=
getNextToken
(
expression
,
pos
);
if
(
token
.
getType
()
!=
ParseToken
::
Whitespace
)
if
(
token
.
getType
()
!=
ParseToken
::
Whitespace
)
tokens
.
push_back
(
token
);
tokens
.
push_back
(
token
);
...
@@ -176,7 +176,7 @@ ExpressionTreeNode Parser::parsePrecedence(const vector<ParseToken>& tokens, int
...
@@ -176,7 +176,7 @@ ExpressionTreeNode Parser::parsePrecedence(const vector<ParseToken>& tokens, int
bool
moreArgs
;
bool
moreArgs
;
do
{
do
{
args
.
push_back
(
parsePrecedence
(
tokens
,
pos
,
customFunctions
,
0
));
args
.
push_back
(
parsePrecedence
(
tokens
,
pos
,
customFunctions
,
0
));
moreArgs
=
(
pos
<
tokens
.
size
()
&&
tokens
[
pos
].
getType
()
==
ParseToken
::
Comma
);
moreArgs
=
(
pos
<
(
int
)
tokens
.
size
()
&&
tokens
[
pos
].
getType
()
==
ParseToken
::
Comma
);
if
(
moreArgs
)
if
(
moreArgs
)
pos
++
;
pos
++
;
}
while
(
moreArgs
);
}
while
(
moreArgs
);
...
@@ -195,7 +195,7 @@ ExpressionTreeNode Parser::parsePrecedence(const vector<ParseToken>& tokens, int
...
@@ -195,7 +195,7 @@ ExpressionTreeNode Parser::parsePrecedence(const vector<ParseToken>& tokens, int
// Now deal with the next binary operator.
// Now deal with the next binary operator.
while
(
pos
<
tokens
.
size
()
&&
tokens
[
pos
].
getType
()
==
ParseToken
::
Operator
)
{
while
(
pos
<
(
int
)
tokens
.
size
()
&&
tokens
[
pos
].
getType
()
==
ParseToken
::
Operator
)
{
token
=
tokens
[
pos
];
token
=
tokens
[
pos
];
int
op
=
Operators
.
find
(
token
.
getText
());
int
op
=
Operators
.
find
(
token
.
getText
());
int
opPrecedence
=
Precedence
[
op
];
int
opPrecedence
=
Precedence
[
op
];
...
...
olla/include/openmm/Platform.h
View file @
a1752463
...
@@ -248,24 +248,10 @@ protected:
...
@@ -248,24 +248,10 @@ protected:
const
ContextImpl
&
getContextImpl
(
const
Context
&
context
)
const
;
const
ContextImpl
&
getContextImpl
(
const
Context
&
context
)
const
;
std
::
vector
<
std
::
string
>
platformProperties
;
std
::
vector
<
std
::
string
>
platformProperties
;
private:
private:
// Retarded visual studio compiler complains about being unable to
// export private stl class members.
// This stanza explains that it should temporarily shut up.
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4251)
#endif
std
::
map
<
std
::
string
,
KernelFactory
*>
kernelFactories
;
std
::
map
<
std
::
string
,
KernelFactory
*>
kernelFactories
;
std
::
map
<
std
::
string
,
StreamFactory
*>
streamFactories
;
std
::
map
<
std
::
string
,
StreamFactory
*>
streamFactories
;
std
::
map
<
std
::
string
,
std
::
string
>
defaultProperties
;
std
::
map
<
std
::
string
,
std
::
string
>
defaultProperties
;
static
std
::
vector
<
Platform
*>&
getPlatforms
();
static
std
::
vector
<
Platform
*>&
getPlatforms
();
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
};
};
}
// namespace OpenMM
}
// namespace OpenMM
...
...
openmmapi/include/openmm/internal/windowsExport.h
View file @
a1752463
...
@@ -25,10 +25,10 @@
...
@@ -25,10 +25,10 @@
#ifdef _MSC_VER
#ifdef _MSC_VER
// We don't want to hear about how sprintf is "unsafe".
// We don't want to hear about how sprintf is "unsafe".
#pragma warning(disable:4996)
#pragma warning(disable:4996)
#if defined(OPENMM_BUILDING_SHARED_LIBRARY)
#define OPENMM_EXPORT __declspec(dllexport)
// Keep MS VC++ quiet about lack of dll export of private members.
// Keep MS VC++ quiet about lack of dll export of private members.
#pragma warning(disable:4251)
#pragma warning(disable:4251)
#if defined(OPENMM_BUILDING_SHARED_LIBRARY)
#define OPENMM_EXPORT __declspec(dllexport)
#elif defined(OPENMM_BUILDING_STATIC_LIBRARY) || defined(OPENMM_USE_STATIC_LIBRARIES)
#elif defined(OPENMM_BUILDING_STATIC_LIBRARY) || defined(OPENMM_USE_STATIC_LIBRARIES)
#define OPENMM_EXPORT
#define OPENMM_EXPORT
#else
#else
...
...
platforms/reference/src/ReferenceKernels.cpp
View file @
a1752463
...
@@ -565,7 +565,7 @@ void ReferenceCalcCustomNonbondedForceKernel::executeForces(ContextImpl& context
...
@@ -565,7 +565,7 @@ void ReferenceCalcCustomNonbondedForceKernel::executeForces(ContextImpl& context
if
(
periodic
)
if
(
periodic
)
ixn
.
setPeriodic
(
periodicBoxSize
);
ixn
.
setPeriodic
(
periodicBoxSize
);
map
<
string
,
double
>
globalParameters
;
map
<
string
,
double
>
globalParameters
;
for
(
int
i
=
0
;
i
<
globalParameterNames
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
globalParameters
[
globalParameterNames
[
i
]]
=
context
.
getParameter
(
globalParameterNames
[
i
]);
globalParameters
[
globalParameterNames
[
i
]]
=
context
.
getParameter
(
globalParameterNames
[
i
]);
ixn
.
calculatePairIxn
(
numParticles
,
posData
,
particleParamArray
,
exclusionArray
,
0
,
globalParameters
,
forceData
,
0
,
0
);
ixn
.
calculatePairIxn
(
numParticles
,
posData
,
particleParamArray
,
exclusionArray
,
0
,
globalParameters
,
forceData
,
0
,
0
);
ixn
.
calculateExceptionIxn
(
numExceptions
,
exceptionIndexArray
,
posData
,
exceptionParamArray
,
globalParameters
,
forceData
,
0
,
0
);
ixn
.
calculateExceptionIxn
(
numExceptions
,
exceptionIndexArray
,
posData
,
exceptionParamArray
,
globalParameters
,
forceData
,
0
,
0
);
...
@@ -584,7 +584,7 @@ double ReferenceCalcCustomNonbondedForceKernel::executeEnergy(ContextImpl& conte
...
@@ -584,7 +584,7 @@ double ReferenceCalcCustomNonbondedForceKernel::executeEnergy(ContextImpl& conte
if
(
periodic
)
if
(
periodic
)
ixn
.
setPeriodic
(
periodicBoxSize
);
ixn
.
setPeriodic
(
periodicBoxSize
);
map
<
string
,
double
>
globalParameters
;
map
<
string
,
double
>
globalParameters
;
for
(
int
i
=
0
;
i
<
globalParameterNames
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
globalParameters
[
globalParameterNames
[
i
]]
=
context
.
getParameter
(
globalParameterNames
[
i
]);
globalParameters
[
globalParameterNames
[
i
]]
=
context
.
getParameter
(
globalParameterNames
[
i
]);
ixn
.
calculatePairIxn
(
numParticles
,
posData
,
particleParamArray
,
exclusionArray
,
0
,
globalParameters
,
forceData
,
0
,
&
energy
);
ixn
.
calculatePairIxn
(
numParticles
,
posData
,
particleParamArray
,
exclusionArray
,
0
,
globalParameters
,
forceData
,
0
,
&
energy
);
ixn
.
calculateExceptionIxn
(
numExceptions
,
exceptionIndexArray
,
posData
,
exceptionParamArray
,
globalParameters
,
forceData
,
0
,
&
energy
);
ixn
.
calculateExceptionIxn
(
numExceptions
,
exceptionIndexArray
,
posData
,
exceptionParamArray
,
globalParameters
,
forceData
,
0
,
&
energy
);
...
...
platforms/reference/src/SimTKReference/ReferenceCustomNonbondedIxn.cpp
View file @
a1752463
...
@@ -53,7 +53,7 @@ ReferenceCustomNonbondedIxn::ReferenceCustomNonbondedIxn(const Lepton::Expressio
...
@@ -53,7 +53,7 @@ ReferenceCustomNonbondedIxn::ReferenceCustomNonbondedIxn(const Lepton::Expressio
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
for
(
int
i
=
0
;
i
<
paramNames
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
(
int
)
paramNames
.
size
();
i
++
)
{
for
(
int
j
=
1
;
j
<
3
;
j
++
)
{
for
(
int
j
=
1
;
j
<
3
;
j
++
)
{
stringstream
name
;
stringstream
name
;
name
<<
paramNames
[
i
]
<<
j
;
name
<<
paramNames
[
i
]
<<
j
;
...
@@ -159,11 +159,11 @@ int ReferenceCustomNonbondedIxn::calculatePairIxn( int numberOfAtoms, RealOpenMM
...
@@ -159,11 +159,11 @@ int ReferenceCustomNonbondedIxn::calculatePairIxn( int numberOfAtoms, RealOpenMM
// Apply the combining rules to compute the force field parameters.
// Apply the combining rules to compute the force field parameters.
for
(
int
j
=
0
;
j
<
combiningRules
.
size
();
j
++
)
{
for
(
int
j
=
0
;
j
<
(
int
)
combiningRules
.
size
();
j
++
)
{
variablesForParams
[
particleParamNames
[
j
*
2
]]
=
atomParameters
[
pair
.
first
][
j
];
variablesForParams
[
particleParamNames
[
j
*
2
]]
=
atomParameters
[
pair
.
first
][
j
];
variablesForParams
[
particleParamNames
[
j
*
2
+
1
]]
=
atomParameters
[
pair
.
second
][
j
];
variablesForParams
[
particleParamNames
[
j
*
2
+
1
]]
=
atomParameters
[
pair
.
second
][
j
];
}
}
for
(
int
j
=
0
;
j
<
combiningRules
.
size
();
j
++
)
for
(
int
j
=
0
;
j
<
(
int
)
combiningRules
.
size
();
j
++
)
variablesForForce
[
paramNames
[
j
]]
=
combiningRules
[
j
].
evaluate
(
variablesForParams
);
variablesForForce
[
paramNames
[
j
]]
=
combiningRules
[
j
].
evaluate
(
variablesForParams
);
calculateOneIxn
(
pair
.
first
,
pair
.
second
,
atomCoordinates
,
variablesForForce
,
forces
,
energyByAtom
,
totalEnergy
);
calculateOneIxn
(
pair
.
first
,
pair
.
second
,
atomCoordinates
,
variablesForForce
,
forces
,
energyByAtom
,
totalEnergy
);
}
}
...
@@ -192,11 +192,11 @@ int ReferenceCustomNonbondedIxn::calculatePairIxn( int numberOfAtoms, RealOpenMM
...
@@ -192,11 +192,11 @@ int ReferenceCustomNonbondedIxn::calculatePairIxn( int numberOfAtoms, RealOpenMM
// Apply the combining rules to compute the force field parameters.
// Apply the combining rules to compute the force field parameters.
for
(
int
j
=
0
;
j
<
combiningRules
.
size
();
j
++
)
{
for
(
int
j
=
0
;
j
<
(
int
)
combiningRules
.
size
();
j
++
)
{
variablesForParams
[
particleParamNames
[
j
*
2
]]
=
atomParameters
[
ii
][
j
];
variablesForParams
[
particleParamNames
[
j
*
2
]]
=
atomParameters
[
ii
][
j
];
variablesForParams
[
particleParamNames
[
j
*
2
+
1
]]
=
atomParameters
[
jj
][
j
];
variablesForParams
[
particleParamNames
[
j
*
2
+
1
]]
=
atomParameters
[
jj
][
j
];
}
}
for
(
int
j
=
0
;
j
<
combiningRules
.
size
();
j
++
)
for
(
int
j
=
0
;
j
<
(
int
)
combiningRules
.
size
();
j
++
)
variablesForForce
[
paramNames
[
j
]]
=
combiningRules
[
j
].
evaluate
(
variablesForParams
);
variablesForForce
[
paramNames
[
j
]]
=
combiningRules
[
j
].
evaluate
(
variablesForParams
);
calculateOneIxn
(
ii
,
jj
,
atomCoordinates
,
variablesForForce
,
forces
,
energyByAtom
,
totalEnergy
);
calculateOneIxn
(
ii
,
jj
,
atomCoordinates
,
variablesForForce
,
forces
,
energyByAtom
,
totalEnergy
);
}
}
...
@@ -229,7 +229,7 @@ void ReferenceCustomNonbondedIxn::calculateExceptionIxn( int numberOfExceptions,
...
@@ -229,7 +229,7 @@ void ReferenceCustomNonbondedIxn::calculateExceptionIxn( int numberOfExceptions,
map
<
string
,
double
>
variables
=
globalParameters
;
map
<
string
,
double
>
variables
=
globalParameters
;
for
(
int
i
=
0
;
i
<
numberOfExceptions
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numberOfExceptions
;
i
++
)
{
for
(
int
j
=
0
;
j
<
combiningRules
.
size
();
j
++
)
for
(
int
j
=
0
;
j
<
(
int
)
combiningRules
.
size
();
j
++
)
variables
[
paramNames
[
j
]]
=
parameters
[
i
][
j
];
variables
[
paramNames
[
j
]]
=
parameters
[
i
][
j
];
calculateOneIxn
(
atomIndices
[
i
][
0
],
atomIndices
[
i
][
1
],
atomCoordinates
,
variables
,
forces
,
energyByAtom
,
totalEnergy
);
calculateOneIxn
(
atomIndices
[
i
][
0
],
atomIndices
[
i
][
1
],
atomCoordinates
,
variables
,
forces
,
energyByAtom
,
totalEnergy
);
}
}
...
@@ -282,7 +282,7 @@ void ReferenceCustomNonbondedIxn::calculateOneIxn( int ii, int jj, RealOpenMM**
...
@@ -282,7 +282,7 @@ void ReferenceCustomNonbondedIxn::calculateOneIxn( int ii, int jj, RealOpenMM**
// accumulate forces
// accumulate forces
variables
[
"r"
]
=
deltaR
[
ReferenceForce
::
RIndex
];
variables
[
"r"
]
=
deltaR
[
ReferenceForce
::
RIndex
];
RealOpenMM
dEdR
=
forceExpression
.
evaluate
(
variables
)
/
(
deltaR
[
ReferenceForce
::
RIndex
]);
RealOpenMM
dEdR
=
(
RealOpenMM
)
(
forceExpression
.
evaluate
(
variables
)
/
(
deltaR
[
ReferenceForce
::
RIndex
])
)
;
for
(
int
kk
=
0
;
kk
<
3
;
kk
++
){
for
(
int
kk
=
0
;
kk
<
3
;
kk
++
){
RealOpenMM
force
=
-
dEdR
*
deltaR
[
kk
];
RealOpenMM
force
=
-
dEdR
*
deltaR
[
kk
];
forces
[
ii
][
kk
]
+=
force
;
forces
[
ii
][
kk
]
+=
force
;
...
@@ -292,7 +292,7 @@ void ReferenceCustomNonbondedIxn::calculateOneIxn( int ii, int jj, RealOpenMM**
...
@@ -292,7 +292,7 @@ void ReferenceCustomNonbondedIxn::calculateOneIxn( int ii, int jj, RealOpenMM**
// accumulate energies
// accumulate energies
if
(
totalEnergy
||
energyByAtom
)
{
if
(
totalEnergy
||
energyByAtom
)
{
RealOpenMM
energy
=
energyExpression
.
evaluate
(
variables
);
RealOpenMM
energy
=
(
RealOpenMM
)
energyExpression
.
evaluate
(
variables
);
if
(
totalEnergy
)
if
(
totalEnergy
)
*
totalEnergy
+=
energy
;
*
totalEnergy
+=
energy
;
if
(
energyByAtom
){
if
(
energyByAtom
){
...
...
platforms/reference/src/SimTKReference/ReferenceLJCoulombIxn.cpp
View file @
a1752463
...
@@ -445,7 +445,7 @@ int ReferenceLJCoulombIxn::calculateEwaldIxn( int numberOfAtoms, RealOpenMM** at
...
@@ -445,7 +445,7 @@ int ReferenceLJCoulombIxn::calculateEwaldIxn( int numberOfAtoms, RealOpenMM** at
// accumulate energies
// accumulate energies
realSpaceEwaldEnergy
=
atomParameters
[
ii
][
QIndex
]
*
atomParameters
[
jj
][
QIndex
]
*
inverseR
*
erfc
(
alphaR
);
realSpaceEwaldEnergy
=
(
RealOpenMM
)
(
atomParameters
[
ii
][
QIndex
]
*
atomParameters
[
jj
][
QIndex
]
*
inverseR
*
erfc
(
alphaR
)
)
;
vdwEnergy
=
eps
*
(
sig6
-
one
)
*
sig6
;
vdwEnergy
=
eps
*
(
sig6
-
one
)
*
sig6
;
if
(
totalEnergy
)
if
(
totalEnergy
)
...
@@ -484,7 +484,7 @@ int ReferenceLJCoulombIxn::calculateEwaldIxn( int numberOfAtoms, RealOpenMM** at
...
@@ -484,7 +484,7 @@ int ReferenceLJCoulombIxn::calculateEwaldIxn( int numberOfAtoms, RealOpenMM** at
// accumulate energies
// accumulate energies
realSpaceEwaldEnergy
=
atomParameters
[
ii
][
QIndex
]
*
atomParameters
[
jj
][
QIndex
]
*
inverseR
*
erf
(
alphaR
);
realSpaceEwaldEnergy
=
(
RealOpenMM
)
(
atomParameters
[
ii
][
QIndex
]
*
atomParameters
[
jj
][
QIndex
]
*
inverseR
*
erf
(
alphaR
)
)
;
if
(
totalEnergy
)
if
(
totalEnergy
)
*
totalEnergy
-=
realSpaceEwaldEnergy
;
*
totalEnergy
-=
realSpaceEwaldEnergy
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment