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
a9c75e52
Commit
a9c75e52
authored
Jan 12, 2015
by
peastman
Browse files
Merge pull request #776 from peastman/bug
Fixed bug in reference CustomCompoundBondForce
parents
c66e086e
5ae844b2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
23 deletions
+23
-23
platforms/cuda/tests/TestCudaCustomCompoundBondForce.cpp
platforms/cuda/tests/TestCudaCustomCompoundBondForce.cpp
+7
-7
platforms/opencl/tests/TestOpenCLCustomCompoundBondForce.cpp
platforms/opencl/tests/TestOpenCLCustomCompoundBondForce.cpp
+7
-7
platforms/reference/src/SimTKReference/ReferenceCustomCompoundBondIxn.cpp
...nce/src/SimTKReference/ReferenceCustomCompoundBondIxn.cpp
+2
-2
platforms/reference/tests/TestReferenceCustomCompoundBondForce.cpp
.../reference/tests/TestReferenceCustomCompoundBondForce.cpp
+7
-7
No files found.
platforms/cuda/tests/TestCudaCustomCompoundBondForce.cpp
View file @
a9c75e52
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2012 Stanford University and the Authors.
*
* Portions copyright (c) 2012
-2015
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -152,21 +152,21 @@ void testPositionDependence() {
custom
->
addGlobalParameter
(
"scale1"
,
0.3
);
custom
->
addGlobalParameter
(
"scale2"
,
0.2
);
vector
<
int
>
particles
(
2
);
particles
[
0
]
=
0
;
particles
[
1
]
=
1
;
particles
[
0
]
=
1
;
particles
[
1
]
=
0
;
vector
<
double
>
parameters
;
custom
->
addBond
(
particles
,
parameters
);
customSystem
.
addForce
(
custom
);
vector
<
Vec3
>
positions
(
2
);
positions
[
0
]
=
Vec3
(
0
.5
,
1
,
0
);
positions
[
1
]
=
Vec3
(
1
.5
,
1
,
0
);
positions
[
0
]
=
Vec3
(
1
.5
,
1
,
0
);
positions
[
1
]
=
Vec3
(
0
.5
,
1
,
0
);
VerletIntegrator
integrator
(
0.01
);
Context
context
(
customSystem
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
ASSERT_EQUAL_TOL
(
0.3
*
1.0
+
0.2
*
0.5
+
2
*
1
,
state
.
getPotentialEnergy
(),
1e-5
);
ASSERT_EQUAL_VEC
(
Vec3
(
0.3
-
0.
2
,
0
,
0
),
state
.
getForces
()[
0
],
1e-5
);
ASSERT_EQUAL_VEC
(
Vec3
(
-
0.3
,
-
2
,
0
),
state
.
getForces
()[
1
],
1e-5
);
ASSERT_EQUAL_VEC
(
Vec3
(
-
0.
3
,
-
2
,
0
),
state
.
getForces
()[
0
],
1e-5
);
ASSERT_EQUAL_VEC
(
Vec3
(
0.3
-
0.2
,
0
,
0
),
state
.
getForces
()[
1
],
1e-5
);
}
void
testParallelComputation
()
{
...
...
platforms/opencl/tests/TestOpenCLCustomCompoundBondForce.cpp
View file @
a9c75e52
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2012 Stanford University and the Authors.
*
* Portions copyright (c) 2012
-2015
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -152,21 +152,21 @@ void testPositionDependence() {
custom
->
addGlobalParameter
(
"scale1"
,
0.3
);
custom
->
addGlobalParameter
(
"scale2"
,
0.2
);
vector
<
int
>
particles
(
2
);
particles
[
0
]
=
0
;
particles
[
1
]
=
1
;
particles
[
0
]
=
1
;
particles
[
1
]
=
0
;
vector
<
double
>
parameters
;
custom
->
addBond
(
particles
,
parameters
);
customSystem
.
addForce
(
custom
);
vector
<
Vec3
>
positions
(
2
);
positions
[
0
]
=
Vec3
(
0
.5
,
1
,
0
);
positions
[
1
]
=
Vec3
(
1
.5
,
1
,
0
);
positions
[
0
]
=
Vec3
(
1
.5
,
1
,
0
);
positions
[
1
]
=
Vec3
(
0
.5
,
1
,
0
);
VerletIntegrator
integrator
(
0.01
);
Context
context
(
customSystem
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
ASSERT_EQUAL_TOL
(
0.3
*
1.0
+
0.2
*
0.5
+
2
*
1
,
state
.
getPotentialEnergy
(),
1e-5
);
ASSERT_EQUAL_VEC
(
Vec3
(
0.3
-
0.
2
,
0
,
0
),
state
.
getForces
()[
0
],
1e-5
);
ASSERT_EQUAL_VEC
(
Vec3
(
-
0.3
,
-
2
,
0
),
state
.
getForces
()[
1
],
1e-5
);
ASSERT_EQUAL_VEC
(
Vec3
(
-
0.
3
,
-
2
,
0
),
state
.
getForces
()[
0
],
1e-5
);
ASSERT_EQUAL_VEC
(
Vec3
(
0.3
-
0.2
,
0
,
0
),
state
.
getForces
()[
1
],
1e-5
);
}
void
testParallelComputation
()
{
...
...
platforms/reference/src/SimTKReference/ReferenceCustomCompoundBondIxn.cpp
View file @
a9c75e52
/* Portions copyright (c) 2009-201
0
Stanford University and Simbios.
/* Portions copyright (c) 2009-201
5
Stanford University and Simbios.
* Contributors: Peter Eastman
*
* Permission is hereby granted, free of charge, to any person obtaining
...
...
@@ -127,7 +127,7 @@ void ReferenceCustomCompoundBondIxn::calculateOneIxn(int bond, vector<RealVec>&
const
vector
<
int
>&
atoms
=
bondAtoms
[
bond
];
for
(
int
i
=
0
;
i
<
(
int
)
particleTerms
.
size
();
i
++
)
{
const
ParticleTermInfo
&
term
=
particleTerms
[
i
];
variables
[
term
.
name
]
=
atomCoordinates
[
term
.
atom
][
term
.
component
];
variables
[
term
.
name
]
=
atomCoordinates
[
atoms
[
term
.
atom
]
]
[
term
.
component
];
}
for
(
int
i
=
0
;
i
<
(
int
)
distanceTerms
.
size
();
i
++
)
{
const
DistanceTermInfo
&
term
=
distanceTerms
[
i
];
...
...
platforms/reference/tests/TestReferenceCustomCompoundBondForce.cpp
View file @
a9c75e52
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2012 Stanford University and the Authors.
*
* Portions copyright (c) 2012
-2015
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -155,21 +155,21 @@ void testPositionDependence() {
custom
->
addGlobalParameter
(
"scale1"
,
0.3
);
custom
->
addGlobalParameter
(
"scale2"
,
0.2
);
vector
<
int
>
particles
(
2
);
particles
[
0
]
=
0
;
particles
[
1
]
=
1
;
particles
[
0
]
=
1
;
particles
[
1
]
=
0
;
vector
<
double
>
parameters
;
custom
->
addBond
(
particles
,
parameters
);
customSystem
.
addForce
(
custom
);
vector
<
Vec3
>
positions
(
2
);
positions
[
0
]
=
Vec3
(
0
.5
,
1
,
0
);
positions
[
1
]
=
Vec3
(
1
.5
,
1
,
0
);
positions
[
0
]
=
Vec3
(
1
.5
,
1
,
0
);
positions
[
1
]
=
Vec3
(
0
.5
,
1
,
0
);
VerletIntegrator
integrator
(
0.01
);
Context
context
(
customSystem
,
integrator
,
platform
);
context
.
setPositions
(
positions
);
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
ASSERT_EQUAL_TOL
(
0.3
*
1.0
+
0.2
*
0.5
+
2
*
1
,
state
.
getPotentialEnergy
(),
1e-5
);
ASSERT_EQUAL_VEC
(
Vec3
(
0.3
-
0.
2
,
0
,
0
),
state
.
getForces
()[
0
],
1e-5
);
ASSERT_EQUAL_VEC
(
Vec3
(
-
0.3
,
-
2
,
0
),
state
.
getForces
()[
1
],
1e-5
);
ASSERT_EQUAL_VEC
(
Vec3
(
-
0.
3
,
-
2
,
0
),
state
.
getForces
()[
0
],
1e-5
);
ASSERT_EQUAL_VEC
(
Vec3
(
0.3
-
0.2
,
0
,
0
),
state
.
getForces
()[
1
],
1e-5
);
}
void
testContinuous2DFunction
()
{
...
...
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