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
217b45d3
Commit
217b45d3
authored
Jan 07, 2011
by
Mark Friedrichs
Browse files
Initial serialization proxies for Amoeba
parent
b90e80ff
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1337 additions
and
0 deletions
+1337
-0
plugins/amoeba/CMakeLists.txt
plugins/amoeba/CMakeLists.txt
+4
-0
plugins/amoeba/serialization/CMakeLists.txt
plugins/amoeba/serialization/CMakeLists.txt
+88
-0
plugins/amoeba/serialization/include/openmm/serializatio
plugins/amoeba/serialization/include/openmm/serializatio
+53
-0
plugins/amoeba/serialization/include/openmm/serialization/AmoebaHarmonicAngleForceProxy.h
...lude/openmm/serialization/AmoebaHarmonicAngleForceProxy.h
+53
-0
plugins/amoeba/serialization/include/openmm/serialization/AmoebaHarmonicBondForceProxy.h
...clude/openmm/serialization/AmoebaHarmonicBondForceProxy.h
+53
-0
plugins/amoeba/serialization/include/openmm/serialization/AmoebaHarmonicInPlaneAngleForceProxy.h
...enmm/serialization/AmoebaHarmonicInPlaneAngleForceProxy.h
+53
-0
plugins/amoeba/serialization/include/openmm/serialization/AmoebaOutOfPlaneBendForceProxy.h
...ude/openmm/serialization/AmoebaOutOfPlaneBendForceProxy.h
+53
-0
plugins/amoeba/serialization/include/openmm/serialization/AmoebaPiTorsionForceProxy.h
.../include/openmm/serialization/AmoebaPiTorsionForceProxy.h
+53
-0
plugins/amoeba/serialization/include/openmm/serialization/AmoebaTorsionForceProxy.h
...on/include/openmm/serialization/AmoebaTorsionForceProxy.h
+53
-0
plugins/amoeba/serialization/src/AmoebaHarmonicAngleForceProxy.cpp
...moeba/serialization/src/AmoebaHarmonicAngleForceProxy.cpp
+80
-0
plugins/amoeba/serialization/src/AmoebaHarmonicBondForceProxy.cpp
...amoeba/serialization/src/AmoebaHarmonicBondForceProxy.cpp
+76
-0
plugins/amoeba/serialization/src/AmoebaHarmonicInPlaneAngleForceProxy.cpp
...erialization/src/AmoebaHarmonicInPlaneAngleForceProxy.cpp
+80
-0
plugins/amoeba/serialization/src/AmoebaOutOfPlaneBendForceProxy.cpp
...oeba/serialization/src/AmoebaOutOfPlaneBendForceProxy.cpp
+80
-0
plugins/amoeba/serialization/src/AmoebaPiTorsionForceProxy.cpp
...ns/amoeba/serialization/src/AmoebaPiTorsionForceProxy.cpp
+72
-0
plugins/amoeba/serialization/src/AmoebaSerializationProxyRegistration.cpp
...erialization/src/AmoebaSerializationProxyRegistration.cpp
+104
-0
plugins/amoeba/serialization/src/AmoebaTorsionForceProxy.cpp
plugins/amoeba/serialization/src/AmoebaTorsionForceProxy.cpp
+96
-0
plugins/amoeba/serialization/tests/CMakeLists.txt
plugins/amoeba/serialization/tests/CMakeLists.txt
+17
-0
plugins/amoeba/serialization/tests/TestSerializeAmoebaHarmonicAngleForce.cpp
...alization/tests/TestSerializeAmoebaHarmonicAngleForce.cpp
+91
-0
plugins/amoeba/serialization/tests/TestSerializeAmoebaHarmonicBondForce.cpp
...ialization/tests/TestSerializeAmoebaHarmonicBondForce.cpp
+86
-0
plugins/amoeba/serialization/tests/TestSerializeAmoebaHarmonicInPlaneAngleForce.cpp
...on/tests/TestSerializeAmoebaHarmonicInPlaneAngleForce.cpp
+92
-0
No files found.
plugins/amoeba/CMakeLists.txt
View file @
217b45d3
...
...
@@ -195,6 +195,10 @@ ELSE (EXECUTABLE_OUTPUT_PATH)
SET
(
TEST_PATH .
)
ENDIF
(
EXECUTABLE_OUTPUT_PATH
)
IF
(
OPENMM_BUILD_SERIALIZATION_SUPPORT
)
ADD_SUBDIRECTORY
(
serialization
)
ENDIF
(
OPENMM_BUILD_SERIALIZATION_SUPPORT
)
#INCLUDE(ApiDoxygen.cmake)
#ADD_SUBDIRECTORY(tests)
...
...
plugins/amoeba/serialization/CMakeLists.txt
0 → 100644
View file @
217b45d3
#---------------------------------------------------
# OpenMMAmoeba Serialization Library
#
# Creates OpenMMAmoeba serializatin library, base name=OpenMMAmoebaSerialization.
# Default libraries are shared & optimized. Variants
# are created for static (_static) and debug (_d).
#
# Windows:
# OpenMMAmoebaSerialization[_d].dll
# OpenMMAmoebaSerialization[_d].lib
# Unix:
# libOpenMMAmoebaSerialization[_d].so
#----------------------------------------------------
# The source is organized into subdirectories, but we handle them all from
# this CMakeLists file rather than letting CMake visit them as SUBDIRS.
SET
(
OPENMM_SOURCE_SUBDIRS . ../../../serialization
)
SET
(
OPENMM_AMOEBA_SOURCE_SUBDIRS .
)
# Collect up information about the version of the OpenMM library we're building
# and make it available to the code so it can be built into the binaries.
SET
(
OPENMM_SERIALIZATION_LIBRARY_NAME OpenMMSerialization
)
SET
(
OPENMM_AMOEBA_SERIALIZATION_LIBRARY_NAME OpenMMAmoebaSerialization
)
# Ensure that debug libraries have "_d" appended to their names.
# CMake gets this right on Windows automatically with this definition.
IF
(
${
CMAKE_GENERATOR
}
MATCHES
"Visual Studio"
)
SET
(
CMAKE_DEBUG_POSTFIX
"_d"
CACHE INTERNAL
""
FORCE
)
ENDIF
(
${
CMAKE_GENERATOR
}
MATCHES
"Visual Studio"
)
# But on Unix or Cygwin we have to add the suffix manually
IF
(
UNIX AND CMAKE_BUILD_TYPE MATCHES Debug
)
SET
(
OPENMM_AMOEBA_SERIALIZATION_LIBRARY_NAME
${
OPENMM_AMOEBA_SERIALIZATION_LIBRARY_NAME
}
_d
)
ENDIF
(
UNIX AND CMAKE_BUILD_TYPE MATCHES Debug
)
# These are all the places to search for header files which are
# to be part of the API.
SET
(
API_INCLUDE_DIRS
)
# start empty
FOREACH
(
subdir
${
OPENMM_SOURCE_SUBDIRS
}
)
# append
SET
(
API_INCLUDE_DIRS
${
API_INCLUDE_DIRS
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
subdir
}
/include
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
subdir
}
/include/internal
)
ENDFOREACH
(
subdir
)
# We'll need both *relative* path names, starting with their API_INCLUDE_DIRS,
# and absolute pathnames.
SET
(
API_REL_INCLUDE_FILES
)
# start these out empty
SET
(
API_ABS_INCLUDE_FILES
)
FOREACH
(
dir
${
API_INCLUDE_DIRS
}
)
FILE
(
GLOB fullpaths
${
dir
}
/*.h
)
# returns full pathnames
SET
(
API_ABS_INCLUDE_FILES
${
API_ABS_INCLUDE_FILES
}
${
fullpaths
}
)
FOREACH
(
pathname
${
fullpaths
}
)
GET_FILENAME_COMPONENT
(
filename
${
pathname
}
NAME
)
SET
(
API_REL_INCLUDE_FILES
${
API_REL_INCLUDE_FILES
}
${
dir
}
/
${
filename
}
)
ENDFOREACH
(
pathname
)
ENDFOREACH
(
dir
)
# collect up source files
SET
(
SOURCE_FILES
)
# empty
SET
(
SOURCE_INCLUDE_FILES
)
FOREACH
(
subdir
${
OPENMM_AMOEBA_SOURCE_SUBDIRS
}
)
FILE
(
GLOB_RECURSE src_files
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
subdir
}
/src/*.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
subdir
}
/src/*.c
)
FILE
(
GLOB incl_files
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
subdir
}
/src/*.h
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
subdir
}
/src/*.hpp
)
SET
(
SOURCE_FILES
${
SOURCE_FILES
}
${
src_files
}
)
#append
SET
(
SOURCE_INCLUDE_FILES
${
SOURCE_INCLUDE_FILES
}
${
incl_files
}
)
INCLUDE_DIRECTORIES
(
BEFORE
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
subdir
}
/include
)
INCLUDE_DIRECTORIES
(
BEFORE
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../serialization/
${
subdir
}
/include
)
ENDFOREACH
(
subdir
)
#Message( "API_REL_INCLUDE_FILES=${API_REL_INCLUDE_FILES}\n" )
INCLUDE_DIRECTORIES
(
BEFORE
${
CMAKE_CURRENT_SOURCE_DIR
}
/src
)
# Create the library
ADD_LIBRARY
(
${
OPENMM_AMOEBA_SERIALIZATION_LIBRARY_NAME
}
SHARED
${
SOURCE_FILES
}
${
SOURCE_INCLUDE_FILES
}
${
API_ABS_INCLUDE_FILES
}
)
TARGET_LINK_LIBRARIES
(
${
OPENMM_AMOEBA_SERIALIZATION_LIBRARY_NAME
}
${
SHARED_TARGET
}
)
SET_TARGET_PROPERTIES
(
${
OPENMM_AMOEBA_SERIALIZATION_LIBRARY_NAME
}
PROPERTIES COMPILE_FLAGS
"-DOPENMM_BUILDING_SHARED_LIBRARY -DTIXML_USE_STL -DIEEE_8087"
)
INSTALL_TARGETS
(
/lib RUNTIME_DIRECTORY /lib
${
OPENMM_AMOEBA_SERIALIZATION_LIBRARY_NAME
}
)
INSTALL_FILES
(
/include/openmm/serialization FILES
${
CMAKE_CURRENT_SOURCE_DIR
}
/include/openmm/serialization/SerializationNode.h
)
INSTALL_FILES
(
/include/openmm/serialization FILES
${
CMAKE_CURRENT_SOURCE_DIR
}
/include/openmm/serialization/SerializationProxy.h
)
INSTALL_FILES
(
/include/openmm/serialization FILES
${
CMAKE_CURRENT_SOURCE_DIR
}
/include/openmm/serialization/XmlSerializer.h
)
ADD_SUBDIRECTORY
(
tests
)
plugins/amoeba/serialization/include/openmm/serializatio
0 → 100644
View file @
217b45d3
#ifndef OPENMM_HARMONICBONDFORCE_PROXY_H_
#define OPENMM_HARMONICBONDFORCE_PROXY_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) 2010 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 "openmm/internal/windowsExport.h"
#include "openmm/serialization/SerializationProxy.h"
namespace OpenMM {
/**
* This is a proxy for serializing HarmonicBondForce objects.
*/
class OPENMM_EXPORT HarmonicBondForceProxy : public SerializationProxy {
public:
HarmonicBondForceProxy();
void serialize(const void* object, SerializationNode& node) const;
void* deserialize(const SerializationNode& node) const;
};
} // namespace OpenMM
#endif /*OPENMM_HARMONICBONDFORCE_PROXY_H_*/
plugins/amoeba/serialization/include/openmm/serialization/AmoebaHarmonicAngleForceProxy.h
0 → 100644
View file @
217b45d3
#ifndef OPENMM_AMOEBA_HARMONIC_ANGLE_FORCE_PROXY_H_
#define OPENMM_AMOEBA_HARMONIC_ANGLE_FORCE_PROXY_H_
/* -------------------------------------------------------------------------- *
* OpenMMAmoeba *
* -------------------------------------------------------------------------- *
* 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) 2010 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 "openmm/internal/windowsExport.h"
#include "openmm/serialization/SerializationProxy.h"
namespace
OpenMM
{
/**
* This is a proxy for serializing AmoebaHarmonicAngleForce objects.
*/
class
OPENMM_EXPORT
AmoebaHarmonicAngleForceProxy
:
public
SerializationProxy
{
public:
AmoebaHarmonicAngleForceProxy
();
void
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
;
void
*
deserialize
(
const
SerializationNode
&
node
)
const
;
};
}
// namespace OpenMM
#endif
/*OPENMM_AMOEBA_HARMONIC_ANGLE_FORCE_PROXY_H_*/
plugins/amoeba/serialization/include/openmm/serialization/AmoebaHarmonicBondForceProxy.h
0 → 100644
View file @
217b45d3
#ifndef OPENMM_AMOEBA_HARMONIC_BOND_FORCE_PROXY_H_
#define OPENMM_AMOEBA_HARMONIC_BOND_FORCE_PROXY_H_
/* -------------------------------------------------------------------------- *
* OpenMMAmoeba *
* -------------------------------------------------------------------------- *
* 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) 2010 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 "openmm/internal/windowsExport.h"
#include "openmm/serialization/SerializationProxy.h"
namespace
OpenMM
{
/**
* This is a proxy for serializing AmoebaHarmonicBondForce objects.
*/
class
OPENMM_EXPORT
AmoebaHarmonicBondForceProxy
:
public
SerializationProxy
{
public:
AmoebaHarmonicBondForceProxy
();
void
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
;
void
*
deserialize
(
const
SerializationNode
&
node
)
const
;
};
}
// namespace OpenMM
#endif
/*OPENMM_AMOEBA_HARMONIC_BOND_FORCE_PROXY_H_*/
plugins/amoeba/serialization/include/openmm/serialization/AmoebaHarmonicInPlaneAngleForceProxy.h
0 → 100644
View file @
217b45d3
#ifndef OPENMM_AMOEBA_HARMONIC_IN_PLANE_ANGLE_FORCE_PROXY_H_
#define OPENMM_AMOEBA_HARMONIC_IN_PLANE_ANGLE_FORCE_PROXY_H_
/* -------------------------------------------------------------------------- *
* OpenMMAmoeba *
* -------------------------------------------------------------------------- *
* 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) 2010 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 "openmm/internal/windowsExport.h"
#include "openmm/serialization/SerializationProxy.h"
namespace
OpenMM
{
/**
* This is a proxy for serializing AmoebaHarmonicInPlaneAngleForce objects.
*/
class
OPENMM_EXPORT
AmoebaHarmonicInPlaneAngleForceProxy
:
public
SerializationProxy
{
public:
AmoebaHarmonicInPlaneAngleForceProxy
();
void
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
;
void
*
deserialize
(
const
SerializationNode
&
node
)
const
;
};
}
// namespace OpenMM
#endif
/*OPENMM_AMOEBA_HARMONIC_IN_PLANE_ANGLE_FORCE_PROXY_H_*/
plugins/amoeba/serialization/include/openmm/serialization/AmoebaOutOfPlaneBendForceProxy.h
0 → 100644
View file @
217b45d3
#ifndef OPENMM_AMOEBA_OUT_OF_PLANE_BEND_FORCE_PROXY_H_
#define OPENMM_AMOEBA_OUT_OF_PLANE_BEND_FORCE_PROXY_H_
/* -------------------------------------------------------------------------- *
* OpenMMAmoeba *
* -------------------------------------------------------------------------- *
* 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) 2010 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 "openmm/internal/windowsExport.h"
#include "openmm/serialization/SerializationProxy.h"
namespace
OpenMM
{
/**
* This is a proxy for serializing AmoebaOutOfPlaneBendForce objects.
*/
class
OPENMM_EXPORT
AmoebaOutOfPlaneBendForceProxy
:
public
SerializationProxy
{
public:
AmoebaOutOfPlaneBendForceProxy
();
void
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
;
void
*
deserialize
(
const
SerializationNode
&
node
)
const
;
};
}
// namespace OpenMM
#endif
/*OPENMM_AMOEBA_OUT_OF_PLANE_BEND_FORCE_PROXY_H_*/
plugins/amoeba/serialization/include/openmm/serialization/AmoebaPiTorsionForceProxy.h
0 → 100644
View file @
217b45d3
#ifndef OPENMM_AMOEBA_PI_TORSION_FORCE_PROXY_H_
#define OPENMM_AMOEBA_PI_TORSION_FORCE_PROXY_H_
/* -------------------------------------------------------------------------- *
* OpenMMAmoeba *
* -------------------------------------------------------------------------- *
* 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) 2010 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 "openmm/internal/windowsExport.h"
#include "openmm/serialization/SerializationProxy.h"
namespace
OpenMM
{
/**
* This is a proxy for serializing AmoebaPiTorsionForce objects.
*/
class
OPENMM_EXPORT
AmoebaPiTorsionForceProxy
:
public
SerializationProxy
{
public:
AmoebaPiTorsionForceProxy
();
void
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
;
void
*
deserialize
(
const
SerializationNode
&
node
)
const
;
};
}
// namespace OpenMM
#endif
/*OPENMM_AMOEBA_PI_TORSION_FORCE_PROXY_H_*/
plugins/amoeba/serialization/include/openmm/serialization/AmoebaTorsionForceProxy.h
0 → 100644
View file @
217b45d3
#ifndef OPENMM_AMOEBA_TORSION_FORCE_PROXY_H_
#define OPENMM_AMOEBA_TORSION_FORCE_PROXY_H_
/* -------------------------------------------------------------------------- *
* OpenMMAmoeba *
* -------------------------------------------------------------------------- *
* 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) 2010 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 "openmm/internal/windowsExport.h"
#include "openmm/serialization/SerializationProxy.h"
namespace
OpenMM
{
/**
* This is a proxy for serializing AmoebaTorsionForce objects.
*/
class
OPENMM_EXPORT
AmoebaTorsionForceProxy
:
public
SerializationProxy
{
public:
AmoebaTorsionForceProxy
();
void
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
;
void
*
deserialize
(
const
SerializationNode
&
node
)
const
;
};
}
// namespace OpenMM
#endif
/*OPENMM_AMOEBA_TORSION_FORCE_PROXY_H_*/
plugins/amoeba/serialization/src/AmoebaHarmonicAngleForceProxy.cpp
0 → 100644
View file @
217b45d3
/* -------------------------------------------------------------------------- *
* OpenMMAmoeba *
* -------------------------------------------------------------------------- *
* 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) 2010 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 "openmm/serialization/AmoebaHarmonicAngleForceProxy.h"
#include "openmm/serialization/SerializationNode.h"
#include "openmm/Force.h"
#include "openmm/AmoebaHarmonicAngleForce.h"
#include <sstream>
using
namespace
OpenMM
;
using
namespace
std
;
AmoebaHarmonicAngleForceProxy
::
AmoebaHarmonicAngleForceProxy
()
:
SerializationProxy
(
"AmoebaHarmonicAngleForce"
)
{
}
void
AmoebaHarmonicAngleForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
const
AmoebaHarmonicAngleForce
&
force
=
*
reinterpret_cast
<
const
AmoebaHarmonicAngleForce
*>
(
object
);
node
.
setDoubleProperty
(
"HarmonicAngleCubic"
,
force
.
getAmoebaGlobalHarmonicAngleCubic
());
node
.
setDoubleProperty
(
"HarmonicAngleQuartic"
,
force
.
getAmoebaGlobalHarmonicAngleQuartic
());
node
.
setDoubleProperty
(
"HarmonicAnglePentic"
,
force
.
getAmoebaGlobalHarmonicAnglePentic
());
node
.
setDoubleProperty
(
"HarmonicAngleSextic"
,
force
.
getAmoebaGlobalHarmonicAngleSextic
());
SerializationNode
&
bonds
=
node
.
createChildNode
(
"Angles"
);
for
(
int
i
=
0
;
i
<
force
.
getNumAngles
();
i
++
)
{
int
particle1
,
particle2
,
particle3
;
double
distance
,
k
;
force
.
getAngleParameters
(
i
,
particle1
,
particle2
,
particle3
,
distance
,
k
);
bonds
.
createChildNode
(
"Angle"
).
setIntProperty
(
"p1"
,
particle1
).
setIntProperty
(
"p2"
,
particle2
).
setIntProperty
(
"p3"
,
particle3
).
setDoubleProperty
(
"d"
,
distance
).
setDoubleProperty
(
"k"
,
k
);
}
}
void
*
AmoebaHarmonicAngleForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
throw
OpenMMException
(
"Unsupported version number"
);
AmoebaHarmonicAngleForce
*
force
=
new
AmoebaHarmonicAngleForce
();
try
{
force
->
setAmoebaGlobalHarmonicAngleCubic
(
node
.
getDoubleProperty
(
"HarmonicAngleCubic"
));
force
->
setAmoebaGlobalHarmonicAngleQuartic
(
node
.
getDoubleProperty
(
"HarmonicAngleQuartic"
));
force
->
setAmoebaGlobalHarmonicAnglePentic
(
node
.
getDoubleProperty
(
"HarmonicAnglePentic"
));
force
->
setAmoebaGlobalHarmonicAngleSextic
(
node
.
getDoubleProperty
(
"HarmonicAngleSextic"
));
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"Angles"
);
for
(
int
i
=
0
;
i
<
(
int
)
bonds
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
bond
=
bonds
.
getChildren
()[
i
];
force
->
addAngle
(
bond
.
getIntProperty
(
"p1"
),
bond
.
getIntProperty
(
"p2"
),
bond
.
getIntProperty
(
"p3"
),
bond
.
getDoubleProperty
(
"d"
),
bond
.
getDoubleProperty
(
"k"
));
}
}
catch
(...)
{
delete
force
;
throw
;
}
return
force
;
}
plugins/amoeba/serialization/src/AmoebaHarmonicBondForceProxy.cpp
0 → 100644
View file @
217b45d3
/* -------------------------------------------------------------------------- *
* OpenMMAmoeba *
* -------------------------------------------------------------------------- *
* 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) 2010 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 "openmm/serialization/AmoebaHarmonicBondForceProxy.h"
#include "openmm/serialization/SerializationNode.h"
#include "openmm/Force.h"
#include "openmm/AmoebaHarmonicBondForce.h"
#include <sstream>
using
namespace
OpenMM
;
using
namespace
std
;
AmoebaHarmonicBondForceProxy
::
AmoebaHarmonicBondForceProxy
()
:
SerializationProxy
(
"AmoebaHarmonicBondForce"
)
{
}
void
AmoebaHarmonicBondForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
const
AmoebaHarmonicBondForce
&
force
=
*
reinterpret_cast
<
const
AmoebaHarmonicBondForce
*>
(
object
);
node
.
setDoubleProperty
(
"HarmonicBondCubic"
,
force
.
getAmoebaGlobalHarmonicBondCubic
());
node
.
setDoubleProperty
(
"HarmonicBondQuartic"
,
force
.
getAmoebaGlobalHarmonicBondQuartic
());
SerializationNode
&
bonds
=
node
.
createChildNode
(
"Bonds"
);
for
(
int
i
=
0
;
i
<
force
.
getNumBonds
();
i
++
)
{
int
particle1
,
particle2
;
double
distance
,
k
;
force
.
getBondParameters
(
i
,
particle1
,
particle2
,
distance
,
k
);
bonds
.
createChildNode
(
"Bond"
).
setIntProperty
(
"p1"
,
particle1
).
setIntProperty
(
"p2"
,
particle2
).
setDoubleProperty
(
"d"
,
distance
).
setDoubleProperty
(
"k"
,
k
);
}
}
void
*
AmoebaHarmonicBondForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
throw
OpenMMException
(
"Unsupported version number"
);
AmoebaHarmonicBondForce
*
force
=
new
AmoebaHarmonicBondForce
();
try
{
force
->
setAmoebaGlobalHarmonicBondCubic
(
node
.
getDoubleProperty
(
"HarmonicBondCubic"
));
force
->
setAmoebaGlobalHarmonicBondQuartic
(
node
.
getDoubleProperty
(
"HarmonicBondQuartic"
));
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"Bonds"
);
for
(
int
i
=
0
;
i
<
(
int
)
bonds
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
bond
=
bonds
.
getChildren
()[
i
];
force
->
addBond
(
bond
.
getIntProperty
(
"p1"
),
bond
.
getIntProperty
(
"p2"
),
bond
.
getDoubleProperty
(
"d"
),
bond
.
getDoubleProperty
(
"k"
));
}
}
catch
(...)
{
delete
force
;
throw
;
}
return
force
;
}
plugins/amoeba/serialization/src/AmoebaHarmonicInPlaneAngleForceProxy.cpp
0 → 100644
View file @
217b45d3
/* -------------------------------------------------------------------------- *
* OpenMMAmoeba *
* -------------------------------------------------------------------------- *
* 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) 2010 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 "openmm/serialization/AmoebaHarmonicInPlaneAngleForceProxy.h"
#include "openmm/serialization/SerializationNode.h"
#include "openmm/Force.h"
#include "openmm/AmoebaHarmonicInPlaneAngleForce.h"
#include <sstream>
using
namespace
OpenMM
;
using
namespace
std
;
AmoebaHarmonicInPlaneAngleForceProxy
::
AmoebaHarmonicInPlaneAngleForceProxy
()
:
SerializationProxy
(
"AmoebaHarmonicInPlaneAngleForce"
)
{
}
void
AmoebaHarmonicInPlaneAngleForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
const
AmoebaHarmonicInPlaneAngleForce
&
force
=
*
reinterpret_cast
<
const
AmoebaHarmonicInPlaneAngleForce
*>
(
object
);
node
.
setDoubleProperty
(
"HarmonicInPlaneAngleCubic"
,
force
.
getAmoebaGlobalHarmonicInPlaneAngleCubic
());
node
.
setDoubleProperty
(
"HarmonicInPlaneAngleQuartic"
,
force
.
getAmoebaGlobalHarmonicInPlaneAngleQuartic
());
node
.
setDoubleProperty
(
"HarmonicInPlaneAnglePentic"
,
force
.
getAmoebaGlobalHarmonicInPlaneAnglePentic
());
node
.
setDoubleProperty
(
"HarmonicInPlaneAngleSextic"
,
force
.
getAmoebaGlobalHarmonicInPlaneAngleSextic
());
SerializationNode
&
bonds
=
node
.
createChildNode
(
"InPlaneAngles"
);
for
(
int
i
=
0
;
i
<
force
.
getNumAngles
();
i
++
)
{
int
particle1
,
particle2
,
particle3
,
particle4
;
double
distance
,
k
;
force
.
getAngleParameters
(
i
,
particle1
,
particle2
,
particle3
,
particle4
,
distance
,
k
);
bonds
.
createChildNode
(
"InPlaneAngle"
).
setIntProperty
(
"p1"
,
particle1
).
setIntProperty
(
"p2"
,
particle2
).
setIntProperty
(
"p3"
,
particle3
).
setIntProperty
(
"p4"
,
particle4
).
setDoubleProperty
(
"d"
,
distance
).
setDoubleProperty
(
"k"
,
k
);
}
}
void
*
AmoebaHarmonicInPlaneAngleForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
throw
OpenMMException
(
"Unsupported version number"
);
AmoebaHarmonicInPlaneAngleForce
*
force
=
new
AmoebaHarmonicInPlaneAngleForce
();
try
{
force
->
setAmoebaGlobalHarmonicInPlaneAngleCubic
(
node
.
getDoubleProperty
(
"HarmonicInPlaneAngleCubic"
));
force
->
setAmoebaGlobalHarmonicInPlaneAngleQuartic
(
node
.
getDoubleProperty
(
"HarmonicInPlaneAngleQuartic"
));
force
->
setAmoebaGlobalHarmonicInPlaneAnglePentic
(
node
.
getDoubleProperty
(
"HarmonicInPlaneAnglePentic"
));
force
->
setAmoebaGlobalHarmonicInPlaneAngleSextic
(
node
.
getDoubleProperty
(
"HarmonicInPlaneAngleSextic"
));
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"InPlaneAngles"
);
for
(
int
i
=
0
;
i
<
(
int
)
bonds
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
bond
=
bonds
.
getChildren
()[
i
];
force
->
addAngle
(
bond
.
getIntProperty
(
"p1"
),
bond
.
getIntProperty
(
"p2"
),
bond
.
getIntProperty
(
"p3"
),
bond
.
getIntProperty
(
"p4"
),
bond
.
getDoubleProperty
(
"d"
),
bond
.
getDoubleProperty
(
"k"
));
}
}
catch
(...)
{
delete
force
;
throw
;
}
return
force
;
}
plugins/amoeba/serialization/src/AmoebaOutOfPlaneBendForceProxy.cpp
0 → 100644
View file @
217b45d3
/* -------------------------------------------------------------------------- *
* OpenMMAmoeba *
* -------------------------------------------------------------------------- *
* 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) 2010 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 "openmm/serialization/AmoebaOutOfPlaneBendForceProxy.h"
#include "openmm/serialization/SerializationNode.h"
#include "openmm/Force.h"
#include "openmm/AmoebaOutOfPlaneBendForce.h"
#include <sstream>
using
namespace
OpenMM
;
using
namespace
std
;
AmoebaOutOfPlaneBendForceProxy
::
AmoebaOutOfPlaneBendForceProxy
()
:
SerializationProxy
(
"AmoebaOutOfPlaneBendForce"
)
{
}
void
AmoebaOutOfPlaneBendForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
const
AmoebaOutOfPlaneBendForce
&
force
=
*
reinterpret_cast
<
const
AmoebaOutOfPlaneBendForce
*>
(
object
);
node
.
setDoubleProperty
(
"OutOfPlaneBendCubic"
,
force
.
getAmoebaGlobalOutOfPlaneBendCubic
());
node
.
setDoubleProperty
(
"OutOfPlaneBendQuartic"
,
force
.
getAmoebaGlobalOutOfPlaneBendQuartic
());
node
.
setDoubleProperty
(
"OutOfPlaneBendPentic"
,
force
.
getAmoebaGlobalOutOfPlaneBendPentic
());
node
.
setDoubleProperty
(
"OutOfPlaneBendSextic"
,
force
.
getAmoebaGlobalOutOfPlaneBendSextic
());
SerializationNode
&
bonds
=
node
.
createChildNode
(
"OutOfPlaneBend"
);
for
(
int
i
=
0
;
i
<
force
.
getNumOutOfPlaneBends
();
i
++
)
{
int
particle1
,
particle2
,
particle3
,
particle4
;
double
k
;
force
.
getOutOfPlaneBendParameters
(
i
,
particle1
,
particle2
,
particle3
,
particle4
,
k
);
bonds
.
createChildNode
(
"OutOfPlaneBend"
).
setIntProperty
(
"p1"
,
particle1
).
setIntProperty
(
"p2"
,
particle2
).
setIntProperty
(
"p3"
,
particle3
).
setIntProperty
(
"p4"
,
particle4
).
setDoubleProperty
(
"k"
,
k
);
}
}
void
*
AmoebaOutOfPlaneBendForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
throw
OpenMMException
(
"Unsupported version number"
);
AmoebaOutOfPlaneBendForce
*
force
=
new
AmoebaOutOfPlaneBendForce
();
try
{
force
->
setAmoebaGlobalOutOfPlaneBendCubic
(
node
.
getDoubleProperty
(
"OutOfPlaneBendCubic"
));
force
->
setAmoebaGlobalOutOfPlaneBendQuartic
(
node
.
getDoubleProperty
(
"OutOfPlaneBendQuartic"
));
force
->
setAmoebaGlobalOutOfPlaneBendPentic
(
node
.
getDoubleProperty
(
"OutOfPlaneBendPentic"
));
force
->
setAmoebaGlobalOutOfPlaneBendSextic
(
node
.
getDoubleProperty
(
"OutOfPlaneBendSextic"
));
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"OutOfPlaneBend"
);
for
(
int
i
=
0
;
i
<
(
int
)
bonds
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
bond
=
bonds
.
getChildren
()[
i
];
force
->
addOutOfPlaneBend
(
bond
.
getIntProperty
(
"p1"
),
bond
.
getIntProperty
(
"p2"
),
bond
.
getIntProperty
(
"p3"
),
bond
.
getIntProperty
(
"p4"
),
bond
.
getDoubleProperty
(
"k"
));
}
}
catch
(...)
{
delete
force
;
throw
;
}
return
force
;
}
plugins/amoeba/serialization/src/AmoebaPiTorsionForceProxy.cpp
0 → 100644
View file @
217b45d3
/* -------------------------------------------------------------------------- *
* OpenMMAmoeba *
* -------------------------------------------------------------------------- *
* 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) 2010 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 "openmm/serialization/AmoebaPiTorsionForceProxy.h"
#include "openmm/serialization/SerializationNode.h"
#include "openmm/Force.h"
#include "openmm/AmoebaPiTorsionForce.h"
#include <sstream>
using
namespace
OpenMM
;
using
namespace
std
;
AmoebaPiTorsionForceProxy
::
AmoebaPiTorsionForceProxy
()
:
SerializationProxy
(
"AmoebaPiTorsionForce"
)
{
}
void
AmoebaPiTorsionForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
const
AmoebaPiTorsionForce
&
force
=
*
reinterpret_cast
<
const
AmoebaPiTorsionForce
*>
(
object
);
SerializationNode
&
bonds
=
node
.
createChildNode
(
"PiTorsion"
);
for
(
int
i
=
0
;
i
<
force
.
getNumPiTorsions
();
i
++
)
{
int
particle1
,
particle2
,
particle3
,
particle4
,
particle5
,
particle6
;
double
k
;
force
.
getPiTorsionParameters
(
i
,
particle1
,
particle2
,
particle3
,
particle4
,
particle5
,
particle6
,
k
);
bonds
.
createChildNode
(
"PiTorsion"
).
setIntProperty
(
"p1"
,
particle1
).
setIntProperty
(
"p2"
,
particle2
).
setIntProperty
(
"p3"
,
particle3
).
setIntProperty
(
"p4"
,
particle4
).
setIntProperty
(
"p5"
,
particle5
).
setIntProperty
(
"p6"
,
particle6
).
setDoubleProperty
(
"k"
,
k
);
}
}
void
*
AmoebaPiTorsionForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
throw
OpenMMException
(
"Unsupported version number"
);
AmoebaPiTorsionForce
*
force
=
new
AmoebaPiTorsionForce
();
try
{
const
SerializationNode
&
bonds
=
node
.
getChildNode
(
"PiTorsion"
);
for
(
int
i
=
0
;
i
<
(
int
)
bonds
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
bond
=
bonds
.
getChildren
()[
i
];
force
->
addPiTorsion
(
bond
.
getIntProperty
(
"p1"
),
bond
.
getIntProperty
(
"p2"
),
bond
.
getIntProperty
(
"p3"
),
bond
.
getIntProperty
(
"p4"
),
bond
.
getIntProperty
(
"p5"
),
bond
.
getIntProperty
(
"p6"
),
bond
.
getDoubleProperty
(
"k"
));
}
}
catch
(...)
{
delete
force
;
throw
;
}
return
force
;
}
plugins/amoeba/serialization/src/AmoebaSerializationProxyRegistration.cpp
0 → 100644
View file @
217b45d3
/* -------------------------------------------------------------------------- *
* OpenMMAmoeba *
* -------------------------------------------------------------------------- *
* 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) 2010 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. *
* -------------------------------------------------------------------------- */
#ifdef WIN32
#include <windows.h>
#include <sstream>
#else
#include <dlfcn.h>
#include <dirent.h>
#include <cstdlib>
#endif
#include "openmm/OpenMMException.h"
#include "openmm/AmoebaHarmonicBondForce.h"
#include "openmm/AmoebaHarmonicAngleForce.h"
#include "openmm/AmoebaHarmonicInPlaneAngleForce.h"
#include "openmm/AmoebaOutOfPlaneBendForce.h"
#include "openmm/AmoebaPiTorsionForce.h"
#include "openmm/AmoebaTorsionForce.h"
#include "openmm/serialization/SerializationProxy.h"
#include "openmm/serialization/AmoebaHarmonicBondForceProxy.h"
#include "openmm/serialization/AmoebaHarmonicAngleForceProxy.h"
#include "openmm/serialization/AmoebaHarmonicInPlaneAngleForceProxy.h"
#include "openmm/serialization/AmoebaOutOfPlaneBendForceProxy.h"
#include "openmm/serialization/AmoebaPiTorsionForceProxy.h"
#include "openmm/serialization/AmoebaTorsionForceProxy.h"
#if defined(WIN32)
#include <windows.h>
extern
"C"
void
registerAmoebaSerializationProxies
();
BOOL
WINAPI
DllMain
(
HANDLE
hModule
,
DWORD
ul_reason_for_call
,
LPVOID
lpReserved
)
{
if
(
ul_reason_for_call
==
DLL_PROCESS_ATTACH
)
registerAmoebaSerializationProxies
();
return
TRUE
;
}
#else
extern
"C"
void
__attribute__
((
constructor
))
registerAmoebaSerializationProxies
();
#endif
using
namespace
OpenMM
;
extern
"C"
void
registerAmoebaSerializationProxies
()
{
// force libOpenMMSerialization to load before libOpenMMSerialization
// required in order guarantee initialization of
// map<const string, const SerializationProxy*> SerializationProxy::proxiesByType;
// map<const string, const SerializationProxy*> SerializationProxy::proxiesByName;
// is there a cleaner solution?
std
::
string
file
=
"libOpenMMSerialization.so"
;
#ifdef WIN32
// Tell Windows not to bother the user with ugly error boxes.
const
UINT
oldErrorMode
=
SetErrorMode
(
SEM_FAILCRITICALERRORS
);
HMODULE
handle
=
LoadLibrary
(
file
.
c_str
());
SetErrorMode
(
oldErrorMode
);
// Restore previous error mode.
if
(
handle
==
NULL
)
{
string
message
;
stringstream
(
message
)
<<
"Error loading library "
<<
file
<<
": "
<<
GetLastError
();
throw
OpenMMException
(
message
);
}
#else
void
*
handle
=
dlopen
(
file
.
c_str
(),
RTLD_LAZY
|
RTLD_GLOBAL
);
if
(
handle
==
NULL
)
throw
OpenMMException
(
"Error loading library "
+
file
+
": "
+
dlerror
());
#endif
SerializationProxy
::
registerProxy
(
typeid
(
AmoebaHarmonicBondForce
),
new
AmoebaHarmonicBondForceProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
AmoebaHarmonicAngleForce
),
new
AmoebaHarmonicAngleForceProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
AmoebaHarmonicInPlaneAngleForce
),
new
AmoebaHarmonicInPlaneAngleForceProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
AmoebaOutOfPlaneBendForce
),
new
AmoebaOutOfPlaneBendForceProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
AmoebaPiTorsionForce
),
new
AmoebaPiTorsionForceProxy
());
SerializationProxy
::
registerProxy
(
typeid
(
AmoebaTorsionForce
),
new
AmoebaTorsionForceProxy
());
}
plugins/amoeba/serialization/src/AmoebaTorsionForceProxy.cpp
0 → 100644
View file @
217b45d3
/* -------------------------------------------------------------------------- *
* OpenMMAmoeba *
* -------------------------------------------------------------------------- *
* 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) 2010 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 "openmm/serialization/AmoebaTorsionForceProxy.h"
#include "openmm/serialization/SerializationNode.h"
#include "openmm/Force.h"
#include "openmm/AmoebaTorsionForce.h"
#include <sstream>
using
namespace
OpenMM
;
using
namespace
std
;
AmoebaTorsionForceProxy
::
AmoebaTorsionForceProxy
()
:
SerializationProxy
(
"AmoebaTorsionForce"
)
{
}
static
void
addTorsionValues
(
SerializationNode
&
torsion
,
std
::
vector
<
double
>&
torsionValues
){
for
(
int
j
=
0
;
j
<
torsionValues
.
size
();
j
++
)
{
torsion
.
createChildNode
(
"Value"
).
setDoubleProperty
(
"v"
,
torsionValues
[
j
]);
}
}
static
void
loadTorsionValues
(
SerializationNode
&
torsion
,
std
::
vector
<
double
>&
torsionValues
){
for
(
int
j
=
0
;
j
<
torsionValues
.
size
();
j
++
)
{
torsion
.
createChildNode
(
"Value"
).
setDoubleProperty
(
"v"
,
torsionValues
[
j
]);
}
}
void
AmoebaTorsionForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
const
AmoebaTorsionForce
&
force
=
*
reinterpret_cast
<
const
AmoebaTorsionForce
*>
(
object
);
SerializationNode
&
bonds
=
node
.
createChildNode
(
"Torsion"
);
for
(
int
i
=
0
;
i
<
force
.
getNumTorsions
();
i
++
)
{
int
particle1
,
particle2
,
particle3
,
particle4
;
std
::
vector
<
double
>
torsion1
;
std
::
vector
<
double
>
torsion2
;
std
::
vector
<
double
>
torsion3
;
force
.
getTorsionParameters
(
i
,
particle1
,
particle2
,
particle3
,
particle4
,
torsion1
,
torsion2
,
torsion3
);
bonds
.
createChildNode
(
"Torsion"
).
setIntProperty
(
"p1"
,
particle1
).
setIntProperty
(
"p2"
,
particle2
).
setIntProperty
(
"p3"
,
particle3
).
setIntProperty
(
"p4"
,
particle4
);
SerializationNode
&
torsion
=
bonds
.
createChildNode
(
"Torsion1"
).
setIntProperty
(
"size"
,
torsion1
.
size
());
addTorsionValues
(
torsion
,
torsion1
);
torsion
=
bonds
.
createChildNode
(
"Torsion2"
).
setIntProperty
(
"size"
,
torsion2
.
size
());
addTorsionValues
(
torsion
,
torsion2
);
torsion
=
bonds
.
createChildNode
(
"Torsion3"
).
setIntProperty
(
"size"
,
torsion3
.
size
());
addTorsionValues
(
torsion
,
torsion3
);
}
}
void
*
AmoebaTorsionForceProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
if
(
node
.
getIntProperty
(
"version"
)
!=
1
)
throw
OpenMMException
(
"Unsupported version number"
);
AmoebaTorsionForce
*
force
=
new
AmoebaTorsionForce
();
/*
try {
const SerializationNode& bonds = node.getChildNode("Torsion");
for (int i = 0; i < (int) bonds.getChildren().size(); i++) {
const SerializationNode& bond = bonds.getChildren()[i];
//force->addTorsion(bond.getIntProperty("p1"), bond.getIntProperty("p2"), bond.getIntProperty("p3"), bond.getIntProperty("p4") );
std::vector<double> torsion1, std::vector<double> torsion2, std::vector<double> torsion3;
const SerializationNode& torsion = bond.getChildNode("Torsion1");
}
}
catch (...) {
delete force;
throw;
}
*/
return
force
;
}
plugins/amoeba/serialization/tests/CMakeLists.txt
0 → 100644
View file @
217b45d3
#
# Testing
#
ENABLE_TESTING
()
# Automatically create tests using files named "Test*.cpp"
FILE
(
GLOB TEST_PROGS
"*Test*.cpp"
)
FOREACH
(
TEST_PROG
${
TEST_PROGS
}
)
GET_FILENAME_COMPONENT
(
TEST_ROOT
${
TEST_PROG
}
NAME_WE
)
# All tests use shared libraries
ADD_EXECUTABLE
(
${
TEST_ROOT
}
${
TEST_PROG
}
)
TARGET_LINK_LIBRARIES
(
${
TEST_ROOT
}
${
OPENMM_SERIALIZATION_LIBRARY_NAME
}
${
OPENMM_AMOEBA_SERIALIZATION_LIBRARY_NAME
}
OpenMMAmoeba
)
ADD_TEST
(
${
TEST_ROOT
}
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
)
ENDFOREACH
(
TEST_PROG
${
TEST_PROGS
}
)
plugins/amoeba/serialization/tests/TestSerializeAmoebaHarmonicAngleForce.cpp
0 → 100644
View file @
217b45d3
/* -------------------------------------------------------------------------- *
* OpenMMAmoeba *
* -------------------------------------------------------------------------- *
* 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) 2010 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 "../../../tests/AssertionUtilities.h"
#include "openmm/AmoebaHarmonicAngleForce.h"
#include "openmm/serialization/XmlSerializer.h"
#include <iostream>
#include <sstream>
using
namespace
OpenMM
;
using
namespace
std
;
void
testSerialization
()
{
// Create a Force.
AmoebaHarmonicAngleForce
force
;
force
.
setAmoebaGlobalHarmonicAngleCubic
(
12.3
);
force
.
setAmoebaGlobalHarmonicAngleQuartic
(
98.7
);
force
.
setAmoebaGlobalHarmonicAnglePentic
(
91.7
);
force
.
setAmoebaGlobalHarmonicAngleSextic
(
93.7
);
force
.
addAngle
(
0
,
1
,
3
,
1.0
,
2.0
);
force
.
addAngle
(
0
,
2
,
3
,
2.0
,
2.1
);
force
.
addAngle
(
2
,
3
,
5
,
3.0
,
2.2
);
force
.
addAngle
(
5
,
1
,
8
,
4.0
,
2.3
);
// Serialize and then deserialize it.
stringstream
buffer
;
XmlSerializer
::
serialize
<
AmoebaHarmonicAngleForce
>
(
&
force
,
"Force"
,
buffer
);
AmoebaHarmonicAngleForce
*
copy
=
XmlSerializer
::
deserialize
<
AmoebaHarmonicAngleForce
>
(
buffer
);
// Compare the two forces to see if they are identical.
AmoebaHarmonicAngleForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getAmoebaGlobalHarmonicAngleCubic
(),
force2
.
getAmoebaGlobalHarmonicAngleCubic
());
ASSERT_EQUAL
(
force
.
getAmoebaGlobalHarmonicAngleQuartic
(),
force2
.
getAmoebaGlobalHarmonicAngleQuartic
());
ASSERT_EQUAL
(
force
.
getAmoebaGlobalHarmonicAnglePentic
(),
force2
.
getAmoebaGlobalHarmonicAnglePentic
());
ASSERT_EQUAL
(
force
.
getAmoebaGlobalHarmonicAngleSextic
(),
force2
.
getAmoebaGlobalHarmonicAngleSextic
());
ASSERT_EQUAL
(
force
.
getNumAngles
(),
force2
.
getNumAngles
());
for
(
int
i
=
0
;
i
<
force
.
getNumAngles
();
i
++
)
{
int
a1
,
a2
,
a3
,
b1
,
b2
,
b3
;
double
da
,
db
,
ka
,
kb
;
force
.
getAngleParameters
(
i
,
a1
,
a2
,
a3
,
da
,
ka
);
force2
.
getAngleParameters
(
i
,
b1
,
b2
,
b3
,
db
,
kb
);
ASSERT_EQUAL
(
a1
,
b1
);
ASSERT_EQUAL
(
a2
,
b2
);
ASSERT_EQUAL
(
a3
,
b3
);
ASSERT_EQUAL
(
da
,
db
);
ASSERT_EQUAL
(
ka
,
kb
);
}
}
int
main
()
{
try
{
testSerialization
();
}
catch
(
const
exception
&
e
)
{
cout
<<
"exception: "
<<
e
.
what
()
<<
endl
;
return
1
;
}
cout
<<
"Done"
<<
endl
;
return
0
;
}
plugins/amoeba/serialization/tests/TestSerializeAmoebaHarmonicBondForce.cpp
0 → 100644
View file @
217b45d3
/* -------------------------------------------------------------------------- *
* OpenMMAmoeba *
* -------------------------------------------------------------------------- *
* 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) 2010 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 "../../../tests/AssertionUtilities.h"
#include "openmm/AmoebaHarmonicBondForce.h"
#include "openmm/serialization/XmlSerializer.h"
#include <iostream>
#include <sstream>
using
namespace
OpenMM
;
using
namespace
std
;
void
testSerialization
()
{
// Create a Force.
AmoebaHarmonicBondForce
force
;
force
.
setAmoebaGlobalHarmonicBondCubic
(
12.3
);
force
.
setAmoebaGlobalHarmonicBondQuartic
(
98.7
);
force
.
addBond
(
0
,
1
,
1.0
,
2.0
);
force
.
addBond
(
0
,
2
,
2.0
,
2.1
);
force
.
addBond
(
2
,
3
,
3.0
,
2.2
);
force
.
addBond
(
5
,
1
,
4.0
,
2.3
);
// Serialize and then deserialize it.
stringstream
buffer
;
XmlSerializer
::
serialize
<
AmoebaHarmonicBondForce
>
(
&
force
,
"Force"
,
buffer
);
AmoebaHarmonicBondForce
*
copy
=
XmlSerializer
::
deserialize
<
AmoebaHarmonicBondForce
>
(
buffer
);
// Compare the two forces to see if they are identical.
AmoebaHarmonicBondForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getAmoebaGlobalHarmonicBondCubic
(),
force2
.
getAmoebaGlobalHarmonicBondCubic
());
ASSERT_EQUAL
(
force
.
getAmoebaGlobalHarmonicBondQuartic
(),
force2
.
getAmoebaGlobalHarmonicBondQuartic
());
ASSERT_EQUAL
(
force
.
getNumBonds
(),
force2
.
getNumBonds
());
for
(
int
i
=
0
;
i
<
force
.
getNumBonds
();
i
++
)
{
int
a1
,
a2
,
b1
,
b2
;
double
da
,
db
,
ka
,
kb
;
force
.
getBondParameters
(
i
,
a1
,
a2
,
da
,
ka
);
force2
.
getBondParameters
(
i
,
b1
,
b2
,
db
,
kb
);
ASSERT_EQUAL
(
a1
,
b1
);
ASSERT_EQUAL
(
a2
,
b2
);
ASSERT_EQUAL
(
da
,
db
);
ASSERT_EQUAL
(
ka
,
kb
);
}
}
int
main
()
{
try
{
testSerialization
();
}
catch
(
const
exception
&
e
)
{
cout
<<
"exception: "
<<
e
.
what
()
<<
endl
;
return
1
;
}
cout
<<
"Done"
<<
endl
;
return
0
;
}
plugins/amoeba/serialization/tests/TestSerializeAmoebaHarmonicInPlaneAngleForce.cpp
0 → 100644
View file @
217b45d3
/* -------------------------------------------------------------------------- *
* OpenMMAmoeba *
* -------------------------------------------------------------------------- *
* 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) 2010 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 "../../../tests/AssertionUtilities.h"
#include "openmm/AmoebaHarmonicInPlaneAngleForce.h"
#include "openmm/serialization/XmlSerializer.h"
#include <iostream>
#include <sstream>
using
namespace
OpenMM
;
using
namespace
std
;
void
testSerialization
()
{
// Create a Force.
AmoebaHarmonicInPlaneAngleForce
force
;
force
.
setAmoebaGlobalHarmonicInPlaneAngleCubic
(
12.3
);
force
.
setAmoebaGlobalHarmonicInPlaneAngleQuartic
(
98.7
);
force
.
setAmoebaGlobalHarmonicInPlaneAnglePentic
(
91.7
);
force
.
setAmoebaGlobalHarmonicInPlaneAngleSextic
(
93.7
);
force
.
addAngle
(
0
,
1
,
3
,
4
,
1.0
,
2.0
);
force
.
addAngle
(
0
,
2
,
3
,
5
,
2.0
,
2.1
);
force
.
addAngle
(
2
,
3
,
5
,
6
,
3.0
,
2.2
);
force
.
addAngle
(
5
,
1
,
8
,
8
,
4.0
,
2.3
);
// Serialize and then deserialize it.
stringstream
buffer
;
XmlSerializer
::
serialize
<
AmoebaHarmonicInPlaneAngleForce
>
(
&
force
,
"Force"
,
buffer
);
AmoebaHarmonicInPlaneAngleForce
*
copy
=
XmlSerializer
::
deserialize
<
AmoebaHarmonicInPlaneAngleForce
>
(
buffer
);
// Compare the two forces to see if they are identical.
AmoebaHarmonicInPlaneAngleForce
&
force2
=
*
copy
;
ASSERT_EQUAL
(
force
.
getAmoebaGlobalHarmonicInPlaneAngleCubic
(),
force2
.
getAmoebaGlobalHarmonicInPlaneAngleCubic
());
ASSERT_EQUAL
(
force
.
getAmoebaGlobalHarmonicInPlaneAngleQuartic
(),
force2
.
getAmoebaGlobalHarmonicInPlaneAngleQuartic
());
ASSERT_EQUAL
(
force
.
getAmoebaGlobalHarmonicInPlaneAnglePentic
(),
force2
.
getAmoebaGlobalHarmonicInPlaneAnglePentic
());
ASSERT_EQUAL
(
force
.
getAmoebaGlobalHarmonicInPlaneAngleSextic
(),
force2
.
getAmoebaGlobalHarmonicInPlaneAngleSextic
());
ASSERT_EQUAL
(
force
.
getNumAngles
(),
force2
.
getNumAngles
());
for
(
int
i
=
0
;
i
<
force
.
getNumAngles
();
i
++
)
{
int
a1
,
a2
,
a3
,
a4
,
b1
,
b2
,
b3
,
b4
;
double
da
,
db
,
ka
,
kb
;
force
.
getAngleParameters
(
i
,
a1
,
a2
,
a3
,
a4
,
da
,
ka
);
force2
.
getAngleParameters
(
i
,
b1
,
b2
,
b3
,
b4
,
db
,
kb
);
ASSERT_EQUAL
(
a1
,
b1
);
ASSERT_EQUAL
(
a2
,
b2
);
ASSERT_EQUAL
(
a3
,
b3
);
ASSERT_EQUAL
(
a4
,
b4
);
ASSERT_EQUAL
(
da
,
db
);
ASSERT_EQUAL
(
ka
,
kb
);
}
}
int
main
()
{
try
{
testSerialization
();
}
catch
(
const
exception
&
e
)
{
cout
<<
"exception: "
<<
e
.
what
()
<<
endl
;
return
1
;
}
cout
<<
"Done"
<<
endl
;
return
0
;
}
Prev
1
2
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