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
e561a678
Commit
e561a678
authored
Apr 18, 2008
by
Peter Eastman
Browse files
Began implementing ReferencePlatform
parent
598e076c
Changes
49
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
962 additions
and
6 deletions
+962
-6
CMakeLists.txt
CMakeLists.txt
+1
-1
olla/include/Platform.h
olla/include/Platform.h
+5
-2
olla/src/Platform.cpp
olla/src/Platform.cpp
+14
-0
platforms/reference/include/ReferenceKernelFactory.h
platforms/reference/include/ReferenceKernelFactory.h
+50
-0
platforms/reference/include/ReferencePlatform.h
platforms/reference/include/ReferencePlatform.h
+61
-0
platforms/reference/include/ReferenceStreamFactory.h
platforms/reference/include/ReferenceStreamFactory.h
+50
-0
platforms/reference/src/ReferenceFloatStreamImpl.cpp
platforms/reference/src/ReferenceFloatStreamImpl.cpp
+127
-0
platforms/reference/src/ReferenceFloatStreamImpl.h
platforms/reference/src/ReferenceFloatStreamImpl.h
+60
-0
platforms/reference/src/ReferenceKernelFactory.cpp
platforms/reference/src/ReferenceKernelFactory.cpp
+55
-0
platforms/reference/src/ReferenceKernels.cpp
platforms/reference/src/ReferenceKernels.cpp
+122
-0
platforms/reference/src/ReferenceKernels.h
platforms/reference/src/ReferenceKernels.h
+306
-0
platforms/reference/src/ReferencePlatform.cpp
platforms/reference/src/ReferencePlatform.cpp
+56
-0
platforms/reference/src/ReferenceStreamFactory.cpp
platforms/reference/src/ReferenceStreamFactory.cpp
+52
-0
platforms/reference/src/SimTKReference/ReferenceAngleBondIxn.cpp
...ms/reference/src/SimTKReference/ReferenceAngleBondIxn.cpp
+0
-0
platforms/reference/src/SimTKReference/ReferenceAngleBondIxn.h
...orms/reference/src/SimTKReference/ReferenceAngleBondIxn.h
+0
-0
platforms/reference/src/SimTKReference/ReferenceBondForce.cpp
...forms/reference/src/SimTKReference/ReferenceBondForce.cpp
+3
-3
platforms/reference/src/SimTKReference/ReferenceBondForce.h
platforms/reference/src/SimTKReference/ReferenceBondForce.h
+0
-0
platforms/reference/src/SimTKReference/ReferenceBondIxn.cpp
platforms/reference/src/SimTKReference/ReferenceBondIxn.cpp
+0
-0
platforms/reference/src/SimTKReference/ReferenceBondIxn.h
platforms/reference/src/SimTKReference/ReferenceBondIxn.h
+0
-0
platforms/reference/src/SimTKReference/ReferenceConstraint.cpp
...orms/reference/src/SimTKReference/ReferenceConstraint.cpp
+0
-0
No files found.
CMakeLists.txt
View file @
e561a678
...
@@ -22,7 +22,7 @@ ADD_DEFINITIONS(-DOPENMM_BUILDING_SHARED_LIBRARY)
...
@@ -22,7 +22,7 @@ ADD_DEFINITIONS(-DOPENMM_BUILDING_SHARED_LIBRARY)
# The source is organized into subdirectories, but we handle them all from
# The source is organized into subdirectories, but we handle them all from
# this CMakeLists file rather than letting CMake visit them as SUBDIRS.
# this CMakeLists file rather than letting CMake visit them as SUBDIRS.
SET
(
OPENMM_SOURCE_SUBDIRS . openmmapi olla
)
SET
(
OPENMM_SOURCE_SUBDIRS . openmmapi olla
platforms/reference
)
# The build system will set ARCH64 for 64 bit builds, which require
# The build system will set ARCH64 for 64 bit builds, which require
...
...
olla/include/Platform.h
View file @
e561a678
...
@@ -61,8 +61,7 @@ class StreamFactory;
...
@@ -61,8 +61,7 @@ class StreamFactory;
class
Platform
{
class
Platform
{
public:
public:
virtual
~
Platform
()
{
virtual
~
Platform
();
}
/**
/**
* Get the name of this platform. This should be a unique identifier which can be used to recognized it.
* Get the name of this platform. This should be a unique identifier which can be used to recognized it.
*/
*/
...
@@ -86,6 +85,8 @@ public:
...
@@ -86,6 +85,8 @@ public:
virtual
const
StreamFactory
&
getDefaultStreamFactory
()
const
=
0
;
virtual
const
StreamFactory
&
getDefaultStreamFactory
()
const
=
0
;
/**
/**
* Register a KernelFactory which should be used to create Kernels with a particular name.
* Register a KernelFactory which should be used to create Kernels with a particular name.
* The Platform takes over ownership of the factory, and will delete it when the Platform itself
* is deleted.
*
*
* @param name the kernel name for which the factory should be used
* @param name the kernel name for which the factory should be used
* @param factory the factory to use for creating Kernels with the specified name
* @param factory the factory to use for creating Kernels with the specified name
...
@@ -93,6 +94,8 @@ public:
...
@@ -93,6 +94,8 @@ public:
void
registerKernelFactory
(
std
::
string
name
,
KernelFactory
*
factory
);
void
registerKernelFactory
(
std
::
string
name
,
KernelFactory
*
factory
);
/**
/**
* Register a StreamFactory which should be used to create Streams with a particular name.
* Register a StreamFactory which should be used to create Streams with a particular name.
* The Platform takes over ownership of the factory, and will delete it when the Platform itself
* is deleted.
*
*
* @param name the stream name for which the factory should be used
* @param name the stream name for which the factory should be used
* @param factory the factory to use for creating Streams with the specified name
* @param factory the factory to use for creating Streams with the specified name
...
...
olla/src/Platform.cpp
View file @
e561a678
...
@@ -35,12 +35,26 @@
...
@@ -35,12 +35,26 @@
#include "Stream.h"
#include "Stream.h"
#include "KernelFactory.h"
#include "KernelFactory.h"
#include "StreamFactory.h"
#include "StreamFactory.h"
#include <set>
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
std
::
vector
<
Platform
*>
Platform
::
platforms
;
std
::
vector
<
Platform
*>
Platform
::
platforms
;
Platform
::~
Platform
()
{
set
<
KernelFactory
*>
uniqueKernelFactories
;
set
<
StreamFactory
*>
uniqueStreamFactories
;
for
(
map
<
string
,
KernelFactory
*>::
const_iterator
iter
=
kernelFactories
.
begin
();
iter
!=
kernelFactories
.
end
();
++
iter
)
uniqueKernelFactories
.
insert
(
iter
->
second
);
for
(
map
<
string
,
StreamFactory
*>::
const_iterator
iter
=
streamFactories
.
begin
();
iter
!=
streamFactories
.
end
();
++
iter
)
uniqueStreamFactories
.
insert
(
iter
->
second
);
for
(
set
<
KernelFactory
*>::
const_iterator
iter
=
uniqueKernelFactories
.
begin
();
iter
!=
uniqueKernelFactories
.
end
();
++
iter
)
delete
*
iter
;
for
(
set
<
StreamFactory
*>::
const_iterator
iter
=
uniqueStreamFactories
.
begin
();
iter
!=
uniqueStreamFactories
.
end
();
++
iter
)
delete
*
iter
;
}
void
Platform
::
registerKernelFactory
(
std
::
string
name
,
KernelFactory
*
factory
)
{
void
Platform
::
registerKernelFactory
(
std
::
string
name
,
KernelFactory
*
factory
)
{
kernelFactories
[
name
]
=
factory
;
kernelFactories
[
name
]
=
factory
;
}
}
...
...
platforms/reference/include/ReferenceKernelFactory.h
0 → 100644
View file @
e561a678
#ifndef OPENMM_REFERENCEKERNELFACTORY_H_
#define OPENMM_REFERENCEKERNELFACTORY_H_
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "KernelFactory.h"
namespace
OpenMM
{
/**
* This KernelFactory creates all kernels for ReferencePlatform.
*/
class
ReferenceKernelFactory
:
public
KernelFactory
{
public:
KernelImpl
*
createKernelImpl
(
std
::
string
name
)
const
;
};
}
// namespace OpenMM
#endif
/*OPENMM_REFERENCEKERNELFACTORY_H_*/
platforms/reference/include/ReferencePlatform.h
0 → 100644
View file @
e561a678
#ifndef OPENMM_REFERENCEPLATFORM_H_
#define OPENMM_REFERENCEPLATFORM_H_
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "Platform.h"
#include "ReferenceStreamFactory.h"
namespace
OpenMM
{
/**
* This Platform subclass uses the reference implementations of all the OpenMM kernels.
*/
class
ReferencePlatform
:
public
Platform
{
public:
ReferencePlatform
();
std
::
string
getName
()
const
{
return
"Reference"
;
}
double
getSpeed
()
const
{
return
1
;
}
bool
supportsDoublePrecision
()
const
;
const
StreamFactory
&
getDefaultStreamFactory
()
const
;
private:
ReferenceStreamFactory
defaultStreamFactory
;
};
}
// namespace OpenMM
#endif
/*OPENMM_REFERENCEPLATFORM_H_*/
platforms/reference/include/ReferenceStreamFactory.h
0 → 100644
View file @
e561a678
#ifndef OPENMM_REFERENCESTREAMFACTORY_H_
#define OPENMM_REFERENCESTREAMFACTORY_H_
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "StreamFactory.h"
namespace
OpenMM
{
/**
* This StreamFactory creates all streams for ReferencePlatform.
*/
class
ReferenceStreamFactory
:
public
StreamFactory
{
public:
StreamImpl
*
createStreamImpl
(
std
::
string
name
,
int
size
,
Stream
::
DataType
type
)
const
;
};
}
// namespace OpenMM
#endif
/*OPENMM_REFERENCESTREAMFACTORY_H_*/
platforms/reference/src/ReferenceFloatStreamImpl.cpp
0 → 100644
View file @
e561a678
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "ReferenceFloatStreamImpl.h"
using
namespace
OpenMM
;
ReferenceFloatStreamImpl
::
ReferenceFloatStreamImpl
(
std
::
string
name
,
int
size
,
Stream
::
DataType
type
)
:
StreamImpl
(
name
,
size
,
type
)
{
switch
(
type
)
{
case
Stream
::
Float
:
case
Stream
::
Float2
:
case
Stream
::
Float3
:
case
Stream
::
Float4
:
baseType
=
Stream
::
Float
;
break
;
case
Stream
::
Double
:
case
Stream
::
Double2
:
case
Stream
::
Double3
:
case
Stream
::
Double4
:
baseType
=
Stream
::
Double
;
break
;
}
switch
(
type
)
{
case
Stream
::
Float
:
case
Stream
::
Double
:
width
=
1
;
break
;
case
Stream
::
Float2
:
case
Stream
::
Double2
:
width
=
2
;
break
;
case
Stream
::
Float3
:
case
Stream
::
Double3
:
width
=
3
;
break
;
case
Stream
::
Float4
:
case
Stream
::
Double4
:
width
=
4
;
break
;
}
data
=
new
RealOpenMM
*
[
size
];
for
(
int
i
=
0
;
i
<
size
;
++
i
)
data
[
i
]
=
new
RealOpenMM
[
width
];
}
ReferenceFloatStreamImpl
::~
ReferenceFloatStreamImpl
()
{
delete
data
;
}
void
ReferenceFloatStreamImpl
::
loadFromArray
(
const
void
*
array
)
{
if
(
baseType
==
Stream
::
Float
)
{
float
*
arrayData
=
(
float
*
)
array
;
for
(
int
i
=
0
;
i
<
getSize
();
++
i
)
for
(
int
j
=
0
;
j
<
width
;
++
j
)
data
[
i
][
j
]
=
arrayData
[
i
*
width
+
j
];
}
else
{
double
*
arrayData
=
(
double
*
)
array
;
for
(
int
i
=
0
;
i
<
getSize
();
++
i
)
for
(
int
j
=
0
;
j
<
width
;
++
j
)
data
[
i
][
j
]
=
arrayData
[
i
*
width
+
j
];
}
}
void
ReferenceFloatStreamImpl
::
saveToArray
(
void
*
array
)
{
if
(
baseType
==
Stream
::
Float
)
{
float
*
arrayData
=
(
float
*
)
array
;
for
(
int
i
=
0
;
i
<
getSize
();
++
i
)
for
(
int
j
=
0
;
j
<
width
;
++
j
)
arrayData
[
i
*
width
+
j
]
=
data
[
i
][
j
];
}
else
{
double
*
arrayData
=
(
double
*
)
array
;
for
(
int
i
=
0
;
i
<
getSize
();
++
i
)
for
(
int
j
=
0
;
j
<
width
;
++
j
)
arrayData
[
i
*
width
+
j
]
=
data
[
i
][
j
];
}
}
void
ReferenceFloatStreamImpl
::
fillWithValue
(
void
*
value
)
{
if
(
baseType
==
Stream
::
Float
)
{
float
valueData
=
*
((
float
*
)
value
);
for
(
int
i
=
0
;
i
<
getSize
();
++
i
)
for
(
int
j
=
0
;
j
<
width
;
++
j
)
data
[
i
][
j
]
=
valueData
;
}
else
{
double
valueData
=
*
((
double
*
)
value
);
for
(
int
i
=
0
;
i
<
getSize
();
++
i
)
for
(
int
j
=
0
;
j
<
width
;
++
j
)
data
[
i
][
j
]
=
valueData
;
}
}
RealOpenMM
**
ReferenceFloatStreamImpl
::
getData
()
{
return
data
;
}
platforms/reference/src/ReferenceFloatStreamImpl.h
0 → 100644
View file @
e561a678
#ifndef OPENMM_REFERENCEFLOATSTREAMIMPL_H_
#define OPENMM_REFERENCEFLOATSTREAMIMPL_H_
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "StreamImpl.h"
#include "SimTKUtilities/SimTKOpenMMRealType.h"
namespace
OpenMM
{
/**
* This is the implementation of Float and Double streams in the reference Platform.
*/
class
ReferenceFloatStreamImpl
:
public
StreamImpl
{
public:
ReferenceFloatStreamImpl
(
std
::
string
name
,
int
size
,
Stream
::
DataType
type
);
~
ReferenceFloatStreamImpl
();
void
loadFromArray
(
const
void
*
array
);
void
saveToArray
(
void
*
array
);
void
fillWithValue
(
void
*
value
);
RealOpenMM
**
getData
();
private:
int
width
;
Stream
::
DataType
baseType
;
RealOpenMM
**
data
;
};
}
// namespace OpenMM
#endif
/*OPENMM_REFERENCEFLOATSTREAMIMPL_H_*/
platforms/reference/src/ReferenceKernelFactory.cpp
0 → 100644
View file @
e561a678
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "ReferenceKernelFactory.h"
using
namespace
OpenMM
;
KernelImpl
*
ReferenceKernelFactory
::
createKernelImpl
(
std
::
string
name
)
const
{
if
(
name
==
CalcStandardMMForcesKernel
::
Name
())
return
new
ReferenceCalcStandardMMForcesKernel
(
name
);
if
(
name
==
CalcStandardMMEnergyKernel
::
Name
())
return
new
ReferenceCalcStandardMMEnergyKernel
(
name
);
if
(
name
==
CalcGBSAOBCForcesKernel
::
Name
())
return
new
ReferenceCalcGBSAOBCForcesKernel
(
name
);
if
(
name
==
CalcGBSAOBCEnergyKernel
::
Name
())
return
new
ReferenceCalcGBSAOBCEnergyKernel
(
name
);
if
(
name
==
IntegrateVerletStepKernel
::
Name
())
return
new
ReferenceIntegrateVerletStepKernel
(
name
);
if
(
name
==
IntegrateLangevinStepKernel
::
Name
())
return
new
ReferenceIntegrateLangevinStepKernel
(
name
);
if
(
name
==
IntegrateBrownianStepKernel
::
Name
())
return
new
ReferenceIntegrateBrownianStepKernel
(
name
);
if
(
name
==
ApplyAndersenThermostatKernel
::
Name
())
return
new
ReferenceApplyAndersenThermostatKernel
(
name
);
if
(
name
==
CalcKineticEnergyKernel
::
Name
())
return
new
ReferenceCalcKineticEnergyKernel
(
name
);
}
platforms/reference/src/ReferenceKernels.cpp
0 → 100644
View file @
e561a678
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "ReferenceKernels.h"
using
namespace
OpenMM
;
using
namespace
std
;
void
ReferenceCalcStandardMMForcesKernel
::
initialize
(
const
vector
<
vector
<
int
>
>&
bondIndices
,
const
vector
<
vector
<
double
>
>&
bondParameters
,
const
vector
<
vector
<
int
>
>&
angleIndices
,
const
vector
<
vector
<
double
>
>&
angleParameters
,
const
vector
<
vector
<
int
>
>&
periodicTorsionIndices
,
const
vector
<
vector
<
double
>
>&
periodicTorsionParameters
,
const
vector
<
vector
<
int
>
>&
rbTorsionIndices
,
const
vector
<
vector
<
double
>
>&
rbTorsionParameters
,
const
vector
<
vector
<
int
>
>&
bonded14Indices
,
const
vector
<
set
<
int
>
>&
exclusions
,
const
vector
<
vector
<
double
>
>&
nonbondedParameters
)
{
}
void
ReferenceCalcStandardMMForcesKernel
::
execute
(
const
Stream
&
positions
,
Stream
&
forces
)
{
}
void
ReferenceCalcStandardMMEnergyKernel
::
initialize
(
const
vector
<
vector
<
int
>
>&
bondIndices
,
const
vector
<
vector
<
double
>
>&
bondParameters
,
const
vector
<
vector
<
int
>
>&
angleIndices
,
const
vector
<
vector
<
double
>
>&
angleParameters
,
const
vector
<
vector
<
int
>
>&
periodicTorsionIndices
,
const
vector
<
vector
<
double
>
>&
periodicTorsionParameters
,
const
vector
<
vector
<
int
>
>&
rbTorsionIndices
,
const
vector
<
vector
<
double
>
>&
rbTorsionParameters
,
const
vector
<
vector
<
int
>
>&
bonded14Indices
,
const
vector
<
set
<
int
>
>&
exclusions
,
const
vector
<
vector
<
double
>
>&
nonbondedParameters
)
{
}
double
ReferenceCalcStandardMMEnergyKernel
::
execute
(
const
Stream
&
positions
)
{
return
0.0
;
// TODO implement correctly
}
void
ReferenceCalcGBSAOBCForcesKernel
::
initialize
(
const
vector
<
double
>&
bornRadii
,
const
vector
<
vector
<
double
>
>&
atomParameters
,
double
solventDielectric
,
double
soluteDielectric
)
{
}
void
ReferenceCalcGBSAOBCForcesKernel
::
execute
(
const
Stream
&
positions
,
Stream
&
forces
)
{
}
void
CalcGBSAOBCEnergyKernel
::
initialize
(
const
vector
<
double
>&
bornRadii
,
const
vector
<
vector
<
double
>
>&
atomParameters
,
double
solventDielectric
,
double
soluteDielectric
)
{
}
double
CalcGBSAOBCEnergyKernel
::
execute
(
const
Stream
&
positions
)
{
return
0.0
;
// TODO implement correctly
}
void
ReferenceIntegrateVerletStepKernel
::
initialize
(
const
vector
<
double
>&
masses
,
const
vector
<
vector
<
int
>
>&
constraintIndices
,
const
vector
<
double
>&
constraintLengths
)
{
}
void
ReferenceIntegrateVerletStepKernel
::
execute
(
Stream
&
positions
,
Stream
&
velocities
,
const
Stream
&
forces
,
double
stepSize
)
{
}
void
ReferenceIntegrateLangevinStepKernel
::
initialize
(
const
vector
<
double
>&
masses
,
const
vector
<
vector
<
int
>
>&
constraintIndices
,
const
vector
<
double
>&
constraintLengths
)
{
}
void
ReferenceIntegrateLangevinStepKernel
::
execute
(
Stream
&
positions
,
Stream
&
velocities
,
const
Stream
&
forces
,
double
temperature
,
double
friction
,
double
stepSize
)
{
}
void
ReferenceIntegrateBrownianStepKernel
::
initialize
(
const
vector
<
double
>&
masses
,
const
vector
<
vector
<
int
>
>&
constraintIndices
,
const
vector
<
double
>&
constraintLengths
)
{
}
void
ReferenceIntegrateBrownianStepKernel
::
execute
(
Stream
&
positions
,
Stream
&
velocities
,
const
Stream
&
forces
,
double
temperature
,
double
friction
,
double
stepSize
)
{
}
void
ReferenceApplyAndersenThermostatKernel
::
initialize
(
const
vector
<
double
>&
masses
)
{
}
void
ReferenceApplyAndersenThermostatKernel
::
execute
(
Stream
&
velocities
,
double
temperature
,
double
collisionFrequency
,
double
stepSize
)
{
}
void
ReferenceCalcKineticEnergyKernel
::
initialize
(
const
vector
<
double
>&
masses
)
{
}
double
ReferenceCalcKineticEnergyKernel
::
execute
(
const
Stream
&
positions
)
{
return
0.0
;
// TODO implement correctly
}
platforms/reference/src/ReferenceKernels.h
0 → 100644
View file @
e561a678
#ifndef OPENMM_REFERENCEKERNELS_H_
#define OPENMM_REFERENCEKERNELS_H_
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "kernels.h"
namespace
OpenMM
{
/**
* This kernel is invoked by StandardMMForceField to calculate the forces acting on the system.
*/
class
ReferenceCalcStandardMMForcesKernel
:
public
CalcStandardMMForcesKernel
{
public:
ReferenceCalcStandardMMForcesKernel
(
std
::
string
name
)
:
CalcStandardMMForcesKernel
(
name
)
{
}
/**
* Initialize the kernel, setting up the values of all the force field parameters.
*
* @param bondIndices the two atoms connected by each bond term
* @param bondParameters the force parameters (length, k) for each bond term
* @param angleIndices the three atoms connected by each angle term
* @param angleParameters the force parameters (angle, k) for each angle term
* @param periodicTorsionIndices the four atoms connected by each periodic torsion term
* @param periodicTorsionParameters the force parameters (periodicity, phase, k) for each periodic torsion term
* @param rbTorsionIndices the four atoms connected by each Ryckaert-Bellemans torsion term
* @param rbTorsionParameters the coefficients (in order of increasing powers) for each Ryckaert-Bellemans torsion term
* @param bonded14Indices each element contains the indices of two atoms whose nonbonded interactions should be reduced since
* they form a bonded 1-4 pair
* @param exclusions the i'th element lists the indices of all atoms with which the i'th atom should not interact through
* nonbonded forces. Bonded 1-4 pairs are also included in this list, since they should be omitted from
* the standard nonbonded calculation.
* @param nonbondedParameters the nonbonded force parameters (charge, van der Waals radius, van der Waals depth) for each atom
*/
void
initialize
(
const
std
::
vector
<
std
::
vector
<
int
>
>&
bondIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
bondParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
angleIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
angleParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
periodicTorsionIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
periodicTorsionParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
rbTorsionIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
rbTorsionParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
bonded14Indices
,
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
nonbondedParameters
);
/**
* Execute the kernel.
*
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @param forces a Stream of type Double3 containing the force (x, y, z) on each atom. On entry, this contains the forces that
* have been calculated so far. The kernel should add its own forces to the values already in the stream.
*/
void
execute
(
const
Stream
&
positions
,
Stream
&
forces
);
};
/**
* This kernel is invoked by StandardMMForceField to calculate the energy of the system.
*/
class
ReferenceCalcStandardMMEnergyKernel
:
public
CalcStandardMMEnergyKernel
{
public:
ReferenceCalcStandardMMEnergyKernel
(
std
::
string
name
)
:
CalcStandardMMEnergyKernel
(
name
)
{
}
/**
* Initialize the kernel, setting up the values of all the force field parameters.
*
* @param bondIndices the two atoms connected by each bond term
* @param bondParameters the force parameters (length, k) for each bond term
* @param angleIndices the three atoms connected by each angle term
* @param angleParameters the force parameters (angle, k) for each angle term
* @param periodicTorsionIndices the four atoms connected by each periodic torsion term
* @param periodicTorsionParameters the force parameters (periodicity, phase, k) for each periodic torsion term
* @param rbTorsionIndices the four atoms connected by each Ryckaert-Bellemans torsion term
* @param rbTorsionParameters the coefficients (in order of increasing powers) for each Ryckaert-Bellemans torsion term
* @param bonded14Indices each element contains the indices of two atoms whose nonbonded interactions should be reduced since
* they form a bonded 1-4 pair
* @param exclusions the i'th element lists the indices of all atoms with which the i'th atom should not interact through
* nonbonded forces. Bonded 1-4 pairs are also included in this list, since they should be omitted from
* the standard nonbonded calculation.
* @param nonbondedParameters the nonbonded force parameters (charge, van der Waals radius, van der Waals depth) for each atom
*/
void
initialize
(
const
std
::
vector
<
std
::
vector
<
int
>
>&
bondIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
bondParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
angleIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
angleParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
periodicTorsionIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
periodicTorsionParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
rbTorsionIndices
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
rbTorsionParameters
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
bonded14Indices
,
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
nonbondedParameters
);
/**
* Execute the kernel.
*
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @return the potential energy due to the StandardMMForceField
*/
double
execute
(
const
Stream
&
positions
);
};
/**
* This kernel is invoked by GBSAOBCForceField to calculate the forces acting on the system.
*/
class
ReferenceCalcGBSAOBCForcesKernel
:
public
CalcGBSAOBCForcesKernel
{
public:
ReferenceCalcGBSAOBCForcesKernel
(
std
::
string
name
)
:
CalcGBSAOBCForcesKernel
(
name
)
{
}
/**
* Initialize the kernel, setting up the values of all the force field parameters.
*
* @param bornRadii the initial value of the Born radius for each atom
* @param atomParameters the force parameters (charge, atomic radius, scaling factor) for each atom
* @param solventDielectric the dielectric constant of the solvent
* @param soluteDielectric the dielectric constant of the solute
*/
void
initialize
(
const
std
::
vector
<
double
>&
bornRadii
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
atomParameters
,
double
solventDielectric
,
double
soluteDielectric
);
/**
* Execute the kernel.
*
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @param forces a Stream of type Double3 containing the force (x, y, z) on each atom. On entry, this contains the forces that
* have been calculated so far. The kernel should add its own forces to the values already in the stream.
*/
void
execute
(
const
Stream
&
positions
,
Stream
&
forces
);
};
/**
* This kernel is invoked by GBSAOBCForceField to calculate the energy of the system.
*/
class
ReferenceCalcGBSAOBCEnergyKernel
:
public
CalcGBSAOBCEnergyKernel
{
public:
ReferenceCalcGBSAOBCEnergyKernel
(
std
::
string
name
)
:
CalcGBSAOBCEnergyKernel
(
name
)
{
}
/**
* Initialize the kernel, setting up the values of all the force field parameters.
*
* @param bornRadii the initial value of the Born radius for each atom
* @param atomParameters the force parameters (charge, atomic radius, scaling factor) for each atom
* @param solventDielectric the dielectric constant of the solvent
* @param soluteDielectric the dielectric constant of the solute
*/
void
initialize
(
const
std
::
vector
<
double
>&
bornRadii
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
atomParameters
,
double
solventDielectric
,
double
soluteDielectric
);
/**
* Execute the kernel.
*
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @return the potential energy due to the GBSAOBCForceField
*/
double
execute
(
const
Stream
&
positions
);
};
/**
* This kernel is invoked by VerletIntegrator to take one time step.
*/
class
ReferenceIntegrateVerletStepKernel
:
public
IntegrateVerletStepKernel
{
public:
ReferenceIntegrateVerletStepKernel
(
std
::
string
name
)
:
IntegrateVerletStepKernel
(
name
)
{
}
/**
* Initialize the kernel, setting up all parameters related to integrator.
*
* @param masses the mass of each atom
* @param constraintIndices each element contains the indices of two atoms whose distance should be constrained
* @param constraintLengths the required distance between each pair of constrained atoms
*/
void
initialize
(
const
std
::
vector
<
double
>&
masses
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
constraintIndices
,
const
std
::
vector
<
double
>&
constraintLengths
);
/**
* Execute the kernel.
*
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @param velocities a Stream of type Double3 containing the velocity (x, y, z) of each atom
* @param forces a Stream of type Double3 containing the force (x, y, z) on each atom
* @param stepSize the integration step size
*/
void
execute
(
Stream
&
positions
,
Stream
&
velocities
,
const
Stream
&
forces
,
double
stepSize
);
};
/**
* This kernel is invoked by LangevinIntegrator to take one time step.
*/
class
ReferenceIntegrateLangevinStepKernel
:
public
IntegrateLangevinStepKernel
{
public:
ReferenceIntegrateLangevinStepKernel
(
std
::
string
name
)
:
IntegrateLangevinStepKernel
(
name
)
{
}
/**
* Initialize the kernel, setting up all parameters related to integrator.
*
* @param masses the mass of each atom
* @param constraintIndices each element contains the indices of two atoms whose distance should be constrained
* @param constraintLengths the required distance between each pair of constrained atoms
*/
void
initialize
(
const
std
::
vector
<
double
>&
masses
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
constraintIndices
,
const
std
::
vector
<
double
>&
constraintLengths
);
/**
* Execute the kernel.
*
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @param velocities a Stream of type Double3 containing the velocity (x, y, z) of each atom
* @param forces a Stream of type Double3 containing the force (x, y, z) on each atom
* @param temperature the temperature of the heat bath
* @param friction the friction coefficient coupling the system to the heat bath
* @param stepSize the integration step size
*/
void
execute
(
Stream
&
positions
,
Stream
&
velocities
,
const
Stream
&
forces
,
double
temperature
,
double
friction
,
double
stepSize
);
};
/**
* This kernel is invoked by BrownianIntegrator to take one time step.
*/
class
ReferenceIntegrateBrownianStepKernel
:
public
IntegrateBrownianStepKernel
{
public:
ReferenceIntegrateBrownianStepKernel
(
std
::
string
name
)
:
IntegrateBrownianStepKernel
(
name
)
{
}
/**
* Initialize the kernel, setting up all parameters related to integrator.
*
* @param masses the mass of each atom
* @param constraintIndices each element contains the indices of two atoms whose distance should be constrained
* @param constraintLengths the required distance between each pair of constrained atoms
*/
void
initialize
(
const
std
::
vector
<
double
>&
masses
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
constraintIndices
,
const
std
::
vector
<
double
>&
constraintLengths
);
/**
* Execute the kernel.
*
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom
* @param velocities a Stream of type Double3 containing the velocity (x, y, z) of each atom
* @param forces a Stream of type Double3 containing the force (x, y, z) on each atom
* @param temperature the temperature of the heat bath
* @param friction the friction coefficient coupling the system to the heat bath
* @param stepSize the integration step size
*/
void
execute
(
Stream
&
positions
,
Stream
&
velocities
,
const
Stream
&
forces
,
double
temperature
,
double
friction
,
double
stepSize
);
};
/**
* This kernel is invoked by AndersenThermostat at the start of each time step to adjust the atom velocities.
*/
class
ReferenceApplyAndersenThermostatKernel
:
public
ApplyAndersenThermostatKernel
{
public:
ReferenceApplyAndersenThermostatKernel
(
std
::
string
name
)
:
ApplyAndersenThermostatKernel
(
name
)
{
}
/**
* Initialize the kernel, setting up the values of unchanging parameters.
*
* @param masses the mass of each atom
*/
void
initialize
(
const
std
::
vector
<
double
>&
masses
);
/**
* Execute the kernel.
*
* @param velocities a Stream of type Double3 containing the velocity (x, y, z) of each atom
* @param temperature the temperature of the heat bath
* @param collisionFrequency the frequency at which atom collide with particles in the heat bath
* @param stepSize the integration step size
*/
void
execute
(
Stream
&
velocities
,
double
temperature
,
double
collisionFrequency
,
double
stepSize
);
};
/**
* This kernel is invoked to calculate the kinetic energy of the system.
*/
class
ReferenceCalcKineticEnergyKernel
:
public
CalcKineticEnergyKernel
{
public:
ReferenceCalcKineticEnergyKernel
(
std
::
string
name
)
:
CalcKineticEnergyKernel
(
name
)
{
}
/**
* Initialize the kernel, setting up the atomic masses.
*
* @param masses the mass of each atom
*/
void
initialize
(
const
std
::
vector
<
double
>&
masses
);
/**
* Execute the kernel.
*
* @param velocities a Stream of type Double3 containing the velocity (x, y, z) of each atom
* @return the kinetic energy of the system
*/
double
execute
(
const
Stream
&
positions
);
};
}
// namespace OpenMM
#endif
/*OPENMM_REFERENCEKERNELS_H_*/
platforms/reference/src/ReferencePlatform.cpp
0 → 100644
View file @
e561a678
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "ReferencePlatform.h"
#include "ReferenceKernelFactory.h"
#include "ReferenceKernels.h"
using
namespace
OpenMM
;
ReferencePlatform
*
registerReferencePlatform
()
{
ReferencePlatform
*
platform
=
new
ReferencePlatform
();
Platform
::
registerPlatform
(
platform
);
}
ReferencePlatform
*
staticPlatform
=
registerReferencePlatform
();
ReferencePlatform
::
ReferencePlatform
()
{
ReferenceKernelFactory
*
factory
=
new
ReferenceKernelFactory
();
registerKernelFactory
(
CalcStandardMMForcesKernel
::
Name
(),
factory
);
registerKernelFactory
(
CalcStandardMMEnergyKernel
::
Name
(),
factory
);
registerKernelFactory
(
CalcGBSAOBCForcesKernel
::
Name
(),
factory
);
registerKernelFactory
(
CalcGBSAOBCEnergyKernel
::
Name
(),
factory
);
registerKernelFactory
(
IntegrateVerletStepKernel
::
Name
(),
factory
);
registerKernelFactory
(
IntegrateLangevinStepKernel
::
Name
(),
factory
);
registerKernelFactory
(
IntegrateBrownianStepKernel
::
Name
(),
factory
);
registerKernelFactory
(
ApplyAndersenThermostatKernel
::
Name
(),
factory
);
registerKernelFactory
(
CalcKineticEnergyKernel
::
Name
(),
factory
);
}
platforms/reference/src/ReferenceStreamFactory.cpp
0 → 100644
View file @
e561a678
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "ReferenceStreamFactory.h"
#include "ReferenceFloatStreamImpl.h"
using
namespace
OpenMM
;
StreamImpl
*
ReferenceStreamFactory
::
createStreamImpl
(
std
::
string
name
,
int
size
,
Stream
::
DataType
type
)
const
{
switch
(
type
)
{
case
Stream
::
Float
:
case
Stream
::
Float2
:
case
Stream
::
Float3
:
case
Stream
::
Float4
:
case
Stream
::
Double
:
case
Stream
::
Double2
:
case
Stream
::
Double3
:
case
Stream
::
Double4
:
return
new
ReferenceFloatStreamImpl
(
name
,
size
,
type
);
default:
// TODO implement integer streams
return
0
;
}
}
platforms/reference/src/ReferenceAngleBondIxn.cpp
→
platforms/reference/src/
SimTKReference/
ReferenceAngleBondIxn.cpp
View file @
e561a678
File moved
platforms/reference/src/ReferenceAngleBondIxn.h
→
platforms/reference/src/
SimTKReference/
ReferenceAngleBondIxn.h
View file @
e561a678
File moved
platforms/reference/src/ReferenceBondForce.cpp
→
platforms/reference/src/
SimTKReference/
ReferenceBondForce.cpp
View file @
e561a678
...
@@ -25,9 +25,9 @@
...
@@ -25,9 +25,9 @@
#include <string.h>
#include <string.h>
#include <sstream>
#include <sstream>
#include "SimTKOpenMMCommon.h"
#include "
../SimTKUtilities/
SimTKOpenMMCommon.h"
#include "SimTKOpenMMLog.h"
#include "
../SimTKUtilities/
SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h"
#include "
../SimTKUtilities/
SimTKOpenMMUtilities.h"
#include "ReferenceBondForce.h"
#include "ReferenceBondForce.h"
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
...
platforms/reference/src/ReferenceBondForce.h
→
platforms/reference/src/
SimTKReference/
ReferenceBondForce.h
View file @
e561a678
File moved
platforms/reference/src/ReferenceBondIxn.cpp
→
platforms/reference/src/
SimTKReference/
ReferenceBondIxn.cpp
View file @
e561a678
File moved
platforms/reference/src/ReferenceBondIxn.h
→
platforms/reference/src/
SimTKReference/
ReferenceBondIxn.h
View file @
e561a678
File moved
platforms/reference/src/ReferenceConstraint.cpp
→
platforms/reference/src/
SimTKReference/
ReferenceConstraint.cpp
View file @
e561a678
File moved
Prev
1
2
3
Next
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