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
598e076c
Commit
598e076c
authored
Apr 17, 2008
by
Peter Eastman
Browse files
Moving the reference code into the platforms folder
parent
76e2849c
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
11674 additions
and
0 deletions
+11674
-0
platforms/reference/src/SimTKUtilities/Makefile
platforms/reference/src/SimTKUtilities/Makefile
+22
-0
platforms/reference/src/SimTKUtilities/NewOverrideSimTk.cpp
platforms/reference/src/SimTKUtilities/NewOverrideSimTk.cpp
+69
-0
platforms/reference/src/SimTKUtilities/RealTypeSimTk.h
platforms/reference/src/SimTKUtilities/RealTypeSimTk.h
+82
-0
platforms/reference/src/SimTKUtilities/SimTKOpenMMCommon.cpp
platforms/reference/src/SimTKUtilities/SimTKOpenMMCommon.cpp
+50
-0
platforms/reference/src/SimTKUtilities/SimTKOpenMMCommon.h
platforms/reference/src/SimTKUtilities/SimTKOpenMMCommon.h
+200
-0
platforms/reference/src/SimTKUtilities/SimTKOpenMMGpuUtilities.cpp
.../reference/src/SimTKUtilities/SimTKOpenMMGpuUtilities.cpp
+528
-0
platforms/reference/src/SimTKUtilities/SimTKOpenMMGpuUtilities.h
...ms/reference/src/SimTKUtilities/SimTKOpenMMGpuUtilities.h
+253
-0
platforms/reference/src/SimTKUtilities/SimTKOpenMMGromacsUtilities.cpp
...erence/src/SimTKUtilities/SimTKOpenMMGromacsUtilities.cpp
+3194
-0
platforms/reference/src/SimTKUtilities/SimTKOpenMMGromacsUtilities.h
...eference/src/SimTKUtilities/SimTKOpenMMGromacsUtilities.h
+480
-0
platforms/reference/src/SimTKUtilities/SimTKOpenMMLog.cpp
platforms/reference/src/SimTKUtilities/SimTKOpenMMLog.cpp
+322
-0
platforms/reference/src/SimTKUtilities/SimTKOpenMMLog.h
platforms/reference/src/SimTKUtilities/SimTKOpenMMLog.h
+196
-0
platforms/reference/src/SimTKUtilities/SimTKOpenMMRealType.h
platforms/reference/src/SimTKUtilities/SimTKOpenMMRealType.h
+147
-0
platforms/reference/src/SimTKUtilities/SimTKOpenMMUtilities.cpp
...rms/reference/src/SimTKUtilities/SimTKOpenMMUtilities.cpp
+1416
-0
platforms/reference/src/SimTKUtilities/SimTKOpenMMUtilities.h
...forms/reference/src/SimTKUtilities/SimTKOpenMMUtilities.h
+583
-0
platforms/reference/src/SimTKUtilities/SimTKOpenMMWindowLinux.h
...rms/reference/src/SimTKUtilities/SimTKOpenMMWindowLinux.h
+36
-0
platforms/reference/src/SimTKUtilities/SimTKlapack.h
platforms/reference/src/SimTKUtilities/SimTKlapack.h
+3006
-0
platforms/reference/src/SimTKUtilities/SimTk-old-2005.sln
platforms/reference/src/SimTKUtilities/SimTk-old-2005.sln
+20
-0
platforms/reference/src/SimTKUtilities/SimTk-old-2005.vcproj
platforms/reference/src/SimTKUtilities/SimTk-old-2005.vcproj
+436
-0
platforms/reference/src/SimTKUtilities/SimTk.vcproj
platforms/reference/src/SimTKUtilities/SimTk.vcproj
+432
-0
platforms/reference/src/SimTKUtilities/TwoDimArraySimTk.h
platforms/reference/src/SimTKUtilities/TwoDimArraySimTk.h
+202
-0
No files found.
platforms/reference/src/SimTKUtilities/Makefile
0 → 100644
View file @
598e076c
# ---------------------------------------------------------------------------------------
include
../makeConfig/Top.mk
# ---------------------------------------------------------------------------------------
# target is gmxGbsa library
# ld reference is in ../gromacs/vc7.mk
# include file reference is in ../gromacs/gmxgpu.h
STATIC_LIBRARY
:=
gmxUtilities
# ---------------------------------------------------------------------------------------
BaseFiles
:=
$(SimTkBaseFiles)
IncludeDirectories
:=
$(SimTkDirectory)
$(GromacsIncludeDirectory)
# ---------------------------------------------------------------------------------------
include
$(MakeDirectory)/BaseMake.mk
# ---------------------------------------------------------------------------------------
platforms/reference/src/SimTKUtilities/NewOverrideSimTk.cpp
0 → 100644
View file @
598e076c
/* Portions copyright (c) 2006 Stanford University and Simbios.
* Contributors: Pande Group
*
* 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 <new>
#include <stdio.h>
// Replacement new/delete w/ Gromac's smalloc() and sfree()
extern
"C"
{
#include "smalloc.h"
}
/* ---------------------------------------------------------------------------------------
Override C++ new w/ Gromac's smalloc/sfree (Simbios)
@param size bytes to allocate
@return ptr to allocated memory
--------------------------------------------------------------------------------------- */
void
*
operator
new
(
size_t
size
){
void
*
ptr
;
smalloc
(
ptr
,
(
int
)
size
);
// (void) fprintf( stdout, "\nGlobal override new called -- size=%u", size );
// (void) fflush( stdout );
return
ptr
;
}
/* ---------------------------------------------------------------------------------------
Override C++ delete w/ Gromac's sfree (Simbios)
@param ptr ptr to block to free
--------------------------------------------------------------------------------------- */
void
operator
delete
(
void
*
ptr
){
// (void) fprintf( stdout, "\nGlobal override delete called." );
// (void) fflush( stdout );
sfree
(
ptr
);
}
platforms/reference/src/SimTKUtilities/RealTypeSimTk.h
0 → 100755
View file @
598e076c
/* Portions copyright (c) 2006 Stanford University and Simbios.
* Contributors: Pande Group
*
* 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.
*/
#ifndef __RealSimTk_H_
#define __RealSimTk_H__
#ifndef RealType
#define RealType 1
#endif
#if RealType == 1
#define Real float
#define SQRT sqrtf
#define POW powf
#define SIN sinf
#define COS cosf
#define TAN tanf
// LOG is used in Vishal's gpu code; modifying LOG -> LN
#define LN logf
#define EXP expf
#define FABS fabsf
#define ACOS acosf
#define ASIN asinf
#define ATAN atanf
#else
#define Real double
#define SQRT sqrt
#define POW pow
#define SIN sin
#define COS cos
#define TAN tan
// LOG is used in Vishal's gpu code; modifying LOG -> LN
#define LN log
#define EXP exp
#define FABS fabs
#define ACOS acos
#define ASIN asin
#define ATAN atan
#endif
#define DOT3(u,v) ((u[0])*(v[0]) + (u[1])*(v[1]) + (u[2])*(v[2]))
#define MATRIXDOT3(u,v) u[0]*v[0] + u[1]*v[1] + u[2]*v[2] + \
u[3]*v[3] + u[4]*v[4] + u[5]*v[5] + \
u[6]*v[6] + u[7]*v[7] + u[8]*v[8]
#define PI 3.141592653589f
#define TWO_SIX 1.122462048309372981f
#define RADIAN 57.29577951308f
#define RADIAN_TO_DEGREE 57.29577951308f
#define LOG_TEN 2.302585092994045684f
#define SQRT_TWO 1.41421356237309504f
#define RADIAN_INVERSE 0.01745329252f
#define DEGREE_TO_RADIAN 0.01745329252f
#endif // __RealSimTk_H__
platforms/reference/src/SimTKUtilities/SimTKOpenMMCommon.cpp
0 → 100644
View file @
598e076c
/* Portions copyright (c) 2006 Stanford University and Simbios.
* Contributors: Pande Group
*
* 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 "SimTKOpenMMCommon.h"
// static settings
// initialization of static data members
const
std
::
string
SimTKOpenMMCommon
::
NotSet
=
std
::
string
(
"NotSet"
);
const
std
::
string
SimTKOpenMMCommon
::
Comment
=
std
::
string
(
"#"
);
const
std
::
string
SimTKOpenMMCommon
::
Tab
=
std
::
string
(
"
\t
"
);
const
int
SimTKOpenMMCommon
::
DefaultReturn
=
0
;
const
int
SimTKOpenMMCommon
::
ErrorReturn
=
-
1
;
const
RealOpenMM
SimTKOpenMMCommon
::
BigCutoffValue
=
1.0e+05
;
// units
const
int
SimTKOpenMMCommon
::
MdUnits
=
1
;
const
int
SimTKOpenMMCommon
::
KcalAngUnits
=
2
;
// specify RealOpenMM number format
const
int
SimTKOpenMMCommon
::
HighStringStreamNumberWidth
=
20
;
const
int
SimTKOpenMMCommon
::
HighStringStreamNumberPrecision
=
12
;
const
RealOpenMM
SimTKOpenMMCommon
::
DegreeToRadians
=
(
RealOpenMM
)
0.017453292
;
platforms/reference/src/SimTKUtilities/SimTKOpenMMCommon.h
0 → 100644
View file @
598e076c
/* Portions copyright (c) 2006 Stanford University and Simbios.
* Contributors: Pande Group
*
* 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.
*/
#ifndef __SimTKOpenMMCommon_H__
#define __SimTKOpenMMCommon_H__
// include file containing entries commonly used
// STL includes
#include <vector>
#include <map>
#include <set>
#include <string>
// generic c includes
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <assert.h>
// ---------------------------------------------------------------------------------------
#include "SimTKOpenMMRealType.h"
#include "SimTKOpenMMWindowLinux.h"
// ---------------------------------------------------------------------------------------
typedef
std
::
vector
<
int
>
IntVector
;
typedef
IntVector
::
iterator
IntVectorI
;
typedef
IntVector
::
const_iterator
IntVectorCI
;
typedef
IntVector
::
reverse_iterator
IntVectorRI
;
typedef
IntVector
::
const_reverse_iterator
IntVectorCRI
;
typedef
std
::
map
<
int
,
int
>
IntIntMap
;
typedef
IntIntMap
::
iterator
IntIntMapI
;
typedef
IntIntMap
::
const_iterator
IntIntMapCI
;
typedef
std
::
set
<
int
>
IntSet
;
typedef
IntSet
::
iterator
IntSetI
;
typedef
IntSet
::
const_iterator
IntSetCI
;
typedef
std
::
vector
<
IntSet
>
IntSetVector
;
typedef
IntSetVector
::
iterator
IntSetVectorI
;
typedef
IntSetVector
::
const_iterator
IntSetVectorCI
;
typedef
std
::
multiset
<
int
>
IntMultiSet
;
typedef
IntMultiSet
::
iterator
IntMultiSetI
;
typedef
IntMultiSet
::
const_iterator
IntMultiSetCI
;
typedef
std
::
vector
<
std
::
string
>
StringVector
;
typedef
StringVector
::
iterator
StringVectorI
;
typedef
StringVector
::
const_iterator
StringVectorCI
;
typedef
std
::
map
<
std
::
string
,
std
::
string
>
StringStringMap
;
typedef
StringStringMap
::
iterator
StringStringMapI
;
typedef
StringStringMap
::
const_iterator
StringStringMapCI
;
typedef
std
::
vector
<
RealOpenMM
>
RealOpenMMVector
;
typedef
RealOpenMMVector
::
iterator
RealOpenMMVectorI
;
typedef
RealOpenMMVector
::
const_iterator
RealOpenMMVectorCI
;
typedef
std
::
vector
<
RealOpenMM
*>
RealOpenMMPtrVector
;
typedef
RealOpenMMPtrVector
::
iterator
RealOpenMMPtrVectorI
;
typedef
RealOpenMMPtrVector
::
const_iterator
RealOpenMMPtrVectorCI
;
typedef
std
::
vector
<
RealOpenMM
**>
RealOpenMMPtrPtrVector
;
typedef
RealOpenMMPtrPtrVector
::
iterator
RealOpenMMPtrPtrVectorI
;
typedef
RealOpenMMPtrPtrVector
::
const_iterator
RealOpenMMPtrPtrVectorCI
;
typedef
std
::
map
<
std
::
string
,
RealOpenMM
>
StringRealOpenMMMap
;
typedef
StringRealOpenMMMap
::
iterator
StringRealOpenMMMapI
;
typedef
StringRealOpenMMMap
::
const_iterator
StringRealOpenMMMapCI
;
typedef
std
::
map
<
std
::
string
,
int
>
StringIntMap
;
typedef
StringIntMap
::
iterator
StringIntMapI
;
typedef
StringIntMap
::
const_iterator
StringIntMapCI
;
// ---------------------------------------------------------------------------------------
class
SimTKOpenMMCommon
{
public:
static
const
std
::
string
NotSet
;
static
const
RealOpenMM
BigCutoffValue
;
static
const
std
::
string
Comment
;
static
const
std
::
string
Tab
;
static
const
std
::
string
YesU
;
static
const
std
::
string
YesUl
;
static
const
std
::
string
YesL
;
// subroutine returns
static
const
int
DefaultReturn
;
static
const
int
ErrorReturn
;
// units
static
const
int
MdUnits
;
static
const
int
KcalAngUnits
;
// specify RealOpenMM number format
static
const
int
HighStringStreamNumberWidth
;
static
const
int
HighStringStreamNumberPrecision
;
static
const
RealOpenMM
DegreeToRadians
;
/**---------------------------------------------------------------------------------------
Get string w/ minimum desired width
@param inputString input string
@param desiredSize minimum desired size of output string
@param spacer string to append to inputString to get desired width (" ")
@return DefaultReturn
--------------------------------------------------------------------------------------- */
static
std
::
string
getSpacedString
(
const
std
::
string
&
,
int
desiredSize
=
25
,
const
std
::
string
&
spacer
=
" "
);
};
// ---------------------------------------------------------------------------------------
// StringComparisonForMap: used to compare strings in STL maps w/ strings as keys
#ifndef StringComparisonForMapPtrBlcok
#define StringComparisonForMapPtrBlcok
// above define should be removed once CommonTk is removed
class
StringComparisonForMapPtr
:
public
std
::
binary_function
<
std
::
string
*
,
std
::
string
*
,
bool
>
{
public:
bool
operator
()(
const
std
::
string
*
str1
,
const
std
::
string
*
str2
)
const
{
return
strcmp
(
str1
->
c_str
(),
str2
->
c_str
()
)
<
0
;
}
};
class
StringComparisonForMap
:
public
std
::
binary_function
<
const
std
::
string
&
,
const
std
::
string
&
,
bool
>
{
public:
bool
operator
()(
const
std
::
string
&
str1
,
const
std
::
string
&
str2
)
const
{
return
strcmp
(
str1
.
c_str
(),
str2
.
c_str
()
)
<
0
;
}
};
#endif
// ---------------------------------------------------------------------------------------
// Used to compare integers for sorting, ...
int
numericCompareI
(
const
void
*
point1
,
const
void
*
point2
);
// ---------------------------------------------------------------------------------------
// string-string map and iterator definitions
typedef
std
::
map
<
std
::
string
,
std
::
string
,
StringComparisonForMap
>
StringMap
;
typedef
StringMap
::
iterator
StringMapI
;
typedef
StringMap
::
const_iterator
StringMapCI
;
// string set and iterator definitions
typedef
std
::
set
<
std
::
string
,
StringComparisonForMap
>
StringSet
;
typedef
StringSet
::
iterator
StringSetI
;
typedef
StringSet
::
const_iterator
StringSetCI
;
// ---------------------------------------------------------------------------------------
#endif // __SimTKOpenMMCommon_H__
platforms/reference/src/SimTKUtilities/SimTKOpenMMGpuUtilities.cpp
0 → 100644
View file @
598e076c
/* Portions copyright (c) 2006 Stanford University and Simbios.
* Contributors: Pande Group
*
* 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.
*/
// class of shared, static utility methods
#include "SimTKOpenMMGpuUtilities.h"
#include "SimTKOpenMMUtilities.h"
// fabs(), ...
#include <math.h>
#define UseGromacsMalloc 1
#ifdef UseGromacsMalloc
extern
"C"
{
#include "smalloc.h"
}
#endif
/* ---------------------------------------------------------------------------------------
Helper method to repack RealOpenMM arrays (Simbios)
@param numberOfEntries entries/sub-array
@param subarraySize number of subarrays
@param array array
Input: array = [subArray_1 subArray_2 subArray_3 ... subArray_Stacked]
where each subArray_i is 1 x numberOfEntries
Output: array = [ subArray_1_1 subArray_2_1 subArray_3_1 ... subArray_Stacked_1
subArray_1_2 subArray_2_2 subArray_3_2 ... subArray_Stacked_2
subArray_1_3 subArray_2_3 subArray_3_3 ... subArray_Stacked_3
...
subArray_1_N subArray_2_N subArray_3_N ... subArray_Stacked_N ]
where N = numberOfEntries
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGpuUtilities
::
repackArray1
(
int
numberOfEntries
,
int
subarraySize
,
RealOpenMM
*
array
){
// ---------------------------------------------------------------------------------------
RealOpenMM
*
tempArray
;
// static const char* methodName = "\nSimTKOpenMMGpuUtilities::rePackArray";
// ---------------------------------------------------------------------------------------
unsigned
int
sizeOfArray
=
sizeof
(
RealOpenMM
)
*
numberOfEntries
*
subarraySize
;
tempArray
=
(
RealOpenMM
*
)
SimTKOpenMMUtilities
::
Xmalloc
(
"tempArray"
,
__FILE__
,
__LINE__
,
sizeOfArray
);
memcpy
(
tempArray
,
array
,
sizeOfArray
);
int
arrayIndex
=
0
;
for
(
int
jj
=
0
;
jj
<
subarraySize
;
jj
++
){
for
(
int
ii
=
0
;
ii
<
numberOfEntries
;
ii
++
){
array
[
arrayIndex
++
]
=
tempArray
[
jj
*
numberOfEntries
+
ii
];
}
}
SimTKOpenMMUtilities
::
Xfree
(
"tempArray"
,
__FILE__
,
__LINE__
,
tempArray
);
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/* ---------------------------------------------------------------------------------------
Copy an array into a packed (e.g., RealOpenMM4 array) (Simbios)
Example: copy Born radii into last slot of force array \n
@param numberOfEntries entries/sub-array (no. atoms)
@param subarraySize number of subarrays (4 for RealOpenMM4)
@param fullArray full array (force array in example)
@param copySlot index of slot to copied into (3 in example, since want Born radius in .w slot)
@param arrayToCopy array to copy (Born array)
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGpuUtilities
::
copySubArray
(
int
numberOfEntries
,
int
subarraySize
,
RealOpenMM
*
fullArray
,
int
copySlot
,
RealOpenMM
*
arrayToCopy
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMGpuUtilities::copySubArray";
// ---------------------------------------------------------------------------------------
int
arrayIndex
=
copySlot
;
for
(
int
ii
=
0
;
ii
<
numberOfEntries
;
ii
++
){
fullArray
[
arrayIndex
]
=
arrayToCopy
[
ii
];
arrayIndex
+=
subarraySize
;
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/* ---------------------------------------------------------------------------------------
Helper method to repack RealOpenMM arrays (Simbios)
@param numberOfEntries entries/sub-array
@param subarraySize number of subarrays
@param array array
Input: array = [subArray_1 subArray_2 subArray_3 ... subArray_N] \n
where each subArray_i is vector of length M=numberOfEntries \n
Output: array = [ subArray_1_1 subArray_2_1 subArray_3_1 ... subArray_N_1 \n
subArray_1_2 subArray_2_2 subArray_3_2 ... subArray_N_2 \n
subArray_1_3 subArray_2_3 subArray_3_3 ... subArray_N_3 \n
... \n
subArray_1_M subArray_2_M subArray_3_M ... subArray_M ] \n
where N = numberOfEntries \n
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGpuUtilities
::
repackArray
(
int
numberOfEntries
,
int
subarraySize
,
RealOpenMM
*
array
){
// ---------------------------------------------------------------------------------------
RealOpenMM
*
tempArray
;
// static const char* methodName = "\nSimTKOpenMMGpuUtilities::rePackArray";
// ---------------------------------------------------------------------------------------
unsigned
int
sizeOfArray
=
sizeof
(
RealOpenMM
)
*
numberOfEntries
*
subarraySize
;
tempArray
=
(
RealOpenMM
*
)
SimTKOpenMMUtilities
::
Xmalloc
(
"tempArray"
,
__FILE__
,
__LINE__
,
sizeOfArray
);
memcpy
(
tempArray
,
array
,
sizeOfArray
);
int
arrayIndex
=
0
;
for
(
int
ii
=
0
;
ii
<
numberOfEntries
;
ii
++
){
for
(
int
jj
=
0
;
jj
<
subarraySize
;
jj
++
){
array
[
arrayIndex
++
]
=
tempArray
[
jj
*
numberOfEntries
+
ii
];
}
}
SimTKOpenMMUtilities
::
Xfree
(
"tempArray"
,
__FILE__
,
__LINE__
,
tempArray
);
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/* ---------------------------------------------------------------------------------------
Helper method to repack RealOpenMM arrays (Simbios)
@param numberOfEntries entries/sub-array
@param subarraySize number of subarrays
@param array repacked output array
@param inputArrays inputArrays[subarraySize][numberOfEntries]
Output: array = [ inputArrays[0][0] inputArrays[1][0] inputArrays[2][0] inputArrays[3][0] \n
inputArrays[0][1] inputArrays[1][1] inputArrays[2][1] inputArrays[3][1] \n
inputArrays[0][2] inputArrays[1][2] inputArrays[2][2] inputArrays[3][2] \n
... \n
inputArrays[0][numberOfEntries] ... inputArrays[subarraySize-1][numberOfEntries] \n
] \n
where N = numberOfEntries \n
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGpuUtilities
::
repackArrayOfArrays
(
int
numberOfEntries
,
int
subarraySize
,
RealOpenMM
*
array
,
RealOpenMM
**
inputArrays
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMGpuUtilities::repackArrayOfArrays";
// ---------------------------------------------------------------------------------------
unsigned
int
sizeOfBlock
=
sizeof
(
RealOpenMM
)
*
numberOfEntries
;
RealOpenMM
*
RealOpenMMPtr
=
array
;
for
(
int
ii
=
0
;
ii
<
subarraySize
;
ii
++
){
memcpy
(
RealOpenMMPtr
,
inputArrays
[
ii
],
sizeOfBlock
);
RealOpenMMPtr
+=
numberOfEntries
;
}
return
repackArray
(
numberOfEntries
,
subarraySize
,
array
);
}
/* ---------------------------------------------------------------------------------------
Collapse 2D array into packed single array (Simbios)
Example: forces[3][N] -> array of size N containing RealOpenMM3 values
@param numberOfEntries entries (no. atoms)
@param iUnroll iUnroll
@param jUnroll jUnroll
@param arrays arrays to be merged (dimension is [iUnroll][numberOfEntries/iUnroll]
@param mergeArray output array (if null, then allocated)
@param log logging file descriptor
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
RealOpenMM
*
SimTKOpenMMGpuUtilities
::
collapseArrays
(
int
numberOfEntries
,
int
iUnroll
,
int
jUnroll
,
RealOpenMM
**
arrays
,
RealOpenMM
*
mergeArray
,
FILE
*
log
){
// ---------------------------------------------------------------------------------------
static
const
char
*
methodName
=
"
\n
SimTKOpenMMGpuUtilities::collapseArrays"
;
static
bool
printOn
=
false
;
// ---------------------------------------------------------------------------------------
printOn
=
printOn
&&
log
!=
NULL
;
if
(
mergeArray
==
NULL
){
unsigned
int
sizeOfArray
=
sizeof
(
RealOpenMM
)
*
numberOfEntries
*
jUnroll
;
mergeArray
=
(
RealOpenMM
*
)
SimTKOpenMMUtilities
::
Xmalloc
(
"mergeArray"
,
__FILE__
,
__LINE__
,
sizeOfArray
);
}
int
arrayIndex
=
0
;
int
arrayOffset
=
0
;
if
(
printOn
){
(
void
)
fprintf
(
log
,
"
\n
%s %d %d %d"
,
methodName
,
numberOfEntries
,
iUnroll
,
jUnroll
);
}
for
(
int
ii
=
0
;
ii
<
numberOfEntries
/
iUnroll
;
ii
++
){
for
(
int
kk
=
0
;
kk
<
iUnroll
;
kk
++
){
for
(
int
jj
=
0
;
jj
<
jUnroll
;
jj
++
){
mergeArray
[
arrayIndex
++
]
=
arrays
[
kk
][
arrayOffset
+
jj
];
}
if
(
printOn
){
(
void
)
fprintf
(
log
,
"
\n
%d %d [%.4f %.4f %.4f %.4f]"
,
ii
,
kk
,
arrays
[
kk
][
arrayOffset
+
0
],
arrays
[
kk
][
arrayOffset
+
1
],
arrays
[
kk
][
arrayOffset
+
2
],
arrays
[
kk
][
arrayOffset
+
3
]
);
}
}
arrayOffset
+=
jUnroll
;
}
return
mergeArray
;
}
/* ---------------------------------------------------------------------------------------
Merge 2 arrays based on sentinel value (Simbios)
Overflow array, if present, signals which entries had nonsentinel in both arrays
Example \n
array1 = { 1, 2, 3, s, s, s, 4, 5, s } \n
array2 = { s, s, 6, 8, 9, 3, s, 7, s } \n
merge array = { 1, 2, 3, 8, 9, 3, 4, 5, s } \n
overflow array = { s, s, 6, s, s, s, s, 7, s } \n
@param numberOfEntries entries (no. atoms)
@param sentinelValue sentinel value
@param array1 first array
@param array2 second array
@param mergeArray output merge array
@param overflowArray output overflow array (if null, then ignored)
@param log logging file descriptor
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGpuUtilities
::
mergeArraysBasedSentinelValue
(
int
numberOfEntries
,
RealOpenMM
sentinelValue
,
RealOpenMM
*
array1
,
RealOpenMM
*
array2
,
RealOpenMM
*
mergeArray
,
RealOpenMM
*
overflowArray
,
FILE
*
log
){
// ---------------------------------------------------------------------------------------
int
hits
[
3
];
RealOpenMM
*
arrays
[
4
];
const
RealOpenMM
tolerance
=
(
RealOpenMM
)
0.00001
;
// static const char* methodName = "\nSimTKOpenMMGpuUtilities::sentinelArraysBasedInitializedValue";
// ---------------------------------------------------------------------------------------
arrays
[
0
]
=
array1
;
arrays
[
1
]
=
array2
;
arrays
[
2
]
=
mergeArray
;
arrays
[
3
]
=
overflowArray
;
for
(
int
ii
=
0
;
ii
<
numberOfEntries
;
ii
++
){
RealOpenMM
value
;
RealOpenMM
overflowValue
=
sentinelValue
;
for
(
int
jj
=
0
;
jj
<
2
;
jj
++
){
hits
[
jj
]
=
fabs
(
arrays
[
jj
][
ii
]
-
sentinelValue
)
<
tolerance
?
1
:
0
;
}
// both missing
if
(
hits
[
0
]
&&
hits
[
1
]
){
value
=
sentinelValue
;
// single hit
}
else
if
(
!
hits
[
0
]
&&
hits
[
1
]
){
value
=
arrays
[
0
][
ii
];
}
else
if
(
hits
[
0
]
&&
!
hits
[
1
]
){
value
=
arrays
[
1
][
ii
];
}
else
{
// both present -- add to overflow array if available
value
=
arrays
[
0
][
ii
];
overflowValue
=
arrays
[
1
][
ii
];
}
arrays
[
2
][
ii
]
=
value
;
if
(
arrays
[
3
]
!=
NULL
){
arrays
[
3
][
ii
]
=
overflowValue
;
}
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/* ---------------------------------------------------------------------------------------
Helper method to store values from CPU loop in position seen in GPU output (Simbios)
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGpuUtilities
::
storeInGpuFormat
(
int
atomI
,
int
atomJ
,
int
debugAtomJ
,
int
jUnroll
,
int
numberOfStreams
,
RealOpenMM
**
debugStreams
,
RealOpenMM
*
RealOpenMMValues
[
2
],
RealOpenMM
unsetDebugValue
,
bool
useUpper
,
FILE
*
log
){
// ---------------------------------------------------------------------------------------
int
diffIndices
[
2
][
2
];
// static const char* methodName = "\nSimTKOpenMMGpuUtilities::storeInGpuFormat";
// ---------------------------------------------------------------------------------------
diffIndices
[
0
][
0
]
=
atomI
-
debugAtomJ
;
diffIndices
[
0
][
1
]
=
atomJ
;
diffIndices
[
1
][
0
]
=
atomJ
-
debugAtomJ
;
diffIndices
[
1
][
1
]
=
atomI
;
for
(
int
ii
=
0
;
ii
<
2
;
ii
++
){
if
(
diffIndices
[
ii
][
0
]
>=
0
&&
diffIndices
[
ii
][
0
]
<
jUnroll
){
for
(
int
jj
=
0
;
jj
<
numberOfStreams
;
jj
++
){
RealOpenMM
*
RealOpenMMPtr
=
&
(
debugStreams
[
jj
][
jUnroll
*
diffIndices
[
ii
][
1
]]);
RealOpenMMPtr
+=
diffIndices
[
ii
][
0
];
/*
if( log && atomI < 10 && atomJ < 10 ){
(void) fprintf( log, "%s i=%d j=%d dbg=%d dff=%d crnt=%.4f new=%.4f ii=%d jj=%d", methodName,
atomI, atomJ, debugAtomJ, diffIndices[ii][0], *RealOpenMMPtr,
RealOpenMMValues[jj][diffIndices[ii][0]], ii, jj );
}
*/
/*
if( fabs( *RealOpenMMPtr - unsetDebugValue ) < 1.0e-04 ||
(atomI > atomJ && useUpper) ){
*RealOpenMMPtr = RealOpenMMValues[jj][diffIndices[ii][0]];
}
*/
*
RealOpenMMPtr
=
RealOpenMMValues
[
jj
][
diffIndices
[
ii
][
0
]];
}
}
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/* ---------------------------------------------------------------------------------------
Helper method to compare cpu and gpu computed arrays
@param numberOfAtoms entries (no. atoms)
@param chunkSize chunk size (usually 3 or 4)
@param cpuArray cpuArray[0-(chunkSize-1)][0,entries-1]
@param gpuArray gpuArray[chunkSize*entries]
@param tolerance check if relative difference is greater \n
than this tolerance
@param compareColumn array of size [chunkSize] signalling whether \n
column i is to be compared; it may be NULL
@param absoluteMin error if abs(cpu) + abs(gpu) > absoluteMin \n
set negative to ignore this condition
@param printOn if not set, then no printing
@param header id header -- optional
@param log logging file descriptor
@return number of failed entries
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGpuUtilities
::
compareCpuGpuArrays
(
int
numberOfAtoms
,
int
chunkSize
,
RealOpenMM
**
cpuArray
,
RealOpenMM
*
gpuArray
,
RealOpenMM
tolerance
,
int
*
compareColumn
,
RealOpenMM
absoluteMin
,
int
printOn
,
const
char
*
header
,
FILE
*
log
){
// ---------------------------------------------------------------------------------------
char
failedString
[
20
];
// static const char* methodName = "\nSimTKOpenMMGpuUtilities::compareCpuGpuArrays";
// ---------------------------------------------------------------------------------------
printOn
=
printOn
&&
log
!=
NULL
;
// print header
failedString
[
chunkSize
]
=
'\0'
;
if
(
printOn
){
(
void
)
fprintf
(
log
,
"
\n
"
);
if
(
header
){
(
void
)
fprintf
(
log
,
"%s"
,
header
);
}
(
void
)
fprintf
(
log
,
" atoms=%d tol=%.3e absCutoff=%.3e printOn=%d"
,
numberOfAtoms
,
tolerance
,
absoluteMin
,
printOn
);
}
// look for differences and print if flags set appropriately
int
returnFailed
=
0
;
int
offset
=
0
;
int
printedOnce
=
0
;
for
(
int
ii
=
0
;
ii
<
numberOfAtoms
;
ii
++
){
int
localFailed
=
0
;
for
(
int
jj
=
0
;
jj
<
chunkSize
;
jj
++
){
if
(
compareColumn
==
NULL
||
compareColumn
[
jj
]
){
RealOpenMM
f1
=
fabs
(
cpuArray
[
jj
][
ii
]
)
+
fabs
(
gpuArray
[
offset
+
jj
]
);
if
(
f1
>
0.0
f
){
RealOpenMM
diff
=
fabs
(
(
cpuArray
[
jj
][
ii
]
-
gpuArray
[
offset
+
jj
])
)
/
f1
;
if
(
diff
>
tolerance
&&
f1
>
absoluteMin
){
localFailed
=
1
;
returnFailed
+=
1
;
failedString
[
jj
]
=
'X'
;
}
else
{
failedString
[
jj
]
=
' '
;
}
}
}
else
{
failedString
[
jj
]
=
' '
;
}
}
// print
if
(
log
&&
(
printOn
||
localFailed
)
){
const
char
*
numberFormat
=
"%9.4f "
;
if
(
!
printedOnce
){
(
void
)
fprintf
(
log
,
"
\n
CpuF GpuF"
);
printedOnce
=
1
;
}
(
void
)
fprintf
(
log
,
"
\n
%d ["
,
ii
);
for
(
int
jj
=
0
;
jj
<
chunkSize
;
jj
++
){
if
(
compareColumn
==
NULL
||
compareColumn
[
jj
]
){
(
void
)
fprintf
(
log
,
numberFormat
,
cpuArray
[
jj
][
ii
]
);
}
}
(
void
)
fprintf
(
log
,
"] ["
);
for
(
int
jj
=
0
;
jj
<
chunkSize
;
jj
++
){
if
(
compareColumn
==
NULL
||
compareColumn
[
jj
]
){
(
void
)
fprintf
(
log
,
numberFormat
,
gpuArray
[
offset
+
jj
]
);
}
}
(
void
)
fprintf
(
log
,
"] [%s]"
,
failedString
);
}
offset
+=
chunkSize
;
}
// flush buffer
if
(
log
){
(
void
)
fflush
(
log
);
}
return
returnFailed
;
}
platforms/reference/src/SimTKUtilities/SimTKOpenMMGpuUtilities.h
0 → 100755
View file @
598e076c
/* Portions copyright (c) 2006 Stanford University and Simbios.
* Contributors: Pande Group
*
* 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.
*/
#ifndef __SimTKOpenMMGpuUtilities_H_
#define __SimTKOpenMMGpuUtilities_H_
// ---------------------------------------------------------------------------------------
// reserve the option to change between Real and double
#include "SimTKOpenMMRealType.h"
#include "SimTKOpenMMCommon.h"
// ---------------------------------------------------------------------------------------
// class of shared, static utility methods
#include <stdio.h>
#include <string.h>
#include <string>
#include <stdlib.h>
#include <sstream>
// #include <string>
// ---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Class of static methods to be shared
Most methods are standalone 'utility' methods
--------------------------------------------------------------------------------------- */
class
SimTKOpenMMGpuUtilities
{
public:
// dummy constructor/destructor
SimTKOpenMMGpuUtilities
(){};
~
SimTKOpenMMGpuUtilities
(){};
/**---------------------------------------------------------------------------------------
Helper method to repack RealOpenMM arrays (Simbios)
@param numberOfEntries entries/sub-array
@param subarraySize number of subarrays
@param array array
Input array = [subArray_1 subArray_2 subArray_3 ... subArray_Stacked] \n
where each subArray_i is 1 x numberOfEntries
Output array = [ subArray_1_1 subArray_2_1 subArray_3_1 ... subArray_Stacked_1 \n
subArray_1_2 subArray_2_2 subArray_3_2 ... subArray_Stacked_2 \n
subArray_1_3 subArray_2_3 subArray_3_3 ... subArray_Stacked_3 \n
... \n
subArray_1_N subArray_2_N subArray_3_N ... subArray_Stacked_N ] \n
where N = numberOfEntries
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
repackArray1
(
int
numberOfEntries
,
int
subarraySize
,
RealOpenMM
*
array
);
/**---------------------------------------------------------------------------------------
Copy an array into a packed (e.g., RealOpenMM4 array) (Simbios)
Example copy Born radii into last slot of force array
@param numberOfEntries entries/sub-array (no. atoms)
@param subarraySize number of subarrays (4 for RealOpenMM4)
@param fullArray full array (force array in example)
@param copySlot index of slot to copied into (3 in example, since want Born radius in .w slot)
@param arrayToCopy array to copy (Born array)
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
copySubArray
(
int
numberOfEntries
,
int
subarraySize
,
RealOpenMM
*
fullArray
,
int
copySlot
,
RealOpenMM
*
arrayToCopy
);
/**---------------------------------------------------------------------------------------
Helper method to repack RealOpenMM arrays (Simbios)
@param numberOfEntries entries/sub-array
@param subarraySize number of subarrays
@param array array
Input array = [subArray_1 subArray_2 subArray_3 ... subArray_N] \n
where each subArray_i is vector of length M=numberOfEntries \n
Output array = [ subArray_1_1 subArray_2_1 subArray_3_1 ... subArray_N_1 \n
subArray_1_2 subArray_2_2 subArray_3_2 ... subArray_N_2 \n
subArray_1_3 subArray_2_3 subArray_3_3 ... subArray_N_3 \n
... \n
subArray_1_M subArray_2_M subArray_3_M ... subArray_M ] \n
where N = numberOfEntries \n
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
repackArray
(
int
numberOfEntries
,
int
subarraySize
,
RealOpenMM
*
array
);
/**---------------------------------------------------------------------------------------
Helper method to repack RealOpenMM arrays (Simbios)
@param numberOfEntries entries/sub-array
@param subarraySize number of subarrays
@param array repacked output array
@param inputArrays inputArrays[subarraySize][numberOfEntries]
Output array = [ inputArrays[0][0] inputArrays[1][0] inputArrays[2][0] inputArrays[3][0] \n
inputArrays[0][1] inputArrays[1][1] inputArrays[2][1] inputArrays[3][1] \n
inputArrays[0][2] inputArrays[1][2] inputArrays[2][2] inputArrays[3][2] \n
... \n
inputArrays[0][numberOfEntries] ... inputArrays[subarraySize-1][numberOfEntries] \n
] \n
where N = numberOfEntries \n
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
repackArrayOfArrays
(
int
numberOfEntries
,
int
subarraySize
,
RealOpenMM
*
array
,
RealOpenMM
**
inputArrays
);
/**---------------------------------------------------------------------------------------
Collapse 2D array into packed single array (Simbios)
Example forces[3][N] -> array of size N containing RealOpenMM3 values
@param numberOfEntries entries (no. atoms)
@param iUnroll iUnroll
@param jUnroll jUnroll
@param arrays arrays to be merged (dimension is [iUnroll][numberOfEntries/iUnroll]
@param mergeArray output array (if null, then allocated)
@param log logging file descriptor
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
RealOpenMM
*
collapseArrays
(
int
numberOfEntries
,
int
iUnroll
,
int
jUnroll
,
RealOpenMM
**
arrays
,
RealOpenMM
*
mergeArray
,
FILE
*
log
);
/**---------------------------------------------------------------------------------------
Merge 2 arrays based on sentinel value (Simbios)
Overflow array, if present, signals which entries had nonsentinel in both arrays
Example \n
array1 = { 1, 2, 3, s, s, s, 4, 5, s } \n
array2 = { s, s, 6, 8, 9, 3, s, 7, s } \n
merge array = { 1, 2, 3, 8, 9, 3, 4, 5, s } \n
overflow array = { s, s, 6, s, s, s, s, 7, s } \n
@param numberOfEntries entries (no. atoms)
@param sentinelValue sentinel value
@param array1 first array
@param array2 second array
@param mergeArray output merge array
@param overflowArray output overflow array (if null, then ignored)
@param log logging file descriptor
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
mergeArraysBasedSentinelValue
(
int
numberOfEntries
,
RealOpenMM
sentinelValue
,
RealOpenMM
*
array1
,
RealOpenMM
*
array2
,
RealOpenMM
*
mergeArray
,
RealOpenMM
*
overflowArray
,
FILE
*
log
);
/**---------------------------------------------------------------------------------------
Helper method to store values from CPU loop in position seen in GPU output (Simbios)
--------------------------------------------------------------------------------------- */
static
int
storeInGpuFormat
(
int
atomI
,
int
atomJ
,
int
debugAtomJ
,
int
jUnroll
,
int
numberOfStreams
,
RealOpenMM
**
debugStreams
,
RealOpenMM
*
RealOpenMMValues
[
2
],
RealOpenMM
unsetDebugValue
,
bool
useUpper
,
FILE
*
log
);
/**---------------------------------------------------------------------------------------
Helper method to compare cpu and gpu computed arrays
@param numberOfAtoms entries (no. atoms)
@param chunkSize chunk size (usually 3 or 4)
@param cpuArray cpuArray[0-(chunkSize-1)][0,entries-1]
@param gpuArray gpuArray[chunkSize*entries]
@param tolerance check if relative difference is greater
than this tolerance
@param compareColumn array of size [chunkSize] signalling whether
column i is to be compared; it may be NULL
@param absoluteMin error if abs(cpu) + abs(gpu) > absoluteMin
set negative to ignore this condition
@param printOn if not set, then no printing
@param header id header -- optional
@param log logging file descriptor
@return number of failed entries
--------------------------------------------------------------------------------------- */
static
int
compareCpuGpuArrays
(
int
numberOfAtoms
,
int
chunkSize
,
RealOpenMM
**
cpuArray
,
RealOpenMM
*
gpuArray
,
RealOpenMM
tolerance
,
int
*
compareColumn
,
RealOpenMM
absoluteMin
,
int
printOn
,
const
char
*
header
,
FILE
*
log
);
// ---------------------------------------------------------------------------------------
};
// ---------------------------------------------------------------------------------------
#endif // __SimTKOpenMMGpuUtilities_H__
platforms/reference/src/SimTKUtilities/SimTKOpenMMGromacsUtilities.cpp
0 → 100644
View file @
598e076c
/* Portions copyright (c) 2006 Stanford University and Simbios.
* Contributors: Pande Group
*
* 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.
*/
// class of shared, static utility methods
#include "SimTKOpenMMGromacsUtilities.h"
#include "SimTKOpenMMLog.h"
#include "SimTKOpenMMUtilities.h"
// fabs(), ...
#include <math.h>
#include <stdlib.h>
#define UseGromacsMalloc 1
#ifdef UseGromacsMalloc
extern
"C"
{
#include "smalloc.h"
}
#endif
/* ---------------------------------------------------------------------------------------
Find distances**2 from a given atom (Simbios)
@param atomCoordinates atom coordinates
@param atomIndex atom index to find distances from
@param numberOfAtoms number of atoms
@param distances array of distances squared on return; array size must be at least
numberOfAtoms
@return distances
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGromacsUtilities
::
getDistanceSquaredFromSpecifiedAtom
(
const
rvec
*
atomCoordinates
,
int
atomIndex
,
int
numberOfAtoms
,
float
*
distances
){
// ---------------------------------------------------------------------------------------
float
atomXyz
[
3
];
// static const char* methodName = "\nSimTKOpenMMGromacsUtilities::getDistanceSquaredFromSpecifiedAtom";
// ---------------------------------------------------------------------------------------
for
(
int
jj
=
0
;
jj
<
3
;
jj
++
){
atomXyz
[
jj
]
=
atomCoordinates
[
atomIndex
][
jj
];
}
return
getDistanceSquaredFromSpecifiedPoint
(
atomCoordinates
,
atomXyz
,
numberOfAtoms
,
distances
);
}
/* ---------------------------------------------------------------------------------------
Find distances**2 from a given point (Simbios)
@param atomCoordinates atom coordinates
@param point point to find distances from
@param numberOfAtoms number of atoms
@param distances array of distances squared on return; array size must be at least \n
numberOfAtoms
@return SimTKOpenMMCommon::DefaultReturn;
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGromacsUtilities
::
getDistanceSquaredFromSpecifiedPoint
(
const
rvec
*
atomCoordinates
,
float
*
point
,
int
numberOfAtoms
,
float
*
distances
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMGromacsUtilities::getDistanceSquaredFromSpecifiedPoint";
// ---------------------------------------------------------------------------------------
memset
(
distances
,
0
,
sizeof
(
float
)
*
numberOfAtoms
);
for
(
int
ii
=
0
;
ii
<
numberOfAtoms
;
ii
++
){
for
(
int
jj
=
0
;
jj
<
3
;
jj
++
){
float
diff
=
(
point
[
jj
]
-
atomCoordinates
[
ii
][
jj
]);
distances
[
ii
]
+=
diff
*
diff
;
}
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/* ---------------------------------------------------------------------------------------
Get atom name from top data struct
@param atomIndex atom index
@param outputAtomName output atom name
@param top GMX t_topology struct
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGromacsUtilities
::
getAtomNameGivenAtomIndex
(
int
atomIndex
,
char
*
outputAtomName
,
const
t_topology
*
top
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMGromacsUtilities::getAtomNameGivenAtomIndex";
// ---------------------------------------------------------------------------------------
char
***
atomNames
=
top
->
atoms
.
atomname
;
const
char
*
atomName
=
(
*
(
atomNames
[
atomIndex
]))
==
NULL
||
strlen
(
(
*
(
atomNames
[
atomIndex
]))
)
<
1
||
strlen
(
(
*
(
atomNames
[
atomIndex
]))
)
>
100
?
"NA"
:
(
*
(
atomNames
[
atomIndex
]));
#ifdef WIN32
(
void
)
strcpy_s
(
outputAtomName
,
sizeof
(
atomName
),
atomName
);
#else
(
void
)
strcpy
(
outputAtomName
,
atomName
);
#endif
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/* ---------------------------------------------------------------------------------------
Get residue name from top data struct given atom index
@param atomIndex atom index
@param top GMX t_topology struct
@param outputResidueName output residue name (assume enough memory has been allocated)
@param outputResidueIndex if not null, then *outputResidueIndex is residue index
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGromacsUtilities
::
getResidueNameGivenAtomIndex
(
int
atomIndex
,
const
t_topology
*
top
,
char
*
outputResidueName
,
int
*
outputResidueIndex
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMGromacsUtilities::getResidueNameGivenAtomIndex";
// ---------------------------------------------------------------------------------------
char
***
residueNames
=
top
->
atoms
.
resname
;
int
residueIndex
=
top
->
atoms
.
atom
[
atomIndex
].
resnr
;
if
(
outputResidueIndex
!=
NULL
){
*
outputResidueIndex
=
residueIndex
;
}
const
char
*
residueName
=
(
*
(
residueNames
[
residueIndex
]))
==
NULL
||
strlen
(
(
*
(
residueNames
[
residueIndex
]))
)
<
1
||
strlen
(
(
*
(
residueNames
[
residueIndex
]))
)
>
100
?
"NA"
:
(
*
(
residueNames
[
residueIndex
]));
#ifdef WIN32
(
void
)
strcpy_s
(
outputResidueName
,
sizeof
(
residueName
),
residueName
);
#else
(
void
)
strcpy
(
outputResidueName
,
residueName
);
#endif
return
SimTKOpenMMCommon
::
DefaultReturn
;
// ---------------------------------------------------------------------------------------
}
/* ---------------------------------------------------------------------------------------
Get atom name from top data struct
@param atomIndex atom index
@param top GMX t_topology struct
@param buffer output buffer (enough space should have been reserved)
@param maxAtoms max number of atoms for this run (may change -- used mainly
to keep from reallocating cache array)
@param tab tab spacing
@return SimTKOpenMMCommon::DefaultReturn
Atom info is cached in atomIdStrings to speed things up.
The cache memory may be freed by calling the method w/
atomIndex == -1
@see freeArrayOfStrings()
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGromacsUtilities
::
getAtomIdStringGivenAtomIndex
(
int
atomIndex
,
const
t_topology
*
top
,
int
sizeOfBuffer
,
char
*
buffer
,
int
maxAtoms
,
unsigned
int
tab
){
// ---------------------------------------------------------------------------------------
static
int
maxAtomIndex
=
-
1
;
static
char
**
atomIdStrings
=
NULL
;
char
atomName
[
32
];
char
residueName
[
32
];
int
residueIndex
;
// static const char* methodName = "\nSimTKOpenMMGromacsUtilities::getAtomIdStringGivenAtomIndex";
// ---------------------------------------------------------------------------------------
// free cache memory if allocated
if
(
atomIndex
==
-
1
){
// (void) fprintf( stdout, "SimTKOpenMMGromacsUtilities: called getAtomIdStringGivenAtomIndex to delete cached strings %d.", maxAtomIndex );
if
(
maxAtomIndex
>
0
&&
atomIdStrings
!=
NULL
){
SimTKOpenMMUtilities
::
freeArrayOfStrings
(
maxAtomIndex
,
atomIdStrings
);
atomIdStrings
=
NULL
;
maxAtomIndex
=
-
1
;
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
// allocate cache memory?
if
(
maxAtoms
>
0
&&
(
maxAtomIndex
==
-
1
||
maxAtoms
>
maxAtomIndex
)
){
if
(
maxAtoms
>
maxAtomIndex
&&
maxAtomIndex
>
0
){
SimTKOpenMMUtilities
::
freeArrayOfStrings
(
maxAtomIndex
,
atomIdStrings
);
}
maxAtomIndex
=
maxAtoms
+
1
;
// atomIdStrings = (char**) malloc( maxAtomIndex*sizeof( char* ) );
atomIdStrings
=
(
char
**
)
SimTKOpenMMUtilities
::
Xmalloc
(
"atomIdStrings"
,
__FILE__
,
__LINE__
,
maxAtomIndex
*
sizeof
(
char
*
)
);
memset
(
atomIdStrings
,
0
,
maxAtomIndex
*
sizeof
(
char
*
)
);
}
// if id is cached, return it
if
(
atomIndex
<
maxAtomIndex
&&
atomIdStrings
[
atomIndex
]
!=
NULL
){
#ifdef WIN32
(
void
)
strcpy_s
(
buffer
,
sizeof
(
atomIdStrings
[
atomIndex
]),
atomIdStrings
[
atomIndex
]
);
#else
(
void
)
strcpy
(
buffer
,
atomIdStrings
[
atomIndex
]
);
#endif
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
// not cached -- assemble info
getAtomNameGivenAtomIndex
(
atomIndex
,
atomName
,
top
);
getResidueNameGivenAtomIndex
(
atomIndex
,
top
,
residueName
,
&
residueIndex
);
#ifdef WIN32
(
void
)
sprintf_s
(
buffer
,
sizeOfBuffer
,
"%s_%d %s"
,
residueName
,
residueIndex
,
atomName
);
#else
(
void
)
sprintf
(
buffer
,
"%s_%d %s"
,
residueName
,
residueIndex
,
atomName
);
#endif
// tab string
if
(
tab
>
0
&&
strlen
(
buffer
)
<
tab
){
SimTKOpenMMUtilities
::
tabStringInPlace
(
buffer
,
tab
);
}
// cache info if atomIdStrings array is allocated
if
(
atomIndex
<
maxAtomIndex
&&
atomIdStrings
){
if
(
atomIdStrings
[
atomIndex
]
!=
NULL
){
SimTKOpenMMUtilities
::
Xfree
(
"atomIdStrings"
,
__FILE__
,
__LINE__
,
atomIdStrings
[
atomIndex
]
);
}
unsigned
int
bufferSz
=
(
unsigned
int
)
sizeof
(
char
);
bufferSz
*=
(
unsigned
int
)
(
strlen
(
buffer
)
+
1
);
atomIdStrings
[
atomIndex
]
=
(
char
*
)
SimTKOpenMMUtilities
::
Xmalloc
(
"atomIdStrings[atomIndex]"
,
__FILE__
,
__LINE__
,
bufferSz
);
#ifdef WIN32
(
void
)
strcpy_s
(
atomIdStrings
[
atomIndex
],
sizeof
(
buffer
),
buffer
);
#else
(
void
)
strcpy
(
atomIdStrings
[
atomIndex
],
buffer
);
#endif
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/**---------------------------------------------------------------------------------------
Get (1-2) bonds (Simbios)
@param maxAtoms max number of atoms
@param IntSetVector vector of integer sets
@param top Gromacs t_topolgy struct
@return 0 if no errors or
return x, where x is the number of errors encountered
Upon return covalentBonds[i] = set of atom indices that are covalent partners
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGromacsUtilities
::
getCovalentBondIndices
(
int
maxAtoms
,
IntSetVector
&
covalentBonds
,
const
t_topology
*
top
){
// ---------------------------------------------------------------------------------------
static
const
char
*
methodName
=
"
\n
SimTKOpenMMGromacsUtilities::getCovalentBonds"
;
// ---------------------------------------------------------------------------------------
// indices
int
idefArrayIndex
;
int
offset
=
3
;
int
atomIndexOffset
=
1
;
// load 1-2 bonds
// t_iparams* params = top->idef.iparams;
int
errors
=
0
;
covalentBonds
.
resize
(
maxAtoms
+
1
);
for
(
int
jj
=
0
;
jj
<
2
;
jj
++
){
idefArrayIndex
=
jj
?
F_SHAKE
:
F_BONDS
;
t_iatom
*
atoms
=
top
->
idef
.
il
[
idefArrayIndex
].
iatoms
;
for
(
int
ii
=
0
;
ii
<
top
->
idef
.
il
[
idefArrayIndex
].
nr
;
ii
+=
offset
){
// int type = (int) atoms[ ii ];
int
atomI
=
(
int
)
atoms
[
ii
+
atomIndexOffset
];
int
atomJ
=
(
int
)
atoms
[
ii
+
atomIndexOffset
+
1
];
// validate indices
if
(
atomI
>=
maxAtoms
||
atomI
<
0
){
std
::
stringstream
message
;
message
<<
methodName
;
message
<<
" atom index="
<<
atomI
<<
" (Gromacs index="
<<
ii
<<
") too large: max="
<<
maxAtoms
;
SimTKOpenMMLog
::
printMessage
(
message
);
errors
++
;
atomI
=
-
1
;
}
if
(
atomJ
>=
maxAtoms
||
atomJ
<
0
){
std
::
stringstream
message
;
message
<<
methodName
;
message
<<
" atom index="
<<
atomJ
<<
" (Gromacs index="
<<
ii
<<
") too large: max="
<<
maxAtoms
;
SimTKOpenMMLog
::
printMessage
(
message
);
errors
++
;
atomJ
=
-
1
;
}
// RealOpenMM bondLength = params[type].harmonic.rA;
if
(
atomI
>=
0
&&
atomJ
>=
0
){
covalentBonds
[
atomI
].
insert
(
atomJ
);
covalentBonds
[
atomJ
].
insert
(
atomI
);
}
}
}
// waters?
errors
+=
SimTKOpenMMGromacsUtilities
::
getSettleCovalentBondIndices
(
maxAtoms
,
covalentBonds
,
top
);
return
errors
;
}
/**---------------------------------------------------------------------------------------
Add SETTLE stretch (1-2) bonds (Simbios)
@param maxAtoms max number of atoms
@param IntSetVector vector of integer sets
@param top Gromacs t_topolgy struct
@return SimTKOpenMMCommon::DefaultReturn if no errors or
return x, where x is the number of errors encountered
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGromacsUtilities
::
getSettleCovalentBondIndices
(
int
maxAtoms
,
IntSetVector
&
covalentBonds
,
const
t_topology
*
top
){
// ---------------------------------------------------------------------------------------
static
const
char
*
methodName
=
"SimTKOpenMMGromacsUtilities::getSettleCovalentBondIndices"
;
// ---------------------------------------------------------------------------------------
// indices
int
idefArrayIndex
=
F_SETTLE
;
int
offset
=
2
;
int
atomIndexOffset
=
1
;
// load bonds via SETTLE parameter
t_iatom
*
atoms
=
top
->
idef
.
il
[
idefArrayIndex
].
iatoms
;
t_iparams
*
params
=
top
->
idef
.
iparams
;
int
errors
=
0
;
covalentBonds
.
resize
(
maxAtoms
+
1
);
for
(
int
ii
=
0
;
ii
<
top
->
idef
.
il
[
idefArrayIndex
].
nr
;
ii
+=
offset
){
//int type = (int) atoms[ ii ];
int
atomI
=
(
int
)
atoms
[
ii
+
atomIndexOffset
];
//RealOpenMM OHBondLength = params[type].harmonic.rA;
//RealOpenMM HHBondLength = params[type].harmonic.krA;
//RealOpenMM bondAngle = 1.0f - ( (HHBondLength*HHBondLength)/ (2.0f*OHBondLength*OHBondLength));
// bondAngle = acosf( bondAngle );
// validate indices
if
(
(
atomI
+
2
)
>=
maxAtoms
||
atomI
<
0
){
std
::
stringstream
message
;
message
<<
methodName
;
message
<<
" atom index="
<<
atomI
<<
" (Gromacs index="
<<
ii
<<
") too large: max="
<<
maxAtoms
;
SimTKOpenMMLog
::
printMessage
(
message
);
errors
++
;
atomI
=
-
1
;
}
// add 2 O-H bonds
if
(
atomI
>=
0
){
covalentBonds
[
atomI
].
insert
(
atomI
+
1
);
covalentBonds
[
atomI
+
1
].
insert
(
atomI
);
covalentBonds
[
atomI
].
insert
(
atomI
+
2
);
covalentBonds
[
atomI
+
2
].
insert
(
atomI
);
}
}
return
errors
;
}
/**---------------------------------------------------------------------------------------
Write Tinker xyz file (Simbios)
@param numberOfAtoms number of atoms
@param atomCoordinates atom coordinates
@param header header
@param xyzFileName output file name
@param top Gromacs topology struct
@return 0 unless error detected
Currently no attempt is made to get the atom name/type to accurately
reflect the Tinker names/types. Rather method is used to output atoms
in Gromacs order and then reorder those in a corresponding xyz file
w/ the correct atom names/types so that they match the Gromacs order
This makes it easier to compare results between Gromacs and Tinker
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGromacsUtilities
::
writeTinkerXyzFile
(
int
numberOfAtoms
,
const
rvec
*
atomCoordinates
,
const
std
::
string
&
header
,
const
std
::
string
&
xyzFileName
,
const
t_topology
*
top
){
// ---------------------------------------------------------------------------------------
static
const
char
*
methodName
=
"
\n
SimTKOpenMMGromacsUtilities::writeXyzFile"
;
// ---------------------------------------------------------------------------------------
// get covalent bonds
IntSetVector
covalentBonds
;
SimTKOpenMMGromacsUtilities
::
getCovalentBondIndices
(
numberOfAtoms
,
covalentBonds
,
top
);
// get Tinker biotypes
StringVector
tinkerAtomNames
;
StringVector
tinkerResidueNames
;
IntVector
tinkerBiotypes
;
SimTKOpenMMGromacsUtilities
::
getTinkerBiotypes
(
numberOfAtoms
,
top
,
tinkerAtomNames
,
tinkerResidueNames
,
tinkerBiotypes
);
// open file
FILE
*
xyzFile
=
NULL
;
#ifdef WIN32
fopen_s
(
&
xyzFile
,
xyzFileName
.
c_str
(),
"w"
);
#else
xyzFile
=
fopen
(
xyzFileName
.
c_str
(),
"w"
);
#endif
if
(
xyzFile
!=
NULL
){
std
::
stringstream
message
;
message
<<
methodName
;
message
<<
" Opened file=<"
<<
xyzFileName
.
c_str
()
<<
">."
;
SimTKOpenMMLog
::
printMessage
(
message
);
}
else
{
std
::
stringstream
message
;
message
<<
methodName
;
message
<<
" could not open file=<"
<<
xyzFileName
.
c_str
()
<<
"> -- abort output."
;
SimTKOpenMMLog
::
printMessage
(
message
);
return
SimTKOpenMMCommon
::
ErrorReturn
;
}
// first line
(
void
)
fprintf
(
xyzFile
,
"%d %s
\n
"
,
numberOfAtoms
,
header
.
c_str
()
);
/*
1232 CHROMOSOMAL PROTEIN 02-JAN-87 1UBQ
1 N3 27.340000 24.430000 2.614000 472 2 5 6 7
2 CT 26.266000 25.413000 2.842000 473 1 3 8 9
3 C 26.913000 26.639000 3.531000 474 2 4 20
*/
for
(
int
atomI
=
0
;
atomI
<
numberOfAtoms
;
atomI
++
){
// scale coordinates by 10 for Angstrom -> nanometer conversion
(
void
)
fprintf
(
xyzFile
,
"%6d %-4s %16.9f %16.9f %16.9f %6d "
,
atomI
+
1
,
tinkerAtomNames
[
atomI
].
c_str
(),
10.0
f
*
atomCoordinates
[
atomI
][
0
],
10.0
f
*
atomCoordinates
[
atomI
][
1
],
10.0
f
*
atomCoordinates
[
atomI
][
2
],
tinkerBiotypes
[
atomI
]
);
// include 1-2 bonds
IntSet
atomCovalentBonds
=
covalentBonds
[
atomI
];
for
(
IntSetCI
kk
=
atomCovalentBonds
.
begin
();
kk
!=
atomCovalentBonds
.
end
();
kk
++
){
(
void
)
fprintf
(
xyzFile
,
"%6d "
,
(
*
kk
+
1
)
);
}
(
void
)
fprintf
(
xyzFile
,
"
\n
"
);
}
(
void
)
fflush
(
xyzFile
);
(
void
)
fclose
(
xyzFile
);
// diagnostics
std
::
stringstream
message
;
message
<<
methodName
;
message
<<
" closed file=<"
<<
xyzFileName
.
c_str
()
<<
">."
;
SimTKOpenMMLog
::
printMessage
(
message
);
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/**---------------------------------------------------------------------------------------
Get Tinker biotypes (Simbios)
@param numberOfAtoms number of atoms
@param top Gromacs topology struct
@param tinkerAtomNames Tinker atom names upon return
@param tinkerResidueNames Tinker residue names upon return
@param tinkerBiotypes Tinker biotypes upon return
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGromacsUtilities
::
getTinkerBiotypes
(
int
numberOfAtoms
,
const
t_topology
*
top
,
StringVector
&
tinkerAtomNames
,
StringVector
&
tinkerResidueNames
,
IntVector
&
tinkerBiotypes
){
// ---------------------------------------------------------------------------------------
static
const
char
*
methodName
=
"
\n
SimTKOpenMMGromacsUtilities::getTinkerBiotypes"
;
static
const
unsigned
int
bufferSz
=
128
;
char
atomName
[
128
];
// ---------------------------------------------------------------------------------------
tinkerAtomNames
.
resize
(
numberOfAtoms
);
tinkerResidueNames
.
resize
(
numberOfAtoms
);
tinkerBiotypes
.
resize
(
numberOfAtoms
);
// Gromacs array of atom and residue names
char
***
atomNames
=
top
->
atoms
.
atomname
;
// char*** atomType = top->atoms.atomtype;
int
numberOfResidues
=
top
->
atoms
.
nres
;
char
***
residueNames
=
top
->
atoms
.
resname
;
// for each atom, set names, indices, ...
int
residueI
=
0
;
int
firstAtomNameL
=
-
1
;
char
*
firstAtomName
=
NULL
;
int
firstWaterAtom
=
-
1
;
std
::
string
residueName
;
std
::
string
tinkerResidueName
;
for
(
int
atomI
=
0
;
atomI
<
numberOfAtoms
;
atomI
++
){
// check if hitting new residue
// save first atom in list to allow for check
// when another atom is hit
#ifdef WIN32
(
void
)
strcpy_s
(
atomName
,
bufferSz
,
*
(
atomNames
[
atomI
])
);
#else
(
void
)
strcpy
(
atomName
,
*
(
atomNames
[
atomI
])
);
#endif
if
(
!
firstAtomName
){
firstAtomName
=
*
(
atomNames
[
atomI
]);
firstAtomNameL
=
(
int
)
strlen
(
*
(
atomNames
[
atomI
])
);
residueName
=
std
::
string
(
*
(
residueNames
[
residueI
])
);
tinkerResidueName
=
SimTKOpenMMGromacsUtilities
::
getTinkerBiotypeResidueNameGivenGromacsResidueName
(
residueName
);
}
else
if
(
((
int
)
strlen
(
*
(
atomNames
[
atomI
])
)
==
firstAtomNameL
&&
!
strcmp
(
atomName
,
firstAtomName
))
||
!
strcmp
(
atomName
,
"OW"
)
){
residueI
++
;
residueName
=
std
::
string
(
*
(
residueNames
[
residueI
])
);
residueI
=
(
residueI
>=
numberOfResidues
)
?
numberOfResidues
-
1
:
residueI
;
if
(
firstWaterAtom
<
0
&&
!
strcmp
(
atomName
,
"OW"
)
){
firstWaterAtom
=
atomI
;
}
tinkerResidueName
=
SimTKOpenMMGromacsUtilities
::
getTinkerBiotypeResidueNameGivenGromacsResidueName
(
residueName
);
}
/*
if( residueI >= 0 ){
std::stringstream message;
message << "\n" << residueI << ". " << *(residueNames[residueI]) << " Tinker=<" << tinkerResidueName << "> <" << *(atomNames[atomI]) << ">";
SimTKOpenMMLog::printMessage( message );
} */
// OC1, OC2 -> OXT at C-terminus
if
(
atomName
[
0
]
==
'O'
&&
atomName
[
1
]
==
'C'
){
atomName
[
1
]
=
'X'
;
atomName
[
2
]
=
'T'
;
atomName
[
3
]
=
'\0'
;
// H1, H2, H3 -> HN at N-terminus
}
else
if
(
residueI
==
0
&&
atomName
[
0
]
==
'H'
&&
(
atomName
[
1
]
==
'1'
||
atomName
[
1
]
==
'2'
||
atomName
[
1
]
==
'3'
)
){
atomName
[
1
]
=
'N'
;
// solvent atoms
}
else
if
(
atomName
[
1
]
==
'W'
&&
(
atomName
[
0
]
==
'O'
||
atomName
[
0
]
==
'H'
)
){
atomName
[
1
]
=
'\0'
;
}
int
bioType
=
SimTKOpenMMGromacsUtilities
::
getBiotypeGivenResidueAtomNames
(
tinkerResidueName
,
std
::
string
(
atomName
)
);
// handle cases like "NLEU" where type is in "LEU"
if
(
bioType
<
0
&&
residueName
.
length
()
==
4
){
std
::
string
removeFirstChar
=
residueName
.
substr
(
1
,
4
);
std
::
string
localTinkerResidueName
=
SimTKOpenMMGromacsUtilities
::
getTinkerBiotypeResidueNameGivenGromacsResidueName
(
removeFirstChar
);
bioType
=
SimTKOpenMMGromacsUtilities
::
getBiotypeGivenResidueAtomNames
(
localTinkerResidueName
,
std
::
string
(
atomName
)
);
}
tinkerAtomNames
[
atomI
]
=
atomName
;
tinkerResidueNames
[
atomI
]
=
residueName
;
tinkerBiotypes
[
atomI
]
=
bioType
;
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/**---------------------------------------------------------------------------------------
Get Tinker biotype index given residue and atom names (Simbios)
@param tinkerResidueName Tinker residue name
@param tinkerAtomName Tinker atom name
@return biotype if able to map names; otherwise return -1
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGromacsUtilities
::
getBiotypeGivenResidueAtomNames
(
const
std
::
string
&
tinkerResidueName
,
const
std
::
string
&
tinkerAtomName
){
// ---------------------------------------------------------------------------------------
char
localAtomName
[
256
];
static
const
std
::
string
methodName
=
"
\n
SimTKOpenMMGromacsUtilities::getBiotypeGivenResidueAtomNames"
;
// ---------------------------------------------------------------------------------------
// build residue/atom name
std
::
string
fullName
=
tinkerResidueName
;
fullName
.
append
(
"_"
);
fullName
.
append
(
tinkerAtomName
);
StringIntMap
*
nameMap
=
SimTKOpenMMGromacsUtilities
::
getTinkerResidueAtomNameBiotypeMap
(
AmberForceField
);
StringIntMapCI
reference
=
nameMap
->
find
(
fullName
);
if
(
reference
!=
nameMap
->
end
(
)
){
return
(
*
reference
).
second
;
}
// if atom name ends with two digits -> remove last digit
// HD12 -> HD1
#ifdef WIN32
(
void
)
sprintf_s
(
localAtomName
,
256
,
"%s"
,
tinkerAtomName
.
c_str
()
);
#else
(
void
)
sprintf
(
localAtomName
,
"%s"
,
tinkerAtomName
.
c_str
()
);
#endif
unsigned
int
lastChar
=
(
unsigned
int
)
(
strlen
(
localAtomName
)
-
1
);
if
(
lastChar
>
2
&&
isdigit
(
localAtomName
[
lastChar
]
)
&&
isdigit
(
localAtomName
[
lastChar
-
1
]
)
){
localAtomName
[
lastChar
]
=
'\0'
;
lastChar
--
;
}
// 'H' -> 'HN' (skipping H in water)
if
(
localAtomName
[
0
]
==
'H'
&&
lastChar
==
0
&&
strcmp
(
tinkerResidueName
.
c_str
(),
"AMOEBA_Water"
)
){
localAtomName
[
1
]
=
'N'
;
localAtomName
[
2
]
=
'\0'
;
}
// Solvent: OW -> O && HW1/HW2 -> H
if
(
lastChar
>
0
&&
localAtomName
[
1
]
==
'W'
){
localAtomName
[
2
]
=
'\0'
;
}
std
::
stringstream
messageX
;
std
::
string
modifiedAtomName
(
localAtomName
);
fullName
=
tinkerResidueName
;
fullName
.
append
(
"_"
);
fullName
.
append
(
modifiedAtomName
);
//messageX << " " << modifiedAtomName;
// check if _tinkerResidueBiotypeParameterMap contains Tinker atom name
// if last name ends in a digit and name was not found, try removing trailing digit
// (void) fprintf( log, "%s check tinkerBiotypeParameterMap (residue=%s) Tinker atom type=<%s>; input=<%s>",
// methodName.c_str(), tinkerResidueName->c_str(), modifiedAtomName.c_str(), tinkerAtomName->c_str() );
// (void) fflush( log );
reference
=
nameMap
->
find
(
fullName
);
if
(
reference
==
nameMap
->
end
(
)
){
if
(
isdigit
(
localAtomName
[
lastChar
]
)
){
localAtomName
[
lastChar
]
=
'\0'
;
modifiedAtomName
=
std
::
string
(
localAtomName
);
fullName
=
tinkerResidueName
;
fullName
.
append
(
"_"
);
fullName
.
append
(
modifiedAtomName
);
//messageX << " " << modifiedAtomName;
reference
=
nameMap
->
find
(
fullName
);
}
}
if
(
reference
==
nameMap
->
end
(
)
){
// no message for atoms w/ residue names of length 4
// program will try agian w/ N/C prefix removed from name (e.g., NLEU -> LEU )
// printing message will confuse user
if
(
tinkerResidueName
.
size
()
<
4
){
std
::
stringstream
message
;
message
<<
methodName
.
c_str
()
<<
" Missing Tinker residue=<"
<<
tinkerResidueName
.
c_str
()
<<
"> <"
<<
tinkerAtomName
.
c_str
()
<<
">."
;
//message << " " << messageX.str();
SimTKOpenMMLog
::
printMessage
(
message
);
}
return
-
1
;
}
else
{
return
(
*
reference
).
second
;
}
}
/**---------------------------------------------------------------------------------------
Get Tinker biotype residue name given Gromacs residue name (Simbios)
@param gromacsResidueName Gromac's residue name.
@return AmoebaCommon::AmoebaNotSet if name not found in mapping
--------------------------------------------------------------------------------------- */
std
::
string
SimTKOpenMMGromacsUtilities
::
getTinkerBiotypeResidueNameGivenGromacsResidueName
(
const
std
::
string
gromacsResidueName
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMGromacsUtilities::getTinkerBiotypeResidueNameGivenGromacsResidueName";
// ---------------------------------------------------------------------------------------
StringMap
*
residueNameMap
=
getTinkerGromacsResidueNameMap
();
if
(
residueNameMap
!=
NULL
){
StringMapI
mapIterator
=
residueNameMap
->
find
(
gromacsResidueName
);
if
(
mapIterator
!=
residueNameMap
->
end
()
){
return
(
*
mapIterator
).
second
;
}
}
return
SimTKOpenMMCommon
::
NotSet
;
}
/**---------------------------------------------------------------------------------------
Get atomic numbers
@param top Gromac's topology struct
@param atomicNumber output atomic numbers
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGromacsUtilities
::
getAtomicNumbers
(
const
t_topology
*
top
,
IntVector
&
atomicNumber
){
// ---------------------------------------------------------------------------------------
static
const
std
::
string
methodName
=
"
\n
SimTKOpenMMGromacsUtilities::getAtomicNumbers"
;
// ---------------------------------------------------------------------------------------
atomicNumber
.
resize
(
top
->
atoms
.
nr
);
for
(
int
atomI
=
0
;
atomI
<
top
->
atoms
.
nr
;
atomI
++
){
int
element
=
0
;
RealOpenMM
mass
=
(
RealOpenMM
)
top
->
atoms
.
atom
[
atomI
].
m
;
if
(
mass
<
(
RealOpenMM
)
1.2
&&
mass
>=
(
RealOpenMM
)
1.0
){
// hydrogen
element
=
1
;
}
else
if
(
mass
>
(
RealOpenMM
)
11.8
&&
mass
<
(
RealOpenMM
)
12.2
){
// carbon
element
=
6
;
}
else
if
(
mass
>
(
RealOpenMM
)
14.0
&&
mass
<
(
RealOpenMM
)
15.0
){
// nitrogen
element
=
7
;
}
else
if
(
mass
>
(
RealOpenMM
)
15.5
&&
mass
<
(
RealOpenMM
)
16.5
){
// oxygen
element
=
8
;
}
else
if
(
mass
>
(
RealOpenMM
)
31.5
&&
mass
<
(
RealOpenMM
)
32.5
){
// sulphur
element
=
16
;
}
else
if
(
mass
>
(
RealOpenMM
)
29.5
&&
mass
<
(
RealOpenMM
)
30.5
){
// phosphorus
element
=
15
;
}
else
{
std
::
stringstream
message
;
char
***
atomNames
=
top
->
atoms
.
atomname
;
message
<<
methodName
;
message
<<
" Warning: mass for atom=<"
<<
(
*
(
atomNames
[
atomI
]))
<<
"> mass="
<<
mass
<<
"> not recognized."
;
SimTKOpenMMLog
::
printMessage
(
message
);
}
atomicNumber
[
atomI
]
=
element
;
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/**---------------------------------------------------------------------------------------
Get OBC scale factors
@param top Gromac's topology struct
@param scaleFactors output atomic numbers
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGromacsUtilities
::
getObcScaleFactors
(
const
t_topology
*
top
,
RealOpenMM
*
scaleFactors
){
// ---------------------------------------------------------------------------------------
static
const
std
::
string
methodName
=
"
\n
SimTKOpenMMGromacsUtilities::getObcScaleFactors"
;
// ---------------------------------------------------------------------------------------
RealOpenMMVector
scaleFactorV
;
int
status
=
SimTKOpenMMGromacsUtilities
::
getObcScaleFactors
(
top
,
scaleFactorV
);
for
(
int
ii
=
0
;
ii
<
top
->
atoms
.
nr
;
ii
++
){
scaleFactors
[
ii
]
=
scaleFactorV
[
ii
];
}
return
status
;
}
/**---------------------------------------------------------------------------------------
Get OBC scale factors
@param top Gromac's topology struct
@param scaleFactors output atomic numbers
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGromacsUtilities
::
getObcScaleFactors
(
const
t_topology
*
top
,
RealOpenMMVector
&
scaleFactors
){
// ---------------------------------------------------------------------------------------
static
const
std
::
string
methodName
=
"
\n
SimTKOpenMMGromacsUtilities::getObcScaleFactors"
;
// ---------------------------------------------------------------------------------------
scaleFactors
.
resize
(
top
->
atoms
.
nr
);
for
(
int
atomI
=
0
;
atomI
<
top
->
atoms
.
nr
;
atomI
++
){
RealOpenMM
scaleFactor
=
(
RealOpenMM
)
0.8
;
RealOpenMM
mass
=
(
RealOpenMM
)
top
->
atoms
.
atom
[
atomI
].
m
;
if
(
mass
<
(
RealOpenMM
)
1.2
&&
mass
>=
(
RealOpenMM
)
1.0
){
// hydrogen
scaleFactor
=
(
RealOpenMM
)
0.85
;
}
else
if
(
mass
>
(
RealOpenMM
)
11.8
&&
mass
<
(
RealOpenMM
)
12.2
){
// carbon
scaleFactor
=
(
RealOpenMM
)
0.72
;
}
else
if
(
mass
>
(
RealOpenMM
)
14.0
&&
mass
<
(
RealOpenMM
)
15.0
){
// nitrogen
scaleFactor
=
(
RealOpenMM
)
0.79
;
}
else
if
(
mass
>
(
RealOpenMM
)
15.5
&&
mass
<
(
RealOpenMM
)
16.5
){
// oxygen
scaleFactor
=
(
RealOpenMM
)
0.85
;
}
else
if
(
mass
>
(
RealOpenMM
)
31.5
&&
mass
<
(
RealOpenMM
)
32.5
){
// sulphur
scaleFactor
=
(
RealOpenMM
)
0.96
;
}
else
if
(
mass
>
(
RealOpenMM
)
29.5
&&
mass
<
(
RealOpenMM
)
30.5
){
// phosphorus
scaleFactor
=
(
RealOpenMM
)
0.86
;
}
else
{
std
::
stringstream
message
;
char
***
atomNames
=
top
->
atoms
.
atomname
;
message
<<
methodName
;
message
<<
" Warning: mass for atom=<"
<<
(
*
(
atomNames
[
atomI
]))
<<
"> mass="
<<
mass
<<
"> not recognized."
;
SimTKOpenMMLog
::
printMessage
(
message
);
}
scaleFactors
[
atomI
]
=
scaleFactor
;
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/**---------------------------------------------------------------------------------------
Get Tinker-Gromacs residue name map (Simbios)
The hash map is implemented as singleton
@return StringMap mapping Gromac's residue names to Tinker biotype residue names
--------------------------------------------------------------------------------------- */
StringMap
*
SimTKOpenMMGromacsUtilities
::
getTinkerGromacsResidueNameMap
(
void
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMGromacsUtilities::getTinkerBiotypeResidueNameGivenGromacsResidueName";
// CYS2 == CYX ?
static
char
*
nameMap
[][
3
]
=
{
{
"ALA"
,
"Alanine"
,
NULL
},
{
"ARG"
,
"Arginine"
,
NULL
},
{
"ASN"
,
"Asparagine"
,
NULL
},
{
"ASP"
,
"Aspartic_Acid"
,
NULL
},
{
"CYS"
,
"Cysteine_(-SH)"
,
NULL
},
{
"CYX"
,
"Cystine_(-SS-)"
,
NULL
},
{
"CYS2"
,
"Cystine_(-SS-)"
,
NULL
},
{
"GLU"
,
"Glutamic_Acid"
,
NULL
},
{
"GLN"
,
"Glutamine"
,
NULL
},
{
"GLY"
,
"Glycine"
,
NULL
},
{
"HIP"
,
"Histidine_(+)"
,
NULL
},
{
"HID"
,
"Histidine_(HD)"
,
NULL
},
{
"HIE"
,
"Histidine_(HE)"
,
NULL
},
{
"ILE"
,
"Isoleucine"
,
NULL
},
{
"LEU"
,
"Leucine"
,
NULL
},
{
"NLE"
,
"Lysine"
,
"LYS"
},
{
"LYS"
,
"Lysine"
,
NULL
},
{
"LYN"
,
"Lysine"
,
"LYS"
},
{
"LYSH"
,
"Lysine"
,
"LYS"
},
{
"LYP"
,
"Lysine"
,
"LYS"
},
{
"MET"
,
"Methionine"
,
NULL
},
{
"AIB"
,
"MethylAlanine_(AIB)"
,
NULL
},
{
"PHE"
,
"Phenylalanine"
,
NULL
},
{
"PRO"
,
"Proline"
,
NULL
},
{
"SER"
,
"Serine"
,
NULL
},
{
"THR"
,
"Threonine"
,
NULL
},
{
"TRP"
,
"Tryptophan"
,
NULL
},
{
"TYR"
,
"Tyrosine"
,
NULL
},
{
"VAL"
,
"Valine"
,
NULL
},
{
"SOL"
,
"AMOEBA_Water"
,
NULL
},
{
NULL
,
NULL
,
NULL
}
};
static
const
int
bufferSz
=
128
;
char
auxiliaryName
[
2
][
bufferSz
];
static
StringMap
*
residueNameMap
=
NULL
;
// ---------------------------------------------------------------------------------------
// residueNameMap is singleton
if
(
residueNameMap
==
NULL
){
residueNameMap
=
new
StringMap
();
// unsigned int initialMapSize = sizeof( nameMap )/(2*sizeof( char* ));
int
index
=
0
;
while
(
nameMap
[
index
][
0
]
!=
NULL
){
(
*
residueNameMap
)[
nameMap
[
index
][
0
]]
=
nameMap
[
index
][
1
];
// add C & N terminal residues
// e.g., NMET -> N-Terminal_MET
if
(
nameMap
[
index
][
2
]
!=
NULL
){
#ifdef WIN32
(
void
)
sprintf_s
(
auxiliaryName
[
1
],
bufferSz
,
"N-Terminal_%s"
,
nameMap
[
index
][
2
]
);
#else
(
void
)
sprintf
(
auxiliaryName
[
1
],
"N-Terminal_%s"
,
nameMap
[
index
][
2
]
);
#endif
}
else
{
#ifdef WIN32
(
void
)
sprintf_s
(
auxiliaryName
[
1
],
bufferSz
,
"N-Terminal_%s"
,
nameMap
[
index
][
0
]
);
#else
(
void
)
sprintf
(
auxiliaryName
[
1
],
"N-Terminal_%s"
,
nameMap
[
index
][
0
]
);
#endif
}
#ifdef WIN32
(
void
)
sprintf_s
(
auxiliaryName
[
0
],
bufferSz
,
"N%s"
,
nameMap
[
index
][
0
]
);
#else
(
void
)
sprintf
(
auxiliaryName
[
0
],
"N%s"
,
nameMap
[
index
][
0
]
);
#endif
(
*
residueNameMap
)[
auxiliaryName
[
0
]]
=
auxiliaryName
[
1
];
#ifdef WIN32
(
void
)
sprintf_s
(
auxiliaryName
[
1
],
bufferSz
,
"C-Terminal_%s"
,
nameMap
[
index
][
0
]
);
(
void
)
sprintf_s
(
auxiliaryName
[
0
],
bufferSz
,
"C%s"
,
nameMap
[
index
][
0
]
);
#else
(
void
)
sprintf
(
auxiliaryName
[
1
],
"C-Terminal_%s"
,
nameMap
[
index
][
0
]
);
(
void
)
sprintf
(
auxiliaryName
[
0
],
"C%s"
,
nameMap
[
index
][
0
]
);
#endif
(
*
residueNameMap
)[
auxiliaryName
[
0
]]
=
auxiliaryName
[
1
];
index
++
;
}
}
return
residueNameMap
;
}
/**---------------------------------------------------------------------------------------
Get residue name map ( Gromacs -> Tinker ) string (Simbios)
@return string containing contents of residue map
--------------------------------------------------------------------------------------- */
std
::
string
SimTKOpenMMGromacsUtilities
::
getTinkerGromacsResidueNameMapString
(
void
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMGromacsUtilities::getTinkerGromacsResidueNameMapString";
// ---------------------------------------------------------------------------------------
std
::
stringstream
message
;
StringMap
*
residueNameMap
=
SimTKOpenMMGromacsUtilities
::
getTinkerGromacsResidueNameMap
();
message
<<
std
::
endl
;
message
<<
"ResidueNameMap"
<<
std
::
endl
;
int
count
=
1
;
for
(
StringMapCI
ii
=
residueNameMap
->
begin
();
ii
!=
residueNameMap
->
end
();
ii
++
){
message
<<
count
++
<<
" <"
;
message
<<
(
*
ii
).
first
.
c_str
()
<<
"> <"
;
message
<<
(
*
ii
).
second
.
c_str
()
<<
">"
;
message
<<
std
::
endl
;
}
return
message
.
str
();
}
/**---------------------------------------------------------------------------------------
Get Tinker residue/atom name -> biotype map (Simbios)
The hash map is implemented as singleton
@param forceField forceFileIndex
@return StringIntMap mapping Tinker residue_atomName -> Tinker biotype
--------------------------------------------------------------------------------------- */
StringIntMap
*
SimTKOpenMMGromacsUtilities
::
getTinkerResidueAtomNameBiotypeMap
(
int
forceField
=
0
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMGromacsUtilities::getTinkerResidueAtomNameBiotypeMap";
// entries for map generated by TinkerBiotypeParameterSet::getResidueAtomMapBiotypeString()
// in TinkerParameters::_readFile()
static
char
*
amoebaNameMap
[][
2
]
=
{
{
"AMOEBA_Water_H"
,
"203"
},
{
"AMOEBA_Water_O"
,
"202"
},
{
"Acetyl_N-Terminus_C"
,
"182"
},
{
"Acetyl_N-Terminus_CH3"
,
"180"
},
{
"Acetyl_N-Terminus_H"
,
"181"
},
{
"Acetyl_N-Terminus_O"
,
"183"
},
{
"Alanine_C"
,
"9"
},
{
"Alanine_CA"
,
"8"
},
{
"Alanine_CB"
,
"13"
},
{
"Alanine_HA"
,
"12"
},
{
"Alanine_HB"
,
"14"
},
{
"Alanine_HN"
,
"10"
},
{
"Alanine_N"
,
"7"
},
{
"Alanine_O"
,
"11"
},
{
"Amide_C-Terminus_HN"
,
"185"
},
{
"Amide_C-Terminus_N"
,
"184"
},
{
"Arginine_C"
,
"9"
},
{
"Arginine_CA"
,
"8"
},
{
"Arginine_CB"
,
"169"
},
{
"Arginine_CD"
,
"173"
},
{
"Arginine_CG"
,
"171"
},
{
"Arginine_CZ"
,
"177"
},
{
"Arginine_HA"
,
"12"
},
{
"Arginine_HB"
,
"170"
},
{
"Arginine_HD"
,
"174"
},
{
"Arginine_HE"
,
"176"
},
{
"Arginine_HG"
,
"172"
},
{
"Arginine_HH"
,
"179"
},
{
"Arginine_HN"
,
"10"
},
{
"Arginine_N"
,
"7"
},
{
"Arginine_NE"
,
"175"
},
{
"Arginine_NH"
,
"178"
},
{
"Arginine_O"
,
"11"
},
{
"Asparagine_C"
,
"9"
},
{
"Asparagine_CA"
,
"8"
},
{
"Asparagine_CB"
,
"138"
},
{
"Asparagine_CG"
,
"140"
},
{
"Asparagine_HA"
,
"12"
},
{
"Asparagine_HB"
,
"139"
},
{
"Asparagine_HD2"
,
"143"
},
{
"Asparagine_HN"
,
"10"
},
{
"Asparagine_N"
,
"7"
},
{
"Asparagine_ND2"
,
"142"
},
{
"Asparagine_O"
,
"11"
},
{
"Asparagine_OD1"
,
"141"
},
{
"Aspartic_Acid_C"
,
"9"
},
{
"Aspartic_Acid_CA"
,
"8"
},
{
"Aspartic_Acid_CB"
,
"128"
},
{
"Aspartic_Acid_CG"
,
"130"
},
{
"Aspartic_Acid_HA"
,
"12"
},
{
"Aspartic_Acid_HB"
,
"129"
},
{
"Aspartic_Acid_HN"
,
"10"
},
{
"Aspartic_Acid_N"
,
"7"
},
{
"Aspartic_Acid_O"
,
"11"
},
{
"Aspartic_Acid_OD"
,
"131"
},
{
"C-Terminal_AIB_C"
,
"999"
},
{
"C-Terminal_AIB_CA"
,
"999"
},
{
"C-Terminal_AIB_HN"
,
"999"
},
{
"C-Terminal_AIB_N"
,
"999"
},
{
"C-Terminal_AIB_OXT"
,
"999"
},
{
"C-Terminal_ALA_C"
,
"192"
},
{
"C-Terminal_ALA_CA"
,
"8"
},
{
"C-Terminal_ALA_HA"
,
"12"
},
{
"C-Terminal_ALA_HN"
,
"10"
},
{
"C-Terminal_ALA_N"
,
"7"
},
{
"C-Terminal_ALA_OXT"
,
"193"
},
{
"C-Terminal_ARG_C"
,
"192"
},
{
"C-Terminal_ARG_CA"
,
"8"
},
{
"C-Terminal_ARG_HA"
,
"12"
},
{
"C-Terminal_ARG_HN"
,
"10"
},
{
"C-Terminal_ARG_N"
,
"7"
},
{
"C-Terminal_ARG_OXT"
,
"193"
},
{
"C-Terminal_ASN_C"
,
"192"
},
{
"C-Terminal_ASN_CA"
,
"8"
},
{
"C-Terminal_ASN_HA"
,
"12"
},
{
"C-Terminal_ASN_HN"
,
"10"
},
{
"C-Terminal_ASN_N"
,
"7"
},
{
"C-Terminal_ASN_OXT"
,
"193"
},
{
"C-Terminal_ASP_C"
,
"192"
},
{
"C-Terminal_ASP_CA"
,
"8"
},
{
"C-Terminal_ASP_HA"
,
"12"
},
{
"C-Terminal_ASP_HN"
,
"10"
},
{
"C-Terminal_ASP_N"
,
"7"
},
{
"C-Terminal_ASP_OXT"
,
"193"
},
{
"C-Terminal_CYS_(-SH)_C"
,
"192"
},
{
"C-Terminal_CYS_(-SH)_CA"
,
"44"
},
{
"C-Terminal_CYS_(-SH)_HA"
,
"12"
},
{
"C-Terminal_CYS_(-SH)_HN"
,
"10"
},
{
"C-Terminal_CYS_(-SH)_N"
,
"7"
},
{
"C-Terminal_CYS_(-SH)_OXT"
,
"193"
},
{
"C-Terminal_CYS_(-SS)_C"
,
"192"
},
{
"C-Terminal_CYS_(-SS)_CA"
,
"44"
},
{
"C-Terminal_CYS_(-SS)_HA"
,
"12"
},
{
"C-Terminal_CYS_(-SS)_HN"
,
"10"
},
{
"C-Terminal_CYS_(-SS)_N"
,
"7"
},
{
"C-Terminal_CYS_(-SS)_OXT"
,
"193"
},
{
"C-Terminal_GLN_C"
,
"192"
},
{
"C-Terminal_GLN_CA"
,
"8"
},
{
"C-Terminal_GLN_HA"
,
"12"
},
{
"C-Terminal_GLN_HN"
,
"10"
},
{
"C-Terminal_GLN_N"
,
"7"
},
{
"C-Terminal_GLN_OXT"
,
"193"
},
{
"C-Terminal_GLU_C"
,
"192"
},
{
"C-Terminal_GLU_CA"
,
"8"
},
{
"C-Terminal_GLU_HA"
,
"12"
},
{
"C-Terminal_GLU_HN"
,
"10"
},
{
"C-Terminal_GLU_N"
,
"7"
},
{
"C-Terminal_GLU_OXT"
,
"193"
},
{
"C-Terminal_GLY_C"
,
"192"
},
{
"C-Terminal_GLY_CA"
,
"2"
},
{
"C-Terminal_GLY_HA"
,
"6"
},
{
"C-Terminal_GLY_HN"
,
"4"
},
{
"C-Terminal_GLY_N"
,
"1"
},
{
"C-Terminal_GLY_OXT"
,
"193"
},
{
"C-Terminal_HIS_(+)_C"
,
"192"
},
{
"C-Terminal_HIS_(+)_CA"
,
"8"
},
{
"C-Terminal_HIS_(+)_HA"
,
"12"
},
{
"C-Terminal_HIS_(+)_HN"
,
"10"
},
{
"C-Terminal_HIS_(+)_N"
,
"7"
},
{
"C-Terminal_HIS_(+)_OXT"
,
"193"
},
{
"C-Terminal_HIS_(HD)_C"
,
"192"
},
{
"C-Terminal_HIS_(HD)_CA"
,
"8"
},
{
"C-Terminal_HIS_(HD)_HA"
,
"12"
},
{
"C-Terminal_HIS_(HD)_HN"
,
"10"
},
{
"C-Terminal_HIS_(HD)_N"
,
"7"
},
{
"C-Terminal_HIS_(HD)_OXT"
,
"193"
},
{
"C-Terminal_HIS_(HE)_C"
,
"192"
},
{
"C-Terminal_HIS_(HE)_CA"
,
"8"
},
{
"C-Terminal_HIS_(HE)_HA"
,
"12"
},
{
"C-Terminal_HIS_(HE)_HN"
,
"10"
},
{
"C-Terminal_HIS_(HE)_N"
,
"7"
},
{
"C-Terminal_HIS_(HE)_OXT"
,
"193"
},
{
"C-Terminal_ILE_C"
,
"192"
},
{
"C-Terminal_ILE_CA"
,
"8"
},
{
"C-Terminal_ILE_HA"
,
"12"
},
{
"C-Terminal_ILE_HN"
,
"10"
},
{
"C-Terminal_ILE_N"
,
"7"
},
{
"C-Terminal_ILE_OXT"
,
"193"
},
{
"C-Terminal_LEU_C"
,
"192"
},
{
"C-Terminal_LEU_CA"
,
"8"
},
{
"C-Terminal_LEU_HA"
,
"12"
},
{
"C-Terminal_LEU_HN"
,
"10"
},
{
"C-Terminal_LEU_N"
,
"7"
},
{
"C-Terminal_LEU_OXT"
,
"193"
},
{
"C-Terminal_LYS_C"
,
"192"
},
{
"C-Terminal_LYS_CA"
,
"8"
},
{
"C-Terminal_LYS_HA"
,
"12"
},
{
"C-Terminal_LYS_HN"
,
"10"
},
{
"C-Terminal_LYS_N"
,
"7"
},
{
"C-Terminal_LYS_OXT"
,
"193"
},
{
"C-Terminal_MET_C"
,
"192"
},
{
"C-Terminal_MET_CA"
,
"8"
},
{
"C-Terminal_MET_HA"
,
"12"
},
{
"C-Terminal_MET_HN"
,
"10"
},
{
"C-Terminal_MET_N"
,
"7"
},
{
"C-Terminal_MET_OXT"
,
"193"
},
{
"C-Terminal_ORN_C"
,
"999"
},
{
"C-Terminal_ORN_CA"
,
"999"
},
{
"C-Terminal_ORN_HA"
,
"999"
},
{
"C-Terminal_ORN_HN"
,
"999"
},
{
"C-Terminal_ORN_N"
,
"999"
},
{
"C-Terminal_ORN_OXT"
,
"999"
},
{
"C-Terminal_PHE_C"
,
"192"
},
{
"C-Terminal_PHE_CA"
,
"8"
},
{
"C-Terminal_PHE_HA"
,
"12"
},
{
"C-Terminal_PHE_HN"
,
"10"
},
{
"C-Terminal_PHE_N"
,
"7"
},
{
"C-Terminal_PHE_OXT"
,
"193"
},
{
"C-Terminal_PRO_C"
,
"192"
},
{
"C-Terminal_PRO_CA"
,
"51"
},
{
"C-Terminal_PRO_HA"
,
"54"
},
{
"C-Terminal_PRO_N"
,
"50"
},
{
"C-Terminal_PRO_OXT"
,
"193"
},
{
"C-Terminal_SER_C"
,
"192"
},
{
"C-Terminal_SER_CA"
,
"33"
},
{
"C-Terminal_SER_HA"
,
"12"
},
{
"C-Terminal_SER_HN"
,
"10"
},
{
"C-Terminal_SER_N"
,
"7"
},
{
"C-Terminal_SER_OXT"
,
"193"
},
{
"C-Terminal_THR_C"
,
"192"
},
{
"C-Terminal_THR_CA"
,
"33"
},
{
"C-Terminal_THR_HA"
,
"12"
},
{
"C-Terminal_THR_HN"
,
"10"
},
{
"C-Terminal_THR_N"
,
"7"
},
{
"C-Terminal_THR_OXT"
,
"193"
},
{
"C-Terminal_TRP_C"
,
"192"
},
{
"C-Terminal_TRP_CA"
,
"8"
},
{
"C-Terminal_TRP_HA"
,
"12"
},
{
"C-Terminal_TRP_HN"
,
"10"
},
{
"C-Terminal_TRP_N"
,
"7"
},
{
"C-Terminal_TRP_OXT"
,
"193"
},
{
"C-Terminal_TYR_C"
,
"192"
},
{
"C-Terminal_TYR_CA"
,
"8"
},
{
"C-Terminal_TYR_HA"
,
"12"
},
{
"C-Terminal_TYR_HN"
,
"10"
},
{
"C-Terminal_TYR_N"
,
"7"
},
{
"C-Terminal_TYR_OXT"
,
"193"
},
{
"C-Terminal_VAL_C"
,
"192"
},
{
"C-Terminal_VAL_CA"
,
"8"
},
{
"C-Terminal_VAL_HA"
,
"12"
},
{
"C-Terminal_VAL_HN"
,
"10"
},
{
"C-Terminal_VAL_N"
,
"7"
},
{
"C-Terminal_VAL_OXT"
,
"193"
},
{
"Cysteine_(-SH)_C"
,
"9"
},
{
"Cysteine_(-SH)_CA"
,
"44"
},
{
"Cysteine_(-SH)_CB"
,
"45"
},
{
"Cysteine_(-SH)_HA"
,
"12"
},
{
"Cysteine_(-SH)_HB"
,
"46"
},
{
"Cysteine_(-SH)_HG"
,
"48"
},
{
"Cysteine_(-SH)_HN"
,
"10"
},
{
"Cysteine_(-SH)_N"
,
"7"
},
{
"Cysteine_(-SH)_O"
,
"11"
},
{
"Cysteine_(-SH)_SG"
,
"47"
},
{
"Cystine_(-SS-)_C"
,
"9"
},
{
"Cystine_(-SS-)_CA"
,
"44"
},
{
"Cystine_(-SS-)_CB"
,
"45"
},
{
"Cystine_(-SS-)_HA"
,
"12"
},
{
"Cystine_(-SS-)_HB"
,
"46"
},
{
"Cystine_(-SS-)_HN"
,
"10"
},
{
"Cystine_(-SS-)_N"
,
"7"
},
{
"Cystine_(-SS-)_O"
,
"11"
},
{
"Cystine_(-SS-)_SG"
,
"49"
},
{
"Formyl_N-Terminus_C"
,
"999"
},
{
"Formyl_N-Terminus_H"
,
"999"
},
{
"Formyl_N-Terminus_O"
,
"999"
},
{
"Glutamic_Acid_C"
,
"9"
},
{
"Glutamic_Acid_CA"
,
"8"
},
{
"Glutamic_Acid_CB"
,
"144"
},
{
"Glutamic_Acid_CD"
,
"148"
},
{
"Glutamic_Acid_CG"
,
"146"
},
{
"Glutamic_Acid_HA"
,
"12"
},
{
"Glutamic_Acid_HB"
,
"145"
},
{
"Glutamic_Acid_HG"
,
"147"
},
{
"Glutamic_Acid_HN"
,
"10"
},
{
"Glutamic_Acid_N"
,
"7"
},
{
"Glutamic_Acid_O"
,
"11"
},
{
"Glutamic_Acid_OE"
,
"149"
},
{
"Glutamine_C"
,
"9"
},
{
"Glutamine_CA"
,
"8"
},
{
"Glutamine_CB"
,
"150"
},
{
"Glutamine_CD"
,
"140"
},
{
"Glutamine_CG"
,
"138"
},
{
"Glutamine_HA"
,
"12"
},
{
"Glutamine_HB"
,
"151"
},
{
"Glutamine_HE2"
,
"143"
},
{
"Glutamine_HG"
,
"139"
},
{
"Glutamine_HN"
,
"10"
},
{
"Glutamine_N"
,
"7"
},
{
"Glutamine_NE2"
,
"142"
},
{
"Glutamine_O"
,
"11"
},
{
"Glutamine_OE1"
,
"141"
},
{
"Glycine_C"
,
"3"
},
{
"Glycine_CA"
,
"2"
},
{
"Glycine_HA"
,
"6"
},
{
"Glycine_HN"
,
"4"
},
{
"Glycine_N"
,
"1"
},
{
"Glycine_O"
,
"5"
},
{
"Histidine_(+)_C"
,
"9"
},
{
"Histidine_(+)_CA"
,
"8"
},
{
"Histidine_(+)_CB"
,
"97"
},
{
"Histidine_(+)_CD2"
,
"102"
},
{
"Histidine_(+)_CE1"
,
"104"
},
{
"Histidine_(+)_CG"
,
"99"
},
{
"Histidine_(+)_HA"
,
"12"
},
{
"Histidine_(+)_HB"
,
"98"
},
{
"Histidine_(+)_HD1"
,
"101"
},
{
"Histidine_(+)_HD2"
,
"103"
},
{
"Histidine_(+)_HE1"
,
"105"
},
{
"Histidine_(+)_HE2"
,
"107"
},
{
"Histidine_(+)_HN"
,
"10"
},
{
"Histidine_(+)_N"
,
"7"
},
{
"Histidine_(+)_ND1"
,
"100"
},
{
"Histidine_(+)_NE2"
,
"106"
},
{
"Histidine_(+)_O"
,
"11"
},
{
"Histidine_(HD)_C"
,
"9"
},
{
"Histidine_(HD)_CA"
,
"8"
},
{
"Histidine_(HD)_CB"
,
"108"
},
{
"Histidine_(HD)_CD2"
,
"113"
},
{
"Histidine_(HD)_CE1"
,
"115"
},
{
"Histidine_(HD)_CG"
,
"110"
},
{
"Histidine_(HD)_HA"
,
"12"
},
{
"Histidine_(HD)_HB"
,
"109"
},
{
"Histidine_(HD)_HD1"
,
"112"
},
{
"Histidine_(HD)_HD2"
,
"114"
},
{
"Histidine_(HD)_HE1"
,
"116"
},
{
"Histidine_(HD)_HN"
,
"10"
},
{
"Histidine_(HD)_N"
,
"7"
},
{
"Histidine_(HD)_ND1"
,
"111"
},
{
"Histidine_(HD)_NE2"
,
"117"
},
{
"Histidine_(HD)_O"
,
"11"
},
{
"Histidine_(HE)_C"
,
"9"
},
{
"Histidine_(HE)_CA"
,
"8"
},
{
"Histidine_(HE)_CB"
,
"118"
},
{
"Histidine_(HE)_CD2"
,
"122"
},
{
"Histidine_(HE)_CE1"
,
"124"
},
{
"Histidine_(HE)_CG"
,
"120"
},
{
"Histidine_(HE)_HA"
,
"12"
},
{
"Histidine_(HE)_HB"
,
"119"
},
{
"Histidine_(HE)_HD2"
,
"123"
},
{
"Histidine_(HE)_HE1"
,
"125"
},
{
"Histidine_(HE)_HE2"
,
"127"
},
{
"Histidine_(HE)_HN"
,
"10"
},
{
"Histidine_(HE)_N"
,
"7"
},
{
"Histidine_(HE)_ND1"
,
"121"
},
{
"Histidine_(HE)_NE2"
,
"126"
},
{
"Histidine_(HE)_O"
,
"11"
},
{
"Isoleucine_C"
,
"9"
},
{
"Isoleucine_CA"
,
"8"
},
{
"Isoleucine_CB"
,
"25"
},
{
"Isoleucine_CD"
,
"31"
},
{
"Isoleucine_CG1"
,
"29"
},
{
"Isoleucine_CG2"
,
"27"
},
{
"Isoleucine_HA"
,
"12"
},
{
"Isoleucine_HB"
,
"26"
},
{
"Isoleucine_HD"
,
"32"
},
{
"Isoleucine_HG1"
,
"30"
},
{
"Isoleucine_HG2"
,
"28"
},
{
"Isoleucine_HN"
,
"10"
},
{
"Isoleucine_N"
,
"7"
},
{
"Isoleucine_O"
,
"11"
},
{
"Leucine_C"
,
"9"
},
{
"Leucine_CA"
,
"8"
},
{
"Leucine_CB"
,
"19"
},
{
"Leucine_CD1"
,
"23"
},
{
"Leucine_CD2"
,
"23"
},
{
"Leucine_CG"
,
"21"
},
{
"Leucine_HA"
,
"12"
},
{
"Leucine_HB"
,
"20"
},
{
"Leucine_HD1"
,
"24"
},
{
"Leucine_HD2"
,
"24"
},
{
"Leucine_HG"
,
"22"
},
{
"Leucine_HN"
,
"10"
},
{
"Leucine_N"
,
"7"
},
{
"Leucine_O"
,
"11"
},
{
"Lysine_C"
,
"9"
},
{
"Lysine_CA"
,
"8"
},
{
"Lysine_CB"
,
"159"
},
{
"Lysine_CD"
,
"163"
},
{
"Lysine_CE"
,
"165"
},
{
"Lysine_CG"
,
"161"
},
{
"Lysine_HA"
,
"12"
},
{
"Lysine_HB"
,
"160"
},
{
"Lysine_HD"
,
"164"
},
{
"Lysine_HE"
,
"166"
},
{
"Lysine_HG"
,
"162"
},
{
"Lysine_HN"
,
"10"
},
{
"Lysine_HZ"
,
"168"
},
{
"Lysine_N"
,
"7"
},
{
"Lysine_NZ"
,
"167"
},
{
"Lysine_O"
,
"11"
},
{
"Methionine_C"
,
"9"
},
{
"Methionine_CA"
,
"8"
},
{
"Methionine_CB"
,
"152"
},
{
"Methionine_CE"
,
"157"
},
{
"Methionine_CG"
,
"154"
},
{
"Methionine_HA"
,
"12"
},
{
"Methionine_HB"
,
"153"
},
{
"Methionine_HE"
,
"158"
},
{
"Methionine_HG"
,
"155"
},
{
"Methionine_HN"
,
"10"
},
{
"Methionine_N"
,
"7"
},
{
"Methionine_O"
,
"11"
},
{
"Methionine_SD"
,
"156"
},
{
"MethylAlanine_(AIB)_C"
,
"999"
},
{
"MethylAlanine_(AIB)_CA"
,
"999"
},
{
"MethylAlanine_(AIB)_CB"
,
"999"
},
{
"MethylAlanine_(AIB)_HB"
,
"999"
},
{
"MethylAlanine_(AIB)_HN"
,
"999"
},
{
"MethylAlanine_(AIB)_N"
,
"999"
},
{
"MethylAlanine_(AIB)_O"
,
"999"
},
{
"N-MeAmide_C-Terminus_CH3"
,
"188"
},
{
"N-MeAmide_C-Terminus_H"
,
"189"
},
{
"N-MeAmide_C-Terminus_HN"
,
"187"
},
{
"N-MeAmide_C-Terminus_N"
,
"186"
},
{
"N-Terminal_AIB_C"
,
"999"
},
{
"N-Terminal_AIB_CA"
,
"999"
},
{
"N-Terminal_AIB_HN"
,
"999"
},
{
"N-Terminal_AIB_N"
,
"999"
},
{
"N-Terminal_AIB_O"
,
"999"
},
{
"N-Terminal_ALA_C"
,
"9"
},
{
"N-Terminal_ALA_CA"
,
"8"
},
{
"N-Terminal_ALA_HA"
,
"12"
},
{
"N-Terminal_ALA_HN"
,
"191"
},
{
"N-Terminal_ALA_N"
,
"190"
},
{
"N-Terminal_ALA_O"
,
"11"
},
{
"N-Terminal_ARG_C"
,
"9"
},
{
"N-Terminal_ARG_CA"
,
"8"
},
{
"N-Terminal_ARG_HA"
,
"12"
},
{
"N-Terminal_ARG_HN"
,
"191"
},
{
"N-Terminal_ARG_N"
,
"190"
},
{
"N-Terminal_ARG_O"
,
"11"
},
{
"N-Terminal_ASN_C"
,
"9"
},
{
"N-Terminal_ASN_CA"
,
"8"
},
{
"N-Terminal_ASN_HA"
,
"12"
},
{
"N-Terminal_ASN_HN"
,
"191"
},
{
"N-Terminal_ASN_N"
,
"190"
},
{
"N-Terminal_ASN_O"
,
"11"
},
{
"N-Terminal_ASP_C"
,
"9"
},
{
"N-Terminal_ASP_CA"
,
"8"
},
{
"N-Terminal_ASP_HA"
,
"12"
},
{
"N-Terminal_ASP_HN"
,
"191"
},
{
"N-Terminal_ASP_N"
,
"190"
},
{
"N-Terminal_ASP_O"
,
"11"
},
{
"N-Terminal_CYS_(-SH)_C"
,
"9"
},
{
"N-Terminal_CYS_(-SH)_CA"
,
"44"
},
{
"N-Terminal_CYS_(-SH)_HA"
,
"12"
},
{
"N-Terminal_CYS_(-SH)_HN"
,
"191"
},
{
"N-Terminal_CYS_(-SH)_N"
,
"190"
},
{
"N-Terminal_CYS_(-SH)_O"
,
"11"
},
{
"N-Terminal_CYS_(-SS)_C"
,
"9"
},
{
"N-Terminal_CYS_(-SS)_CA"
,
"44"
},
{
"N-Terminal_CYS_(-SS)_HA"
,
"12"
},
{
"N-Terminal_CYS_(-SS)_HN"
,
"191"
},
{
"N-Terminal_CYS_(-SS)_N"
,
"190"
},
{
"N-Terminal_CYS_(-SS)_O"
,
"11"
},
{
"N-Terminal_GLN_C"
,
"9"
},
{
"N-Terminal_GLN_CA"
,
"8"
},
{
"N-Terminal_GLN_HA"
,
"12"
},
{
"N-Terminal_GLN_HN"
,
"191"
},
{
"N-Terminal_GLN_N"
,
"190"
},
{
"N-Terminal_GLN_O"
,
"11"
},
{
"N-Terminal_GLU_C"
,
"9"
},
{
"N-Terminal_GLU_CA"
,
"8"
},
{
"N-Terminal_GLU_HA"
,
"12"
},
{
"N-Terminal_GLU_HN"
,
"191"
},
{
"N-Terminal_GLU_N"
,
"190"
},
{
"N-Terminal_GLU_O"
,
"11"
},
{
"N-Terminal_GLY_C"
,
"3"
},
{
"N-Terminal_GLY_CA"
,
"2"
},
{
"N-Terminal_GLY_HA"
,
"6"
},
{
"N-Terminal_GLY_HN"
,
"191"
},
{
"N-Terminal_GLY_N"
,
"190"
},
{
"N-Terminal_GLY_O"
,
"5"
},
{
"N-Terminal_HIS_(+)_C"
,
"9"
},
{
"N-Terminal_HIS_(+)_CA"
,
"8"
},
{
"N-Terminal_HIS_(+)_HA"
,
"12"
},
{
"N-Terminal_HIS_(+)_HN"
,
"191"
},
{
"N-Terminal_HIS_(+)_N"
,
"190"
},
{
"N-Terminal_HIS_(+)_O"
,
"11"
},
{
"N-Terminal_HIS_(HD)_C"
,
"9"
},
{
"N-Terminal_HIS_(HD)_CA"
,
"8"
},
{
"N-Terminal_HIS_(HD)_HA"
,
"12"
},
{
"N-Terminal_HIS_(HD)_HN"
,
"191"
},
{
"N-Terminal_HIS_(HD)_N"
,
"190"
},
{
"N-Terminal_HIS_(HD)_O"
,
"11"
},
{
"N-Terminal_HIS_(HE)_C"
,
"9"
},
{
"N-Terminal_HIS_(HE)_CA"
,
"8"
},
{
"N-Terminal_HIS_(HE)_HA"
,
"12"
},
{
"N-Terminal_HIS_(HE)_HN"
,
"191"
},
{
"N-Terminal_HIS_(HE)_N"
,
"190"
},
{
"N-Terminal_HIS_(HE)_O"
,
"11"
},
{
"N-Terminal_ILE_C"
,
"9"
},
{
"N-Terminal_ILE_CA"
,
"8"
},
{
"N-Terminal_ILE_HA"
,
"12"
},
{
"N-Terminal_ILE_HN"
,
"191"
},
{
"N-Terminal_ILE_N"
,
"190"
},
{
"N-Terminal_ILE_O"
,
"11"
},
{
"N-Terminal_LEU_C"
,
"9"
},
{
"N-Terminal_LEU_CA"
,
"8"
},
{
"N-Terminal_LEU_HA"
,
"12"
},
{
"N-Terminal_LEU_HN"
,
"191"
},
{
"N-Terminal_LEU_N"
,
"190"
},
{
"N-Terminal_LEU_O"
,
"11"
},
{
"N-Terminal_LYS_C"
,
"9"
},
{
"N-Terminal_LYS_CA"
,
"8"
},
{
"N-Terminal_LYS_HA"
,
"12"
},
{
"N-Terminal_LYS_HN"
,
"191"
},
{
"N-Terminal_LYS_N"
,
"190"
},
{
"N-Terminal_LYS_O"
,
"11"
},
{
"N-Terminal_MET_C"
,
"9"
},
{
"N-Terminal_MET_CA"
,
"8"
},
{
"N-Terminal_MET_HA"
,
"12"
},
{
"N-Terminal_MET_HN"
,
"191"
},
{
"N-Terminal_MET_N"
,
"190"
},
{
"N-Terminal_MET_O"
,
"11"
},
{
"N-Terminal_ORN_C"
,
"999"
},
{
"N-Terminal_ORN_CA"
,
"999"
},
{
"N-Terminal_ORN_HA"
,
"999"
},
{
"N-Terminal_ORN_HN"
,
"999"
},
{
"N-Terminal_ORN_N"
,
"999"
},
{
"N-Terminal_ORN_O"
,
"999"
},
{
"N-Terminal_PHE_C"
,
"9"
},
{
"N-Terminal_PHE_CA"
,
"8"
},
{
"N-Terminal_PHE_HA"
,
"12"
},
{
"N-Terminal_PHE_HN"
,
"191"
},
{
"N-Terminal_PHE_N"
,
"190"
},
{
"N-Terminal_PHE_O"
,
"11"
},
{
"N-Terminal_PRO_C"
,
"197"
},
{
"N-Terminal_PRO_CA"
,
"196"
},
{
"N-Terminal_PRO_CD"
,
"200"
},
{
"N-Terminal_PRO_HA"
,
"199"
},
{
"N-Terminal_PRO_HD"
,
"201"
},
{
"N-Terminal_PRO_HN"
,
"195"
},
{
"N-Terminal_PRO_N"
,
"194"
},
{
"N-Terminal_PRO_O"
,
"198"
},
{
"N-Terminal_SER_C"
,
"9"
},
{
"N-Terminal_SER_CA"
,
"33"
},
{
"N-Terminal_SER_HA"
,
"12"
},
{
"N-Terminal_SER_HN"
,
"191"
},
{
"N-Terminal_SER_N"
,
"190"
},
{
"N-Terminal_SER_O"
,
"11"
},
{
"N-Terminal_THR_C"
,
"9"
},
{
"N-Terminal_THR_CA"
,
"33"
},
{
"N-Terminal_THR_HA"
,
"12"
},
{
"N-Terminal_THR_HN"
,
"191"
},
{
"N-Terminal_THR_N"
,
"190"
},
{
"N-Terminal_THR_O"
,
"11"
},
{
"N-Terminal_TRP_C"
,
"9"
},
{
"N-Terminal_TRP_CA"
,
"8"
},
{
"N-Terminal_TRP_HA"
,
"12"
},
{
"N-Terminal_TRP_HN"
,
"191"
},
{
"N-Terminal_TRP_N"
,
"190"
},
{
"N-Terminal_TRP_O"
,
"11"
},
{
"N-Terminal_TYR_C"
,
"9"
},
{
"N-Terminal_TYR_CA"
,
"8"
},
{
"N-Terminal_TYR_HA"
,
"12"
},
{
"N-Terminal_TYR_HN"
,
"191"
},
{
"N-Terminal_TYR_N"
,
"190"
},
{
"N-Terminal_TYR_O"
,
"11"
},
{
"N-Terminal_VAL_C"
,
"9"
},
{
"N-Terminal_VAL_CA"
,
"8"
},
{
"N-Terminal_VAL_HA"
,
"12"
},
{
"N-Terminal_VAL_HN"
,
"191"
},
{
"N-Terminal_VAL_N"
,
"190"
},
{
"N-Terminal_VAL_O"
,
"11"
},
{
"Ornithine_C"
,
"999"
},
{
"Ornithine_CA"
,
"999"
},
{
"Ornithine_CB"
,
"999"
},
{
"Ornithine_CD"
,
"999"
},
{
"Ornithine_CG"
,
"999"
},
{
"Ornithine_HA"
,
"999"
},
{
"Ornithine_HB"
,
"999"
},
{
"Ornithine_HD"
,
"999"
},
{
"Ornithine_HE"
,
"999"
},
{
"Ornithine_HG"
,
"999"
},
{
"Ornithine_HN"
,
"999"
},
{
"Ornithine_N"
,
"999"
},
{
"Ornithine_NE"
,
"999"
},
{
"Ornithine_O"
,
"999"
},
{
"Phenylalanine_C"
,
"9"
},
{
"Phenylalanine_CA"
,
"8"
},
{
"Phenylalanine_CB"
,
"61"
},
{
"Phenylalanine_CD"
,
"64"
},
{
"Phenylalanine_CE"
,
"66"
},
{
"Phenylalanine_CG"
,
"63"
},
{
"Phenylalanine_CZ"
,
"68"
},
{
"Phenylalanine_HA"
,
"12"
},
{
"Phenylalanine_HB"
,
"62"
},
{
"Phenylalanine_HD"
,
"65"
},
{
"Phenylalanine_HE"
,
"67"
},
{
"Phenylalanine_HN"
,
"10"
},
{
"Phenylalanine_HZ"
,
"69"
},
{
"Phenylalanine_N"
,
"7"
},
{
"Phenylalanine_O"
,
"11"
},
{
"Proline_C"
,
"52"
},
{
"Proline_CA"
,
"51"
},
{
"Proline_CB"
,
"55"
},
{
"Proline_CD"
,
"59"
},
{
"Proline_CG"
,
"57"
},
{
"Proline_HA"
,
"54"
},
{
"Proline_HB"
,
"56"
},
{
"Proline_HD"
,
"60"
},
{
"Proline_HG"
,
"58"
},
{
"Proline_N"
,
"50"
},
{
"Proline_O"
,
"53"
},
{
"Pyroglutamic_Acid_C"
,
"999"
},
{
"Pyroglutamic_Acid_CA"
,
"999"
},
{
"Pyroglutamic_Acid_CB"
,
"999"
},
{
"Pyroglutamic_Acid_CD"
,
"999"
},
{
"Pyroglutamic_Acid_CG"
,
"999"
},
{
"Pyroglutamic_Acid_HA"
,
"999"
},
{
"Pyroglutamic_Acid_HB"
,
"999"
},
{
"Pyroglutamic_Acid_HG"
,
"999"
},
{
"Pyroglutamic_Acid_HN"
,
"999"
},
{
"Pyroglutamic_Acid_N"
,
"999"
},
{
"Pyroglutamic_Acid_O"
,
"999"
},
{
"Pyroglutamic_Acid_OE"
,
"999"
},
{
"Serine_C"
,
"9"
},
{
"Serine_CA"
,
"33"
},
{
"Serine_CB"
,
"34"
},
{
"Serine_HA"
,
"12"
},
{
"Serine_HB"
,
"35"
},
{
"Serine_HG"
,
"37"
},
{
"Serine_HN"
,
"10"
},
{
"Serine_N"
,
"7"
},
{
"Serine_O"
,
"11"
},
{
"Serine_OG"
,
"36"
},
{
"Threonine_C"
,
"9"
},
{
"Threonine_CA"
,
"33"
},
{
"Threonine_CB"
,
"38"
},
{
"Threonine_CG2"
,
"40"
},
{
"Threonine_HA"
,
"12"
},
{
"Threonine_HB"
,
"39"
},
{
"Threonine_HG1"
,
"43"
},
{
"Threonine_HG2"
,
"41"
},
{
"Threonine_HN"
,
"10"
},
{
"Threonine_N"
,
"7"
},
{
"Threonine_O"
,
"11"
},
{
"Threonine_OG1"
,
"42"
},
{
"Tryptophan_C"
,
"9"
},
{
"Tryptophan_CA"
,
"8"
},
{
"Tryptophan_CB"
,
"80"
},
{
"Tryptophan_CD1"
,
"83"
},
{
"Tryptophan_CD2"
,
"85"
},
{
"Tryptophan_CE2"
,
"88"
},
{
"Tryptophan_CE3"
,
"89"
},
{
"Tryptophan_CG"
,
"82"
},
{
"Tryptophan_CH2"
,
"95"
},
{
"Tryptophan_CZ2"
,
"91"
},
{
"Tryptophan_CZ3"
,
"93"
},
{
"Tryptophan_HA"
,
"12"
},
{
"Tryptophan_HB"
,
"81"
},
{
"Tryptophan_HD1"
,
"84"
},
{
"Tryptophan_HE1"
,
"87"
},
{
"Tryptophan_HE3"
,
"90"
},
{
"Tryptophan_HH2"
,
"96"
},
{
"Tryptophan_HN"
,
"10"
},
{
"Tryptophan_HZ2"
,
"92"
},
{
"Tryptophan_HZ3"
,
"94"
},
{
"Tryptophan_N"
,
"7"
},
{
"Tryptophan_NE1"
,
"86"
},
{
"Tryptophan_O"
,
"11"
},
{
"Tyrosine_C"
,
"9"
},
{
"Tyrosine_CA"
,
"8"
},
{
"Tyrosine_CB"
,
"70"
},
{
"Tyrosine_CD"
,
"73"
},
{
"Tyrosine_CE"
,
"75"
},
{
"Tyrosine_CG"
,
"72"
},
{
"Tyrosine_CZ"
,
"77"
},
{
"Tyrosine_HA"
,
"12"
},
{
"Tyrosine_HB"
,
"71"
},
{
"Tyrosine_HD"
,
"74"
},
{
"Tyrosine_HE"
,
"76"
},
{
"Tyrosine_HH"
,
"79"
},
{
"Tyrosine_HN"
,
"10"
},
{
"Tyrosine_N"
,
"7"
},
{
"Tyrosine_O"
,
"11"
},
{
"Tyrosine_OH"
,
"78"
},
{
"Valine_C"
,
"9"
},
{
"Valine_CA"
,
"8"
},
{
"Valine_CB"
,
"15"
},
{
"Valine_CG1"
,
"17"
},
{
"Valine_CG2"
,
"17"
},
{
"Valine_HA"
,
"12"
},
{
"Valine_HB"
,
"16"
},
{
"Valine_HG1"
,
"18"
},
{
"Valine_HG2"
,
"18"
},
{
"Valine_HN"
,
"10"
},
{
"Valine_N"
,
"7"
},
{
"Valine_O"
,
"11"
},
{
NULL
,
NULL
}
};
static
char
*
amberNameMap
[][
2
]
=
{
{
"Glycine_N"
,
"1"
},
{
"Glycine_CA"
,
"2"
},
{
"Glycine_C"
,
"3"
},
{
"Glycine_HN"
,
"4"
},
{
"Glycine_O"
,
"5"
},
{
"Glycine_HA"
,
"6"
},
{
"Alanine_N"
,
"7"
},
{
"Alanine_CA"
,
"8"
},
{
"Alanine_C"
,
"9"
},
{
"Alanine_HN"
,
"10"
},
{
"Alanine_O"
,
"11"
},
{
"Alanine_HA"
,
"12"
},
{
"Alanine_CB"
,
"13"
},
{
"Alanine_HB"
,
"14"
},
{
"Valine_N"
,
"15"
},
{
"Valine_CA"
,
"16"
},
{
"Valine_C"
,
"17"
},
{
"Valine_HN"
,
"18"
},
{
"Valine_O"
,
"19"
},
{
"Valine_HA"
,
"20"
},
{
"Valine_CB"
,
"21"
},
{
"Valine_HB"
,
"22"
},
{
"Valine_CG1"
,
"23"
},
{
"Valine_HG1"
,
"24"
},
{
"Valine_CG2"
,
"25"
},
{
"Valine_HG2"
,
"26"
},
{
"Leucine_N"
,
"27"
},
{
"Leucine_CA"
,
"28"
},
{
"Leucine_C"
,
"29"
},
{
"Leucine_HN"
,
"30"
},
{
"Leucine_O"
,
"31"
},
{
"Leucine_HA"
,
"32"
},
{
"Leucine_CB"
,
"33"
},
{
"Leucine_HB"
,
"34"
},
{
"Leucine_CG"
,
"35"
},
{
"Leucine_HG"
,
"36"
},
{
"Leucine_CD1"
,
"37"
},
{
"Leucine_HD1"
,
"38"
},
{
"Leucine_CD2"
,
"39"
},
{
"Leucine_HD2"
,
"40"
},
{
"Isoleucine_N"
,
"41"
},
{
"Isoleucine_CA"
,
"42"
},
{
"Isoleucine_C"
,
"43"
},
{
"Isoleucine_HN"
,
"44"
},
{
"Isoleucine_O"
,
"45"
},
{
"Isoleucine_HA"
,
"46"
},
{
"Isoleucine_CB"
,
"47"
},
{
"Isoleucine_HB"
,
"48"
},
{
"Isoleucine_CG1"
,
"49"
},
{
"Isoleucine_HG1"
,
"50"
},
{
"Isoleucine_CG2"
,
"51"
},
{
"Isoleucine_HG2"
,
"52"
},
{
"Isoleucine_CD"
,
"53"
},
{
"Isoleucine_HD"
,
"54"
},
{
"Serine_N"
,
"55"
},
{
"Serine_CA"
,
"56"
},
{
"Serine_C"
,
"57"
},
{
"Serine_HN"
,
"58"
},
{
"Serine_O"
,
"59"
},
{
"Serine_HA"
,
"60"
},
{
"Serine_CB"
,
"61"
},
{
"Serine_HB"
,
"62"
},
{
"Serine_OG"
,
"63"
},
{
"Serine_HG"
,
"64"
},
{
"Threonine_N"
,
"65"
},
{
"Threonine_CA"
,
"66"
},
{
"Threonine_C"
,
"67"
},
{
"Threonine_HN"
,
"68"
},
{
"Threonine_O"
,
"69"
},
{
"Threonine_HA"
,
"70"
},
{
"Threonine_CB"
,
"71"
},
{
"Threonine_HB"
,
"72"
},
{
"Threonine_OG1"
,
"73"
},
{
"Threonine_HG1"
,
"74"
},
{
"Threonine_CG2"
,
"75"
},
{
"Threonine_HG2"
,
"76"
},
{
"Cysteine_(-SH)_N"
,
"77"
},
{
"Cysteine_(-SH)_CA"
,
"78"
},
{
"Cysteine_(-SH)_C"
,
"79"
},
{
"Cysteine_(-SH)_HN"
,
"80"
},
{
"Cysteine_(-SH)_O"
,
"81"
},
{
"Cysteine_(-SH)_HA"
,
"82"
},
{
"Cysteine_(-SH)_CB"
,
"83"
},
{
"Cysteine_(-SH)_HB"
,
"84"
},
{
"Cysteine_(-SH)_SG"
,
"85"
},
{
"Cysteine_(-SH)_HG"
,
"86"
},
{
"Cystine_(-SS-)_N"
,
"87"
},
{
"Cystine_(-SS-)_CA"
,
"88"
},
{
"Cystine_(-SS-)_C"
,
"89"
},
{
"Cystine_(-SS-)_HN"
,
"90"
},
{
"Cystine_(-SS-)_O"
,
"91"
},
{
"Cystine_(-SS-)_HA"
,
"92"
},
{
"Cystine_(-SS-)_CB"
,
"93"
},
{
"Cystine_(-SS-)_HB"
,
"94"
},
{
"Cystine_(-SS-)_SG"
,
"95"
},
{
"Proline_N"
,
"96"
},
{
"Proline_CA"
,
"97"
},
{
"Proline_C"
,
"98"
},
{
"Proline_O"
,
"99"
},
{
"Proline_HA"
,
"100"
},
{
"Proline_CB"
,
"101"
},
{
"Proline_HB"
,
"102"
},
{
"Proline_CG"
,
"103"
},
{
"Proline_HG"
,
"104"
},
{
"Proline_CD"
,
"105"
},
{
"Proline_HD"
,
"106"
},
{
"Phenylalanine_N"
,
"107"
},
{
"Phenylalanine_CA"
,
"108"
},
{
"Phenylalanine_C"
,
"109"
},
{
"Phenylalanine_HN"
,
"110"
},
{
"Phenylalanine_O"
,
"111"
},
{
"Phenylalanine_HA"
,
"112"
},
{
"Phenylalanine_CB"
,
"113"
},
{
"Phenylalanine_HB"
,
"114"
},
{
"Phenylalanine_CG"
,
"115"
},
{
"Phenylalanine_CD"
,
"116"
},
{
"Phenylalanine_HD"
,
"117"
},
{
"Phenylalanine_CE"
,
"118"
},
{
"Phenylalanine_HE"
,
"119"
},
{
"Phenylalanine_CZ"
,
"120"
},
{
"Phenylalanine_HZ"
,
"121"
},
{
"Tyrosine_N"
,
"122"
},
{
"Tyrosine_CA"
,
"123"
},
{
"Tyrosine_C"
,
"124"
},
{
"Tyrosine_HN"
,
"125"
},
{
"Tyrosine_O"
,
"126"
},
{
"Tyrosine_HA"
,
"127"
},
{
"Tyrosine_CB"
,
"128"
},
{
"Tyrosine_HB"
,
"129"
},
{
"Tyrosine_CG"
,
"130"
},
{
"Tyrosine_CD"
,
"131"
},
{
"Tyrosine_HD"
,
"132"
},
{
"Tyrosine_CE"
,
"133"
},
{
"Tyrosine_HE"
,
"134"
},
{
"Tyrosine_CZ"
,
"135"
},
{
"Tyrosine_OH"
,
"136"
},
{
"Tyrosine_HH"
,
"137"
},
{
"Tryptophan_N"
,
"138"
},
{
"Tryptophan_CA"
,
"139"
},
{
"Tryptophan_C"
,
"140"
},
{
"Tryptophan_HN"
,
"141"
},
{
"Tryptophan_O"
,
"142"
},
{
"Tryptophan_HA"
,
"143"
},
{
"Tryptophan_CB"
,
"144"
},
{
"Tryptophan_HB"
,
"145"
},
{
"Tryptophan_CG"
,
"146"
},
{
"Tryptophan_CD1"
,
"147"
},
{
"Tryptophan_HD1"
,
"148"
},
{
"Tryptophan_CD2"
,
"149"
},
{
"Tryptophan_NE1"
,
"150"
},
{
"Tryptophan_HE1"
,
"151"
},
{
"Tryptophan_CE2"
,
"152"
},
{
"Tryptophan_CE3"
,
"153"
},
{
"Tryptophan_HE3"
,
"154"
},
{
"Tryptophan_CZ2"
,
"155"
},
{
"Tryptophan_HZ2"
,
"156"
},
{
"Tryptophan_CZ3"
,
"157"
},
{
"Tryptophan_HZ3"
,
"158"
},
{
"Tryptophan_CH2"
,
"159"
},
{
"Tryptophan_HH2"
,
"160"
},
{
"Histidine_(+)_N"
,
"161"
},
{
"Histidine_(+)_CA"
,
"162"
},
{
"Histidine_(+)_C"
,
"163"
},
{
"Histidine_(+)_HN"
,
"164"
},
{
"Histidine_(+)_O"
,
"165"
},
{
"Histidine_(+)_HA"
,
"166"
},
{
"Histidine_(+)_CB"
,
"167"
},
{
"Histidine_(+)_HB"
,
"168"
},
{
"Histidine_(+)_CG"
,
"169"
},
{
"Histidine_(+)_ND1"
,
"170"
},
{
"Histidine_(+)_HD1"
,
"171"
},
{
"Histidine_(+)_CD2"
,
"172"
},
{
"Histidine_(+)_HD2"
,
"173"
},
{
"Histidine_(+)_CE1"
,
"174"
},
{
"Histidine_(+)_HE1"
,
"175"
},
{
"Histidine_(+)_NE2"
,
"176"
},
{
"Histidine_(+)_HE2"
,
"177"
},
{
"Histidine_(HD)_N"
,
"178"
},
{
"Histidine_(HD)_CA"
,
"179"
},
{
"Histidine_(HD)_C"
,
"180"
},
{
"Histidine_(HD)_HN"
,
"181"
},
{
"Histidine_(HD)_O"
,
"182"
},
{
"Histidine_(HD)_HA"
,
"183"
},
{
"Histidine_(HD)_CB"
,
"184"
},
{
"Histidine_(HD)_HB"
,
"185"
},
{
"Histidine_(HD)_CG"
,
"186"
},
{
"Histidine_(HD)_ND1"
,
"187"
},
{
"Histidine_(HD)_HD1"
,
"188"
},
{
"Histidine_(HD)_CD2"
,
"189"
},
{
"Histidine_(HD)_HD2"
,
"190"
},
{
"Histidine_(HD)_CE1"
,
"191"
},
{
"Histidine_(HD)_HE1"
,
"192"
},
{
"Histidine_(HD)_NE2"
,
"193"
},
{
"Histidine_(HE)_N"
,
"194"
},
{
"Histidine_(HE)_CA"
,
"195"
},
{
"Histidine_(HE)_C"
,
"196"
},
{
"Histidine_(HE)_HN"
,
"197"
},
{
"Histidine_(HE)_O"
,
"198"
},
{
"Histidine_(HE)_HA"
,
"199"
},
{
"Histidine_(HE)_CB"
,
"200"
},
{
"Histidine_(HE)_HB"
,
"201"
},
{
"Histidine_(HE)_CG"
,
"202"
},
{
"Histidine_(HE)_ND1"
,
"203"
},
{
"Histidine_(HE)_CD2"
,
"204"
},
{
"Histidine_(HE)_HD2"
,
"205"
},
{
"Histidine_(HE)_CE1"
,
"206"
},
{
"Histidine_(HE)_HE1"
,
"207"
},
{
"Histidine_(HE)_NE2"
,
"208"
},
{
"Histidine_(HE)_HE2"
,
"209"
},
{
"Aspartic_Acid_N"
,
"210"
},
{
"Aspartic_Acid_CA"
,
"211"
},
{
"Aspartic_Acid_C"
,
"212"
},
{
"Aspartic_Acid_HN"
,
"213"
},
{
"Aspartic_Acid_O"
,
"214"
},
{
"Aspartic_Acid_HA"
,
"215"
},
{
"Aspartic_Acid_CB"
,
"216"
},
{
"Aspartic_Acid_HB"
,
"217"
},
{
"Aspartic_Acid_CG"
,
"218"
},
{
"Aspartic_Acid_OD"
,
"219"
},
{
"Asparagine_N"
,
"220"
},
{
"Asparagine_CA"
,
"221"
},
{
"Asparagine_C"
,
"222"
},
{
"Asparagine_HN"
,
"223"
},
{
"Asparagine_O"
,
"224"
},
{
"Asparagine_HA"
,
"225"
},
{
"Asparagine_CB"
,
"226"
},
{
"Asparagine_HB"
,
"227"
},
{
"Asparagine_CG"
,
"228"
},
{
"Asparagine_OD1"
,
"229"
},
{
"Asparagine_ND2"
,
"230"
},
{
"Asparagine_HD2"
,
"231"
},
{
"Glutamic_Acid_N"
,
"232"
},
{
"Glutamic_Acid_CA"
,
"233"
},
{
"Glutamic_Acid_C"
,
"234"
},
{
"Glutamic_Acid_HN"
,
"235"
},
{
"Glutamic_Acid_O"
,
"236"
},
{
"Glutamic_Acid_HA"
,
"237"
},
{
"Glutamic_Acid_CB"
,
"238"
},
{
"Glutamic_Acid_HB"
,
"239"
},
{
"Glutamic_Acid_CG"
,
"240"
},
{
"Glutamic_Acid_HG"
,
"241"
},
{
"Glutamic_Acid_CD"
,
"242"
},
{
"Glutamic_Acid_OE"
,
"243"
},
{
"Glutamine_N"
,
"244"
},
{
"Glutamine_CA"
,
"245"
},
{
"Glutamine_C"
,
"246"
},
{
"Glutamine_HN"
,
"247"
},
{
"Glutamine_O"
,
"248"
},
{
"Glutamine_HA"
,
"249"
},
{
"Glutamine_CB"
,
"250"
},
{
"Glutamine_HB"
,
"251"
},
{
"Glutamine_CG"
,
"252"
},
{
"Glutamine_HG"
,
"253"
},
{
"Glutamine_CD"
,
"254"
},
{
"Glutamine_OE1"
,
"255"
},
{
"Glutamine_NE2"
,
"256"
},
{
"Glutamine_HE2"
,
"257"
},
{
"Methionine_N"
,
"258"
},
{
"Methionine_CA"
,
"259"
},
{
"Methionine_C"
,
"260"
},
{
"Methionine_HN"
,
"261"
},
{
"Methionine_O"
,
"262"
},
{
"Methionine_HA"
,
"263"
},
{
"Methionine_CB"
,
"264"
},
{
"Methionine_HB"
,
"265"
},
{
"Methionine_CG"
,
"266"
},
{
"Methionine_HG"
,
"267"
},
{
"Methionine_SD"
,
"268"
},
{
"Methionine_CE"
,
"269"
},
{
"Methionine_HE"
,
"270"
},
{
"Lysine_N"
,
"271"
},
{
"Lysine_CA"
,
"272"
},
{
"Lysine_C"
,
"273"
},
{
"Lysine_HN"
,
"274"
},
{
"Lysine_O"
,
"275"
},
{
"Lysine_HA"
,
"276"
},
{
"Lysine_CB"
,
"277"
},
{
"Lysine_HB"
,
"278"
},
{
"Lysine_CG"
,
"279"
},
{
"Lysine_HG"
,
"280"
},
{
"Lysine_CD"
,
"281"
},
{
"Lysine_HD"
,
"282"
},
{
"Lysine_CE"
,
"283"
},
{
"Lysine_HE"
,
"284"
},
{
"Lysine_NZ"
,
"285"
},
{
"Lysine_HZ"
,
"286"
},
{
"Arginine_N"
,
"287"
},
{
"Arginine_CA"
,
"288"
},
{
"Arginine_C"
,
"289"
},
{
"Arginine_HN"
,
"290"
},
{
"Arginine_O"
,
"291"
},
{
"Arginine_HA"
,
"292"
},
{
"Arginine_CB"
,
"293"
},
{
"Arginine_HB"
,
"294"
},
{
"Arginine_CG"
,
"295"
},
{
"Arginine_HG"
,
"296"
},
{
"Arginine_CD"
,
"297"
},
{
"Arginine_HD"
,
"298"
},
{
"Arginine_NE"
,
"299"
},
{
"Arginine_HE"
,
"300"
},
{
"Arginine_CZ"
,
"301"
},
{
"Arginine_NH"
,
"302"
},
{
"Arginine_HH"
,
"303"
},
{
"Ornithine_N"
,
"304"
},
{
"Ornithine_CA"
,
"305"
},
{
"Ornithine_C"
,
"306"
},
{
"Ornithine_HN"
,
"307"
},
{
"Ornithine_O"
,
"308"
},
{
"Ornithine_HA"
,
"309"
},
{
"Ornithine_CB"
,
"310"
},
{
"Ornithine_HB"
,
"311"
},
{
"Ornithine_CG"
,
"312"
},
{
"Ornithine_HG"
,
"313"
},
{
"Ornithine_CD"
,
"314"
},
{
"Ornithine_HD"
,
"315"
},
{
"Ornithine_NE"
,
"316"
},
{
"Ornithine_HE"
,
"317"
},
{
"MethylAlanine_N"
,
"318"
},
{
"MethylAlanine_CA"
,
"319"
},
{
"MethylAlanine_C"
,
"320"
},
{
"MethylAlanine_HN"
,
"321"
},
{
"MethylAlanine_O"
,
"322"
},
{
"MethylAlanine_CB"
,
"323"
},
{
"MethylAlanine_HB"
,
"324"
},
{
"Pyroglutamate_N"
,
"325"
},
{
"Pyroglutamate_CA"
,
"326"
},
{
"Pyroglutamate_C"
,
"327"
},
{
"Pyroglutamate_HN"
,
"328"
},
{
"Pyroglutamate_O"
,
"329"
},
{
"Pyroglutamate_HA"
,
"330"
},
{
"Pyroglutamate_CB"
,
"331"
},
{
"Pyroglutamate_HB"
,
"332"
},
{
"Pyroglutamate_CG"
,
"333"
},
{
"Pyroglutamate_HG"
,
"334"
},
{
"Pyroglutamate_CD"
,
"335"
},
{
"Pyroglutamate_OE"
,
"336"
},
{
"Formyl_C"
,
"337"
},
{
"Formyl_H"
,
"338"
},
{
"Formyl_O"
,
"339"
},
{
"Acetyl_CA"
,
"340"
},
{
"Acetyl_HA"
,
"341"
},
{
"Acetyl_C"
,
"342"
},
{
"Acetyl_O"
,
"343"
},
{
"C-Terminal_Amide_N"
,
"344"
},
{
"C-Terminal_Amide_HN"
,
"345"
},
{
"N-MeAmide_N"
,
"346"
},
{
"N-MeAmide_HN"
,
"347"
},
{
"N-MeAmide_C"
,
"348"
},
{
"N-MeAmide_HC"
,
"349"
},
{
"N-Terminal_GLY_N"
,
"350"
},
{
"N-Terminal_GLY_CA"
,
"351"
},
{
"N-Terminal_GLY_C"
,
"352"
},
{
"N-Terminal_GLY_HN"
,
"353"
},
{
"N-Terminal_GLY_O"
,
"354"
},
{
"N-Terminal_GLY_HA"
,
"355"
},
{
"N-Terminal_ALA_N"
,
"356"
},
{
"N-Terminal_ALA_CA"
,
"357"
},
{
"N-Terminal_ALA_C"
,
"358"
},
{
"N-Terminal_ALA_HN"
,
"359"
},
{
"N-Terminal_ALA_O"
,
"360"
},
{
"N-Terminal_ALA_HA"
,
"361"
},
{
"N-Terminal_VAL_N"
,
"362"
},
{
"N-Terminal_VAL_CA"
,
"363"
},
{
"N-Terminal_VAL_C"
,
"364"
},
{
"N-Terminal_VAL_HN"
,
"365"
},
{
"N-Terminal_VAL_O"
,
"366"
},
{
"N-Terminal_VAL_HA"
,
"367"
},
{
"N-Terminal_LEU_N"
,
"368"
},
{
"N-Terminal_LEU_CA"
,
"369"
},
{
"N-Terminal_LEU_C"
,
"370"
},
{
"N-Terminal_LEU_HN"
,
"371"
},
{
"N-Terminal_LEU_O"
,
"372"
},
{
"N-Terminal_LEU_HA"
,
"373"
},
{
"N-Terminal_ILE_N"
,
"374"
},
{
"N-Terminal_ILE_CA"
,
"375"
},
{
"N-Terminal_ILE_C"
,
"376"
},
{
"N-Terminal_ILE_HN"
,
"377"
},
{
"N-Terminal_ILE_O"
,
"378"
},
{
"N-Terminal_ILE_HA"
,
"379"
},
{
"N-Terminal_SER_N"
,
"380"
},
{
"N-Terminal_SER_CA"
,
"381"
},
{
"N-Terminal_SER_C"
,
"382"
},
{
"N-Terminal_SER_HN"
,
"383"
},
{
"N-Terminal_SER_O"
,
"384"
},
{
"N-Terminal_SER_HA"
,
"385"
},
{
"N-Terminal_THR_N"
,
"386"
},
{
"N-Terminal_THR_CA"
,
"387"
},
{
"N-Terminal_THR_C"
,
"388"
},
{
"N-Terminal_THR_HN"
,
"389"
},
{
"N-Terminal_THR_O"
,
"390"
},
{
"N-Terminal_THR_HA"
,
"391"
},
{
"N-Terminal_CYS_(-SH)_N"
,
"392"
},
{
"N-Terminal_CYS_(-SH)_CA"
,
"393"
},
{
"N-Terminal_CYS_(-SH)_C"
,
"394"
},
{
"N-Terminal_CYS_(-SH)_HN"
,
"395"
},
{
"N-Terminal_CYS_(-SH)_O"
,
"396"
},
{
"N-Terminal_CYS_(-SH)_HA"
,
"397"
},
{
"N-Terminal_CYS_(-SS-)_N"
,
"398"
},
{
"N-Terminal_CYS_(-SS-)_CA"
,
"399"
},
{
"N-Terminal_CYS_(-SS-)_C"
,
"400"
},
{
"N-Terminal_CYS_(-SS-)_HN"
,
"401"
},
{
"N-Terminal_CYS_(-SS-)_O"
,
"402"
},
{
"N-Terminal_CYS_(-SS-)_HA"
,
"403"
},
{
"N-Terminal_PRO_N"
,
"404"
},
{
"N-Terminal_PRO_CA"
,
"405"
},
{
"N-Terminal_PRO_C"
,
"406"
},
{
"N-Terminal_PRO_HN"
,
"407"
},
{
"N-Terminal_PRO_O"
,
"408"
},
{
"N-Terminal_PRO_HA"
,
"409"
},
{
"N-Terminal_PRO_CD"
,
"410"
},
{
"N-Terminal_PRO_HD"
,
"411"
},
{
"N-Terminal_PHE_N"
,
"412"
},
{
"N-Terminal_PHE_CA"
,
"413"
},
{
"N-Terminal_PHE_C"
,
"414"
},
{
"N-Terminal_PHE_HN"
,
"415"
},
{
"N-Terminal_PHE_O"
,
"416"
},
{
"N-Terminal_PHE_HA"
,
"417"
},
{
"N-Terminal_TYR_N"
,
"418"
},
{
"N-Terminal_TYR_CA"
,
"419"
},
{
"N-Terminal_TYR_C"
,
"420"
},
{
"N-Terminal_TYR_HN"
,
"421"
},
{
"N-Terminal_TYR_O"
,
"422"
},
{
"N-Terminal_TYR_HA"
,
"423"
},
{
"N-Terminal_TRP_N"
,
"424"
},
{
"N-Terminal_TRP_CA"
,
"425"
},
{
"N-Terminal_TRP_C"
,
"426"
},
{
"N-Terminal_TRP_HN"
,
"427"
},
{
"N-Terminal_TRP_O"
,
"428"
},
{
"N-Terminal_TRP_HA"
,
"429"
},
{
"N-Terminal_HIS_(+)_N"
,
"430"
},
{
"N-Terminal_HIS_(+)_CA"
,
"431"
},
{
"N-Terminal_HIS_(+)_C"
,
"432"
},
{
"N-Terminal_HIS_(+)_HN"
,
"433"
},
{
"N-Terminal_HIS_(+)_O"
,
"434"
},
{
"N-Terminal_HIS_(+)_HA"
,
"435"
},
{
"N-Terminal_HIS_(HD)_N"
,
"436"
},
{
"N-Terminal_HIS_(HD)_CA"
,
"437"
},
{
"N-Terminal_HIS_(HD)_C"
,
"438"
},
{
"N-Terminal_HIS_(HD)_HN"
,
"439"
},
{
"N-Terminal_HIS_(HD)_O"
,
"440"
},
{
"N-Terminal_HIS_(HD)_HA"
,
"441"
},
{
"N-Terminal_HIS_(HE)_N"
,
"442"
},
{
"N-Terminal_HIS_(HE)_CA"
,
"443"
},
{
"N-Terminal_HIS_(HE)_C"
,
"444"
},
{
"N-Terminal_HIS_(HE)_HN"
,
"445"
},
{
"N-Terminal_HIS_(HE)_O"
,
"446"
},
{
"N-Terminal_HIS_(HE)_HA"
,
"447"
},
{
"N-Terminal_ASP_N"
,
"448"
},
{
"N-Terminal_ASP_CA"
,
"449"
},
{
"N-Terminal_ASP_C"
,
"450"
},
{
"N-Terminal_ASP_HN"
,
"451"
},
{
"N-Terminal_ASP_O"
,
"452"
},
{
"N-Terminal_ASP_HA"
,
"453"
},
{
"N-Terminal_ASN_N"
,
"454"
},
{
"N-Terminal_ASN_CA"
,
"455"
},
{
"N-Terminal_ASN_C"
,
"456"
},
{
"N-Terminal_ASN_HN"
,
"457"
},
{
"N-Terminal_ASN_O"
,
"458"
},
{
"N-Terminal_ASN_HA"
,
"459"
},
{
"N-Terminal_GLU_N"
,
"460"
},
{
"N-Terminal_GLU_CA"
,
"461"
},
{
"N-Terminal_GLU_C"
,
"462"
},
{
"N-Terminal_GLU_HN"
,
"463"
},
{
"N-Terminal_GLU_O"
,
"464"
},
{
"N-Terminal_GLU_HA"
,
"465"
},
{
"N-Terminal_GLN_N"
,
"466"
},
{
"N-Terminal_GLN_CA"
,
"467"
},
{
"N-Terminal_GLN_C"
,
"468"
},
{
"N-Terminal_GLN_HN"
,
"469"
},
{
"N-Terminal_GLN_O"
,
"470"
},
{
"N-Terminal_GLN_HA"
,
"471"
},
{
"N-Terminal_MET_N"
,
"472"
},
{
"N-Terminal_MET_CA"
,
"473"
},
{
"N-Terminal_MET_C"
,
"474"
},
{
"N-Terminal_MET_HN"
,
"475"
},
{
"N-Terminal_MET_O"
,
"476"
},
{
"N-Terminal_MET_HA"
,
"477"
},
{
"N-Terminal_LYS_N"
,
"478"
},
{
"N-Terminal_LYS_CA"
,
"479"
},
{
"N-Terminal_LYS_C"
,
"480"
},
{
"N-Terminal_LYS_HN"
,
"481"
},
{
"N-Terminal_LYS_O"
,
"482"
},
{
"N-Terminal_LYS_HA"
,
"483"
},
{
"N-Terminal_ARG_N"
,
"484"
},
{
"N-Terminal_ARG_CA"
,
"485"
},
{
"N-Terminal_ARG_C"
,
"486"
},
{
"N-Terminal_ARG_HN"
,
"487"
},
{
"N-Terminal_ARG_O"
,
"488"
},
{
"N-Terminal_ARG_HA"
,
"489"
},
{
"N-Terminal_ORN_N"
,
"490"
},
{
"N-Terminal_ORN_CA"
,
"491"
},
{
"N-Terminal_ORN_C"
,
"492"
},
{
"N-Terminal_ORN_HN"
,
"493"
},
{
"N-Terminal_ORN_O"
,
"494"
},
{
"N-Terminal_ORN_HA"
,
"495"
},
{
"N-Terminal_AIB_N"
,
"496"
},
{
"N-Terminal_AIB_CA"
,
"497"
},
{
"N-Terminal_AIB_C"
,
"498"
},
{
"N-Terminal_AIB_HN"
,
"499"
},
{
"N-Terminal_AIB_O"
,
"500"
},
{
"C-Terminal_GLY_N"
,
"501"
},
{
"C-Terminal_GLY_CA"
,
"502"
},
{
"C-Terminal_GLY_C"
,
"503"
},
{
"C-Terminal_GLY_HN"
,
"504"
},
{
"C-Terminal_GLY_OXT"
,
"505"
},
{
"C-Terminal_GLY_HA"
,
"506"
},
{
"C-Terminal_ALA_N"
,
"507"
},
{
"C-Terminal_ALA_CA"
,
"508"
},
{
"C-Terminal_ALA_C"
,
"509"
},
{
"C-Terminal_ALA_HN"
,
"510"
},
{
"C-Terminal_ALA_OXT"
,
"511"
},
{
"C-Terminal_ALA_HA"
,
"512"
},
{
"C-Terminal_VAL_N"
,
"513"
},
{
"C-Terminal_VAL_CA"
,
"514"
},
{
"C-Terminal_VAL_C"
,
"515"
},
{
"C-Terminal_VAL_HN"
,
"516"
},
{
"C-Terminal_VAL_OXT"
,
"517"
},
{
"C-Terminal_VAL_HA"
,
"518"
},
{
"C-Terminal_LEU_N"
,
"519"
},
{
"C-Terminal_LEU_CA"
,
"520"
},
{
"C-Terminal_LEU_C"
,
"521"
},
{
"C-Terminal_LEU_HN"
,
"522"
},
{
"C-Terminal_LEU_OXT"
,
"523"
},
{
"C-Terminal_LEU_HA"
,
"524"
},
{
"C-Terminal_ILE_N"
,
"525"
},
{
"C-Terminal_ILE_CA"
,
"526"
},
{
"C-Terminal_ILE_C"
,
"527"
},
{
"C-Terminal_ILE_HN"
,
"528"
},
{
"C-Terminal_ILE_OXT"
,
"529"
},
{
"C-Terminal_ILE_HA"
,
"530"
},
{
"C-Terminal_SER_N"
,
"531"
},
{
"C-Terminal_SER_CA"
,
"532"
},
{
"C-Terminal_SER_C"
,
"533"
},
{
"C-Terminal_SER_HN"
,
"534"
},
{
"C-Terminal_SER_OXT"
,
"535"
},
{
"C-Terminal_SER_HA"
,
"536"
},
{
"C-Terminal_THR_N"
,
"537"
},
{
"C-Terminal_THR_CA"
,
"538"
},
{
"C-Terminal_THR_C"
,
"539"
},
{
"C-Terminal_THR_HN"
,
"540"
},
{
"C-Terminal_THR_OXT"
,
"541"
},
{
"C-Terminal_THR_HA"
,
"542"
},
{
"C-Terminal_CYS_(-SH)_N"
,
"543"
},
{
"C-Terminal_CYS_(-SH)_CA"
,
"544"
},
{
"C-Terminal_CYS_(-SH)_C"
,
"545"
},
{
"C-Terminal_CYS_(-SH)_HN"
,
"546"
},
{
"C-Terminal_CYS_(-SH)_OXT"
,
"547"
},
{
"C-Terminal_CYS_(-SH)_HA"
,
"548"
},
{
"C-Terminal_CYS_(-SS-)_N"
,
"549"
},
{
"C-Terminal_CYS_(-SS-)_CA"
,
"550"
},
{
"C-Terminal_CYS_(-SS-)_C"
,
"551"
},
{
"C-Terminal_CYS_(-SS-)_HN"
,
"552"
},
{
"C-Terminal_CYS_(-SS-)_OXT"
,
"553"
},
{
"C-Terminal_CYS_(-SS-)_HA"
,
"554"
},
{
"C-Terminal_PRO_N"
,
"555"
},
{
"C-Terminal_PRO_CA"
,
"556"
},
{
"C-Terminal_PRO_C"
,
"557"
},
{
"C-Terminal_PRO_OXT"
,
"558"
},
{
"C-Terminal_PRO_HA"
,
"559"
},
{
"C-Terminal_PHE_N"
,
"560"
},
{
"C-Terminal_PHE_CA"
,
"561"
},
{
"C-Terminal_PHE_C"
,
"562"
},
{
"C-Terminal_PHE_HN"
,
"563"
},
{
"C-Terminal_PHE_OXT"
,
"564"
},
{
"C-Terminal_PHE_HA"
,
"565"
},
{
"C-Terminal_TYR_N"
,
"566"
},
{
"C-Terminal_TYR_CA"
,
"567"
},
{
"C-Terminal_TYR_C"
,
"568"
},
{
"C-Terminal_TYR_HN"
,
"569"
},
{
"C-Terminal_TYR_OXT"
,
"570"
},
{
"C-Terminal_TYR_HA"
,
"571"
},
{
"C-Terminal_TRP_N"
,
"572"
},
{
"C-Terminal_TRP_CA"
,
"573"
},
{
"C-Terminal_TRP_C"
,
"574"
},
{
"C-Terminal_TRP_HN"
,
"575"
},
{
"C-Terminal_TRP_OXT"
,
"576"
},
{
"C-Terminal_TRP_HA"
,
"577"
},
{
"C-Terminal_HIS_(+)_N"
,
"578"
},
{
"C-Terminal_HIS_(+)_CA"
,
"579"
},
{
"C-Terminal_HIS_(+)_C"
,
"580"
},
{
"C-Terminal_HIS_(+)_HN"
,
"581"
},
{
"C-Terminal_HIS_(+)_OXT"
,
"582"
},
{
"C-Terminal_HIS_(+)_HA"
,
"583"
},
{
"C-Terminal_HIS_(HD)_N"
,
"584"
},
{
"C-Terminal_HIS_(HD)_CA"
,
"585"
},
{
"C-Terminal_HIS_(HD)_C"
,
"586"
},
{
"C-Terminal_HIS_(HD)_HN"
,
"587"
},
{
"C-Terminal_HIS_(HD)_OXT"
,
"588"
},
{
"C-Terminal_HIS_(HD)_HA"
,
"589"
},
{
"C-Terminal_HIS_(HE)_N"
,
"590"
},
{
"C-Terminal_HIS_(HE)_CA"
,
"591"
},
{
"C-Terminal_HIS_(HE)_C"
,
"592"
},
{
"C-Terminal_HIS_(HE)_HN"
,
"593"
},
{
"C-Terminal_HIS_(HE)_OXT"
,
"594"
},
{
"C-Terminal_HIS_(HE)_HA"
,
"595"
},
{
"C-Terminal_ASP_N"
,
"596"
},
{
"C-Terminal_ASP_CA"
,
"597"
},
{
"C-Terminal_ASP_C"
,
"598"
},
{
"C-Terminal_ASP_HN"
,
"599"
},
{
"C-Terminal_ASP_OXT"
,
"600"
},
{
"C-Terminal_ASP_HA"
,
"601"
},
{
"C-Terminal_ASN_N"
,
"602"
},
{
"C-Terminal_ASN_CA"
,
"603"
},
{
"C-Terminal_ASN_C"
,
"604"
},
{
"C-Terminal_ASN_HN"
,
"605"
},
{
"C-Terminal_ASN_OXT"
,
"606"
},
{
"C-Terminal_ASN_HA"
,
"607"
},
{
"C-Terminal_GLU_N"
,
"608"
},
{
"C-Terminal_GLU_CA"
,
"609"
},
{
"C-Terminal_GLU_C"
,
"610"
},
{
"C-Terminal_GLU_HN"
,
"611"
},
{
"C-Terminal_GLU_OXT"
,
"612"
},
{
"C-Terminal_GLU_HA"
,
"613"
},
{
"C-Terminal_GLN_N"
,
"614"
},
{
"C-Terminal_GLN_CA"
,
"615"
},
{
"C-Terminal_GLN_C"
,
"616"
},
{
"C-Terminal_GLN_HN"
,
"617"
},
{
"C-Terminal_GLN_OXT"
,
"618"
},
{
"C-Terminal_GLN_HA"
,
"619"
},
{
"C-Terminal_MET_N"
,
"620"
},
{
"C-Terminal_MET_CA"
,
"621"
},
{
"C-Terminal_MET_C"
,
"622"
},
{
"C-Terminal_MET_HN"
,
"623"
},
{
"C-Terminal_MET_OXT"
,
"624"
},
{
"C-Terminal_MET_HA"
,
"625"
},
{
"C-Terminal_LYS_N"
,
"626"
},
{
"C-Terminal_LYS_CA"
,
"627"
},
{
"C-Terminal_LYS_C"
,
"628"
},
{
"C-Terminal_LYS_HN"
,
"629"
},
{
"C-Terminal_LYS_OXT"
,
"630"
},
{
"C-Terminal_LYS_HA"
,
"631"
},
{
"C-Terminal_ARG_N"
,
"632"
},
{
"C-Terminal_ARG_CA"
,
"633"
},
{
"C-Terminal_ARG_C"
,
"634"
},
{
"C-Terminal_ARG_HN"
,
"635"
},
{
"C-Terminal_ARG_OXT"
,
"636"
},
{
"C-Terminal_ARG_HA"
,
"637"
},
{
"C-Terminal_ORN_N"
,
"638"
},
{
"C-Terminal_ORN_CA"
,
"639"
},
{
"C-Terminal_ORN_C"
,
"640"
},
{
"C-Terminal_ORN_HN"
,
"641"
},
{
"C-Terminal_ORN_OXT"
,
"642"
},
{
"C-Terminal_ORN_HA"
,
"643"
},
{
"C-Terminal_AIB_N"
,
"644"
},
{
"C-Terminal_AIB_CA"
,
"645"
},
{
"C-Terminal_AIB_C"
,
"646"
},
{
"C-Terminal_AIB_HN"
,
"647"
},
{
"C-Terminal_AIB_OXT"
,
"648"
},
{
"R-Adenosine_O5'"
,
"1001"
},
{
"R-Adenosine_C5'"
,
"1002"
},
{
"R-Adenosine_H5'1"
,
"1003"
},
{
"R-Adenosine_H5'2"
,
"1004"
},
{
"R-Adenosine_C4'"
,
"1005"
},
{
"R-Adenosine_H4'"
,
"1006"
},
{
"R-Adenosine_O4'"
,
"1007"
},
{
"R-Adenosine_C1'"
,
"1008"
},
{
"R-Adenosine_H1'"
,
"1009"
},
{
"R-Adenosine_C3'"
,
"1010"
},
{
"R-Adenosine_H3'"
,
"1011"
},
{
"R-Adenosine_C2'"
,
"1012"
},
{
"R-Adenosine_H2'1"
,
"1013"
},
{
"R-Adenosine_O2'"
,
"1014"
},
{
"R-Adenosine_HO'2"
,
"1015"
},
{
"R-Adenosine_O3'"
,
"1016"
},
{
"R-Adenosine_N9"
,
"1017"
},
{
"R-Adenosine_C4"
,
"1018"
},
{
"R-Adenosine_C5"
,
"1019"
},
{
"R-Adenosine_N7"
,
"1020"
},
{
"R-Adenosine_C8"
,
"1021"
},
{
"R-Adenosine_N3"
,
"1022"
},
{
"R-Adenosine_C2"
,
"1023"
},
{
"R-Adenosine_N1"
,
"1024"
},
{
"R-Adenosine_C6"
,
"1025"
},
{
"R-Adenosine_H2"
,
"1026"
},
{
"R-Adenosine_N6"
,
"1027"
},
{
"R-Adenosine_H61"
,
"1028"
},
{
"R-Adenosine_H62"
,
"1029"
},
{
"R-Adenosine_H8"
,
"1030"
},
{
"R-Guanosine_O5'"
,
"1031"
},
{
"R-Guanosine_C5'"
,
"1032"
},
{
"R-Guanosine_H5'1"
,
"1033"
},
{
"R-Guanosine_H5'2"
,
"1034"
},
{
"R-Guanosine_C4'"
,
"1035"
},
{
"R-Guanosine_H4'"
,
"1036"
},
{
"R-Guanosine_O4'"
,
"1037"
},
{
"R-Guanosine_C1'"
,
"1038"
},
{
"R-Guanosine_H1'"
,
"1039"
},
{
"R-Guanosine_C3'"
,
"1040"
},
{
"R-Guanosine_H3'"
,
"1041"
},
{
"R-Guanosine_C2'"
,
"1042"
},
{
"R-Guanosine_H2'1"
,
"1043"
},
{
"R-Guanosine_O2'"
,
"1044"
},
{
"R-Guanosine_HO'2"
,
"1045"
},
{
"R-Guanosine_O3'"
,
"1046"
},
{
"R-Guanosine_N9"
,
"1047"
},
{
"R-Guanosine_C4"
,
"1048"
},
{
"R-Guanosine_C5"
,
"1049"
},
{
"R-Guanosine_N7"
,
"1050"
},
{
"R-Guanosine_C8"
,
"1051"
},
{
"R-Guanosine_N3"
,
"1052"
},
{
"R-Guanosine_C2"
,
"1053"
},
{
"R-Guanosine_N1"
,
"1054"
},
{
"R-Guanosine_C6"
,
"1055"
},
{
"R-Guanosine_H1"
,
"1056"
},
{
"R-Guanosine_N2"
,
"1057"
},
{
"R-Guanosine_H21"
,
"1058"
},
{
"R-Guanosine_H22"
,
"1059"
},
{
"R-Guanosine_O6"
,
"1060"
},
{
"R-Guanosine_H8"
,
"1061"
},
{
"R-Cytosine_O5'"
,
"1062"
},
{
"R-Cytosine_C5'"
,
"1063"
},
{
"R-Cytosine_H5'1"
,
"1064"
},
{
"R-Cytosine_H5'2"
,
"1065"
},
{
"R-Cytosine_C4'"
,
"1066"
},
{
"R-Cytosine_H4'"
,
"1067"
},
{
"R-Cytosine_O4'"
,
"1068"
},
{
"R-Cytosine_C1'"
,
"1069"
},
{
"R-Cytosine_H1'"
,
"1070"
},
{
"R-Cytosine_C3'"
,
"1071"
},
{
"R-Cytosine_H3'"
,
"1072"
},
{
"R-Cytosine_C2'"
,
"1073"
},
{
"R-Cytosine_H2'1"
,
"1074"
},
{
"R-Cytosine_O2'"
,
"1075"
},
{
"R-Cytosine_HO'2"
,
"1076"
},
{
"R-Cytosine_O3'"
,
"1077"
},
{
"R-Cytosine_N1"
,
"1078"
},
{
"R-Cytosine_C2"
,
"1079"
},
{
"R-Cytosine_N3"
,
"1080"
},
{
"R-Cytosine_C4"
,
"1081"
},
{
"R-Cytosine_C5"
,
"1082"
},
{
"R-Cytosine_C6"
,
"1083"
},
{
"R-Cytosine_O2"
,
"1084"
},
{
"R-Cytosine_N4"
,
"1085"
},
{
"R-Cytosine_H41"
,
"1086"
},
{
"R-Cytosine_H42"
,
"1087"
},
{
"R-Cytosine_H5"
,
"1088"
},
{
"R-Cytosine_H6"
,
"1089"
},
{
"R-Uracil_O5'"
,
"1090"
},
{
"R-Uracil_C5'"
,
"1091"
},
{
"R-Uracil_H5'1"
,
"1092"
},
{
"R-Uracil_H5'2"
,
"1093"
},
{
"R-Uracil_C4'"
,
"1094"
},
{
"R-Uracil_H4'"
,
"1095"
},
{
"R-Uracil_O4'"
,
"1096"
},
{
"R-Uracil_C1'"
,
"1097"
},
{
"R-Uracil_H1'"
,
"1098"
},
{
"R-Uracil_C3'"
,
"1099"
},
{
"R-Uracil_H3'"
,
"1100"
},
{
"R-Uracil_C2'"
,
"1101"
},
{
"R-Uracil_H2'1"
,
"1102"
},
{
"R-Uracil_O2'"
,
"1103"
},
{
"R-Uracil_HO'2"
,
"1104"
},
{
"R-Uracil_O3'"
,
"1105"
},
{
"R-Uracil_N1"
,
"1106"
},
{
"R-Uracil_C2"
,
"1107"
},
{
"R-Uracil_N3"
,
"1108"
},
{
"R-Uracil_C4"
,
"1109"
},
{
"R-Uracil_C5"
,
"1110"
},
{
"R-Uracil_C6"
,
"1111"
},
{
"R-Uracil_O2"
,
"1112"
},
{
"R-Uracil_H3"
,
"1113"
},
{
"R-Uracil_O4"
,
"1114"
},
{
"R-Uracil_H5"
,
"1115"
},
{
"R-Uracil_H6"
,
"1116"
},
{
"D-Adenosine_O5'"
,
"1117"
},
{
"D-Adenosine_C5'"
,
"1118"
},
{
"D-Adenosine_H5'1"
,
"1119"
},
{
"D-Adenosine_H5'2"
,
"1120"
},
{
"D-Adenosine_C4'"
,
"1121"
},
{
"D-Adenosine_H4'"
,
"1122"
},
{
"D-Adenosine_O4'"
,
"1123"
},
{
"D-Adenosine_C1'"
,
"1124"
},
{
"D-Adenosine_H1'"
,
"1125"
},
{
"D-Adenosine_C3'"
,
"1126"
},
{
"D-Adenosine_H3'"
,
"1127"
},
{
"D-Adenosine_C2'"
,
"1128"
},
{
"D-Adenosine_H2'1"
,
"1129"
},
{
"D-Adenosine_H2'2"
,
"1130"
},
{
"D-Adenosine_O3'"
,
"1131"
},
{
"D-Adenosine_N9"
,
"1132"
},
{
"D-Adenosine_C4"
,
"1133"
},
{
"D-Adenosine_C5"
,
"1134"
},
{
"D-Adenosine_N7"
,
"1135"
},
{
"D-Adenosine_C8"
,
"1136"
},
{
"D-Adenosine_N3"
,
"1137"
},
{
"D-Adenosine_C2"
,
"1138"
},
{
"D-Adenosine_N1"
,
"1139"
},
{
"D-Adenosine_C6"
,
"1140"
},
{
"D-Adenosine_H2"
,
"1141"
},
{
"D-Adenosine_N6"
,
"1142"
},
{
"D-Adenosine_H61"
,
"1143"
},
{
"D-Adenosine_H62"
,
"1144"
},
{
"D-Adenosine_H8"
,
"1145"
},
{
"D-Guanosine_O5'"
,
"1146"
},
{
"D-Guanosine_C5'"
,
"1147"
},
{
"D-Guanosine_H5'1"
,
"1148"
},
{
"D-Guanosine_H5'2"
,
"1149"
},
{
"D-Guanosine_C4'"
,
"1150"
},
{
"D-Guanosine_H4'"
,
"1151"
},
{
"D-Guanosine_O4'"
,
"1152"
},
{
"D-Guanosine_C1'"
,
"1153"
},
{
"D-Guanosine_H1'"
,
"1154"
},
{
"D-Guanosine_C3'"
,
"1155"
},
{
"D-Guanosine_H3'"
,
"1156"
},
{
"D-Guanosine_C2'"
,
"1157"
},
{
"D-Guanosine_H2'1"
,
"1158"
},
{
"D-Guanosine_H2'2"
,
"1159"
},
{
"D-Guanosine_O3'"
,
"1160"
},
{
"D-Guanosine_N9"
,
"1161"
},
{
"D-Guanosine_C4"
,
"1162"
},
{
"D-Guanosine_C5"
,
"1163"
},
{
"D-Guanosine_N7"
,
"1164"
},
{
"D-Guanosine_C8"
,
"1165"
},
{
"D-Guanosine_N3"
,
"1166"
},
{
"D-Guanosine_C2"
,
"1167"
},
{
"D-Guanosine_N1"
,
"1168"
},
{
"D-Guanosine_C6"
,
"1169"
},
{
"D-Guanosine_H1"
,
"1170"
},
{
"D-Guanosine_N2"
,
"1171"
},
{
"D-Guanosine_H21"
,
"1172"
},
{
"D-Guanosine_H22"
,
"1173"
},
{
"D-Guanosine_O6"
,
"1174"
},
{
"D-Guanosine_H8"
,
"1175"
},
{
"D-Cytosine_O5'"
,
"1176"
},
{
"D-Cytosine_C5'"
,
"1177"
},
{
"D-Cytosine_H5'1"
,
"1178"
},
{
"D-Cytosine_H5'2"
,
"1179"
},
{
"D-Cytosine_C4'"
,
"1180"
},
{
"D-Cytosine_H4'"
,
"1181"
},
{
"D-Cytosine_O4'"
,
"1182"
},
{
"D-Cytosine_C1'"
,
"1183"
},
{
"D-Cytosine_H1'"
,
"1184"
},
{
"D-Cytosine_C3'"
,
"1185"
},
{
"D-Cytosine_H3'"
,
"1186"
},
{
"D-Cytosine_C2'"
,
"1187"
},
{
"D-Cytosine_H2'1"
,
"1188"
},
{
"D-Cytosine_H2'2"
,
"1189"
},
{
"D-Cytosine_O3'"
,
"1190"
},
{
"D-Cytosine_N1"
,
"1191"
},
{
"D-Cytosine_C2"
,
"1192"
},
{
"D-Cytosine_N3"
,
"1193"
},
{
"D-Cytosine_C4"
,
"1194"
},
{
"D-Cytosine_C5"
,
"1195"
},
{
"D-Cytosine_C6"
,
"1196"
},
{
"D-Cytosine_O2"
,
"1197"
},
{
"D-Cytosine_N4"
,
"1198"
},
{
"D-Cytosine_H41"
,
"1199"
},
{
"D-Cytosine_H42"
,
"1200"
},
{
"D-Cytosine_H5"
,
"1201"
},
{
"D-Cytosine_H6"
,
"1202"
},
{
"D-Thymine_O5'"
,
"1203"
},
{
"D-Thymine_C5'"
,
"1204"
},
{
"D-Thymine_H5'1"
,
"1205"
},
{
"D-Thymine_H5'2"
,
"1206"
},
{
"D-Thymine_C4'"
,
"1207"
},
{
"D-Thymine_H4'"
,
"1208"
},
{
"D-Thymine_O4'"
,
"1209"
},
{
"D-Thymine_C1'"
,
"1210"
},
{
"D-Thymine_H1'"
,
"1211"
},
{
"D-Thymine_C3'"
,
"1212"
},
{
"D-Thymine_H3'"
,
"1213"
},
{
"D-Thymine_C2'"
,
"1214"
},
{
"D-Thymine_H2'1"
,
"1215"
},
{
"D-Thymine_H2'2"
,
"1216"
},
{
"D-Thymine_O3'"
,
"1217"
},
{
"D-Thymine_N1"
,
"1218"
},
{
"D-Thymine_C2"
,
"1219"
},
{
"D-Thymine_N3"
,
"1220"
},
{
"D-Thymine_C4"
,
"1221"
},
{
"D-Thymine_C5"
,
"1222"
},
{
"D-Thymine_C6"
,
"1223"
},
{
"D-Thymine_O2"
,
"1224"
},
{
"D-Thymine_H3"
,
"1225"
},
{
"D-Thymine_O4"
,
"1226"
},
{
"D-Thymine_C7"
,
"1227"
},
{
"D-Thymine_H7"
,
"1228"
},
{
"D-Thymine_H6"
,
"1229"
},
{
"R-Phosphodiester_P"
,
"1230"
},
{
"R-Phosphodiester_OP"
,
"1231"
},
{
"R-5'-Hydroxyl_O5'"
,
"1232"
},
{
"R-5'-Hydroxyl_H5T"
,
"1233"
},
{
"R-5'-Phosphate_O5'"
,
"1234"
},
{
"R-5'-Phosphate_P"
,
"1235"
},
{
"R-5'-Phosphate_OP"
,
"1236"
},
{
"R-3'-Hydroxyl_O3'"
,
"1237"
},
{
"R-3'-Hydroxyl_H3T"
,
"1238"
},
{
"R-3'-Phosphate_O3'"
,
"1239"
},
{
"R-3'-Phosphate_P"
,
"1240"
},
{
"R-3'-Phosphate_OP"
,
"1241"
},
{
"D-Phosphodiester_P"
,
"1242"
},
{
"D-Phosphodiester_OP"
,
"1243"
},
{
"D-5'-Hydroxyl_O5'"
,
"1244"
},
{
"D-5'-Hydroxyl_H5T"
,
"1245"
},
{
"D-5'-Phosphate_O5'"
,
"1246"
},
{
"D-5'-Phosphate_P"
,
"1247"
},
{
"D-5'-Phosphate_OP"
,
"1248"
},
{
"D-3'-Hydroxyl_O3'"
,
"1249"
},
{
"D-3'-Hydroxyl_H3T"
,
"1250"
},
{
"D-3'-Phosphate_O3'"
,
"1251"
},
{
"D-3'-Phosphate_P"
,
"1252"
},
{
"D-3'-Phosphate_OP"
,
"1253"
},
{
"TIP3P_Oxygen"
,
"2001"
},
{
"TIP3P_Hydrogen"
,
"2002"
},
{
"Li+_Lithium_Ion"
,
"2003"
},
{
"Na+_Sodium_Ion"
,
"2004"
},
{
"K+_Potassium_Ion"
,
"2005"
},
{
"Rb+_Rubidium_Ion"
,
"2006"
},
{
"Cs+_Cesium_Ion"
,
"2007"
},
{
"Mg+2_Magnesium_Ion"
,
"2008"
},
{
"Ca+2_Calcium_Ion"
,
"2009"
},
{
"Zn+2_Zinc_Ion"
,
"2010"
},
{
"Cl-_Chloride_Ion"
,
"2011"
},
{
NULL
,
NULL
}
};
static
StringIntMap
*
residueAtomNameBiotypeMap
=
NULL
;
// ---------------------------------------------------------------------------------------
// residueNameMap is singleton
if
(
residueAtomNameBiotypeMap
==
NULL
){
residueAtomNameBiotypeMap
=
new
StringIntMap
();
int
index
=
0
;
if
(
forceField
==
AmberForceField
){
while
(
amberNameMap
[
index
][
0
]
!=
NULL
){
(
*
residueAtomNameBiotypeMap
)[
amberNameMap
[
index
][
0
]]
=
atoi
(
amberNameMap
[
index
][
1
]
);
index
++
;
}
}
else
{
while
(
amoebaNameMap
[
index
][
0
]
!=
NULL
){
(
*
residueAtomNameBiotypeMap
)[
amoebaNameMap
[
index
][
0
]]
=
atoi
(
amoebaNameMap
[
index
][
1
]
);
index
++
;
}
}
}
return
residueAtomNameBiotypeMap
;
}
/**---------------------------------------------------------------------------------------
Get solvent radii from parameter file (Simbios)
@param numberOfAtoms number of atoms
@param parameterFileName parameter file name
@param top Gromacs topology data struct
@param radii array to store Macromodel radii for each atom
@param scaleFactor scale factor
@return SimTKOpenMMCommon::DefaultReturn unless paramter file not opened
in which case return SimTKOpenMMCommon::ErrorReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGromacsUtilities
::
getMacroModelAtomicRadii
(
int
numberOfAtoms
,
const
std
::
string
parameterFileName
,
const
t_topology
*
top
,
RealOpenMM
*
radii
,
RealOpenMM
scaleFactor
){
// ---------------------------------------------------------------------------------------
static
const
std
::
string
methodName
=
"
\n
SimTKOpenMMGromacsUtilities::getMacroModelAtomicRadii"
;
// ---------------------------------------------------------------------------------------
RealOpenMMVector
radiiV
;
int
status
=
SimTKOpenMMGromacsUtilities
::
getMacroModelAtomicRadii
(
numberOfAtoms
,
parameterFileName
,
top
,
radiiV
,
scaleFactor
);
for
(
int
ii
=
0
;
ii
<
numberOfAtoms
;
ii
++
){
radii
[
ii
]
=
radiiV
[
ii
];
}
return
status
;
}
/**---------------------------------------------------------------------------------------
Get solvent radii from parameter file (Simbios)
@param numberOfAtoms number of atoms
@param parameterFileName parameter file name
@param top Gromacs topology data struct
@param radii vector to store Macromodel radii for each atom
@param scaleFactor scale factor
@return SimTKOpenMMCommon::DefaultReturn unless paramter file not opened
in which case return SimTKOpenMMCommon::ErrorReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGromacsUtilities
::
getMacroModelAtomicRadii
(
int
numberOfAtoms
,
const
std
::
string
parameterFileName
,
const
t_topology
*
top
,
RealOpenMMVector
&
radii
,
RealOpenMM
scaleFactor
){
// ---------------------------------------------------------------------------------------
static
const
std
::
string
methodName
=
"
\n
SimTKOpenMMGromacsUtilities::getMacroModelAtomicRadii"
;
// ---------------------------------------------------------------------------------------
// read in file contents -- return error flag if file not opened
StringVector
fileContents
;
int
returnStatus
=
SimTKOpenMMUtilities
::
readFileIntoStringVector
(
parameterFileName
,
fileContents
);
std
::
stringstream
message
;
if
(
returnStatus
!=
SimTKOpenMMCommon
::
DefaultReturn
){
message
<<
" agb parameter file not opened=<"
<<
parameterFileName
<<
">"
;
return
SimTKOpenMMCommon
::
ErrorReturn
;
}
else
{
message
<<
methodName
<<
" read "
<<
fileContents
.
size
()
<<
" lines from agb parameter file=<"
<<
parameterFileName
<<
">."
;
}
SimTKOpenMMLog
::
printMessage
(
message
);
// parse file contents
return
SimTKOpenMMGromacsUtilities
::
getMacroModelAtomicRadii
(
numberOfAtoms
,
fileContents
,
top
,
radii
,
scaleFactor
);
}
/**---------------------------------------------------------------------------------------
Get solvent radii from parameter file (Simbios)
@param numberOfAtoms number of atoms
@param agbFile pointer to agb file contents
@param agbFileLength agb file length
@param top Gromacs topology data struct
@param radii vector to store Macromodel radii for each atom
@param scaleFactor scale factor
@return SimTKOpenMMCommon::DefaultReturn unless paramter file not opened
in which case return SimTKOpenMMCommon::ErrorReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGromacsUtilities
::
getMacroModelAtomicRadii
(
int
numberOfAtoms
,
char
*
agbFile
,
int
agbFileLength
,
const
t_topology
*
top
,
RealOpenMMVector
&
radii
,
RealOpenMM
scaleFactor
){
// ---------------------------------------------------------------------------------------
static
const
std
::
string
methodName
=
"
\n
SimTKOpenMMGromacsUtilities::getMacroModelAtomicRadii"
;
// ---------------------------------------------------------------------------------------
// read in file contents -- return error flag if file not opened
StringVector
fileContents
;
int
returnStatus
=
SimTKOpenMMUtilities
::
readCharacterArrayIntoStringVector
(
agbFile
,
agbFileLength
,
fileContents
);
std
::
stringstream
message
;
if
(
returnStatus
!=
SimTKOpenMMCommon
::
DefaultReturn
){
message
<<
" problem w/ agb file file>"
;
return
SimTKOpenMMCommon
::
ErrorReturn
;
}
else
{
message
<<
methodName
<<
" read "
<<
fileContents
.
size
()
<<
" lines from agb parameter file."
;
}
SimTKOpenMMLog
::
printMessage
(
message
);
// parse file contents
return
SimTKOpenMMGromacsUtilities
::
getMacroModelAtomicRadii
(
numberOfAtoms
,
fileContents
,
top
,
radii
,
scaleFactor
);
}
/**---------------------------------------------------------------------------------------
Get solvent radii from parameter file (Simbios)
@param numberOfAtoms number of atoms
@param fileContents StringVector containing file contents
@param top Gromacs topology data struct
@param radii vector to store Macromodel radii for each atom
@param scaleFactor scale factor
@return SimTKOpenMMCommon::DefaultReturn unless paramter file not opened
in which case return SimTKOpenMMCommon::ErrorReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGromacsUtilities
::
getMacroModelAtomicRadii
(
int
numberOfAtoms
,
const
StringVector
&
fileContents
,
const
t_topology
*
top
,
RealOpenMMVector
&
radii
,
RealOpenMM
scaleFactor
){
// ---------------------------------------------------------------------------------------
static
const
std
::
string
methodName
=
"
\n
SimTKOpenMMGromacsUtilities::getMacroModelAtomicRadii"
;
// ---------------------------------------------------------------------------------------
// parse file: parameterMap->[atomType] = radius
StringRealOpenMMMap
parameterMap
;
std
::
string
delimiter
=
" "
;
StringVector
tokenVector
;
std
::
stringstream
warningMessage
;
warningMessage
<<
methodName
;
int
printWarning
=
0
;
for
(
StringVectorCI
ii
=
fileContents
.
begin
();
ii
!=
fileContents
.
end
();
ii
++
){
std
::
string
line
=
*
ii
;
SimTKOpenMMUtilities
::
tokenizeString
(
line
,
tokenVector
,
delimiter
,
1
);
if
(
tokenVector
[
0
]
!=
"#"
&&
tokenVector
[
0
]
!=
"@"
&&
tokenVector
.
size
()
>=
2
){
parameterMap
[
tokenVector
[
0
]]
=
(
RealOpenMM
)
atof
(
tokenVector
[
1
].
c_str
()
);
}
else
{
printWarning
=
1
;
warningMessage
<<
"
\n
agb parameter file line=<"
<<
line
<<
"> is being skipped."
;
}
}
if
(
printWarning
){
SimTKOpenMMLog
::
printMessage
(
warningMessage
);
}
char
***
atomNames
=
top
->
atoms
.
atomname
;
// get radii
radii
.
resize
(
numberOfAtoms
);
for
(
int
ii
=
0
;
ii
<
numberOfAtoms
;
ii
++
){
char
*
atomTypeC
=
*
(
top
->
atoms
.
atomtype
[
ii
]);
std
::
string
atomType
=
atomTypeC
;
StringRealOpenMMMapCI
entry
=
parameterMap
.
find
(
atomType
);
if
(
entry
!=
parameterMap
.
end
()
){
radii
[
ii
]
=
scaleFactor
*
((
*
entry
).
second
);
//std::stringstream message;
//message << "\ntype found for atom=<" << (*(atomNames[ii])) << "> type=<" << atomType << "> r=" << radii[ii];
//SimTKOpenMMLog::printMessage( message );
}
else
{
radii
[
ii
]
=
(
RealOpenMM
)
0.000001
;
std
::
stringstream
message
;
message
<<
methodName
;
message
<<
" no type found for atom=<"
<<
(
*
(
atomNames
[
ii
]))
<<
"> type=<"
<<
atomType
<<
">"
;
SimTKOpenMMLog
::
printMessage
(
message
);
}
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/**---------------------------------------------------------------------------------------
Get string containing atom types
@param top Gromacs topology data struct
@return string
--------------------------------------------------------------------------------------- */
std
::
string
SimTKOpenMMGromacsUtilities
::
getAtomTypesString
(
const
t_topology
*
top
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMGromacsUtilities::getAtomTypesString";
// ---------------------------------------------------------------------------------------
char
***
atomNames
=
top
->
atoms
.
atomname
;
std
::
stringstream
message
;
for
(
int
ii
=
0
;
ii
<
top
->
atoms
.
nr
;
ii
++
){
char
*
atomTypeC
=
*
(
top
->
atoms
.
atomtype
[
ii
]);
message
<<
"
\n
"
<<
(
ii
+
1
)
<<
" "
<<
(
*
(
atomNames
[
ii
]))
<<
" "
<<
atomTypeC
;
}
return
message
.
str
();
}
/**---------------------------------------------------------------------------------------
Copy contents of Gromacs rvec array to RealOpenMM array
If realArray == NULL on input, then memory is allocated -- callee is responsible for
freeing memory:
SimTKOpenMMUtilities::Xfree( "realArrayBlock", __FILE__, __LINE__, realArray[0] );
SimTKOpenMMUtilities::Xfree( "realArray", __FILE__, __LINE__, realArray );
@param numberOfEntries number of entries in array
@param gromacsArray Gromac's array
@param realArray RealOpenMM** array (allocated if NULL on input)
@param scaleFactor scale factor
@return realArray
--------------------------------------------------------------------------------------- */
RealOpenMM
**
SimTKOpenMMGromacsUtilities
::
copyRvecArrayToRealOpenMMArray
(
int
numberOfEntries
,
rvec
*
gromacsArray
,
RealOpenMM
**
realArray
,
RealOpenMM
scaleFactor
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMGromacsUtilities::copyRvecArrayToRealOpenMMArray";
// ---------------------------------------------------------------------------------------
if
(
realArray
==
NULL
){
realArray
=
SimTKOpenMMUtilities
::
allocateTwoDRealOpenMMArray
(
numberOfEntries
,
3
,
NULL
,
false
,
0.0
);
}
for
(
int
ii
=
0
;
ii
<
numberOfEntries
;
ii
++
){
realArray
[
ii
][
0
]
=
scaleFactor
*
gromacsArray
[
ii
][
0
];
realArray
[
ii
][
1
]
=
scaleFactor
*
gromacsArray
[
ii
][
1
];
realArray
[
ii
][
2
]
=
scaleFactor
*
gromacsArray
[
ii
][
2
];
}
return
realArray
;
}
/**---------------------------------------------------------------------------------------
Get vectors of atom names, residue indices, and residue names from
Gromacs data structs (Simbios)
@param top Gromacs t_topolgy struct.
@param residueNames output residue names
@param residueIndices output residue indices
@param atomNames output atom names
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGromacsUtilities
::
getAtomResidueNames
(
const
t_topology
*
top
,
StringVector
&
residueNamesVector
,
IntVector
&
residueIndicesVector
,
StringVector
&
atomNamesVector
){
// ---------------------------------------------------------------------------------------
static
const
std
::
string
methodName
=
"
\n
SimTKOpenMMGromacsUtilities::getAtomResidueNames"
;
// ---------------------------------------------------------------------------------------
int
numberOfAtoms
=
top
->
atoms
.
nr
;
residueNamesVector
.
resize
(
numberOfAtoms
);
residueIndicesVector
.
resize
(
numberOfAtoms
);
atomNamesVector
.
resize
(
numberOfAtoms
);
// Gromacs arrays of atom and residue names
char
***
atomNames
=
top
->
atoms
.
atomname
;
char
***
residueNames
=
top
->
atoms
.
resname
;
// for each atom, set names, indices, ...
int
residueI
=
0
;
char
*
firstAtomName
=
NULL
;
std
::
string
residueName
;
for
(
int
atomI
=
0
;
atomI
<
numberOfAtoms
;
atomI
++
){
// check if hitting new residue
// save first atom in list to allow for check
// when another atom is hit
if
(
!
firstAtomName
){
firstAtomName
=
*
(
atomNames
[
atomI
]);
residueName
=
std
::
string
(
*
(
residueNames
[
residueI
])
);
}
else
if
(
!
strcmp
(
*
(
atomNames
[
atomI
]),
firstAtomName
)
){
residueI
++
;
residueName
=
std
::
string
(
*
(
residueNames
[
residueI
])
);
}
atomNamesVector
.
push_back
(
*
(
atomNames
[
atomI
])
);
residueNamesVector
.
push_back
(
residueName
);
residueIndicesVector
.
push_back
(
residueI
+
1
);
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/**---------------------------------------------------------------------------------------
Read xyz file
@param numberOfAtoms number of atoms
@param atomCoordinates atom coordinates
@param top Gromacs topology struct
@param xyzFileName xyz file name
@return SimTKOpenMMCommon::DefaultReturn if no errors; SimTKOpenMMCommon::ErrorReturn if
file not found or invalid values found in file or number of atoms does
not match expected number
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMGromacsUtilities
::
readXyzFile
(
int
numberOfAtoms
,
rvec
*
atomCoordinates
,
const
t_topology
*
top
,
const
char
*
xyzFileName
){
// ---------------------------------------------------------------------------------------
const
int
bufferSize
=
1024
;
char
buffer
[
bufferSize
];
static
const
std
::
string
methodName
=
"
\n
SimTKOpenMMGromacsUtilities::readXyzFile"
;
// ----------------------------------------- ----------------------------------------------
std
::
string
fileName
=
"example.xyz"
;
FILE
*
xyzFile
;
#ifdef WIN32
fopen_s
(
&
xyzFile
,
fileName
.
c_str
(),
"r"
);
#else
xyzFile
=
fopen
(
fileName
.
c_str
(),
"r"
);
#endif
if
(
xyzFile
==
NULL
){
std
::
stringstream
message
;
message
<<
methodName
.
c_str
()
<<
" Could not open file=<"
<<
xyzFileName
<<
">."
;
SimTKOpenMMLog
::
printMessage
(
message
);
return
SimTKOpenMMCommon
::
ErrorReturn
;
}
else
{
std
::
stringstream
message
;
//message << methodName.c_str() << " Opened file=<" << xyzFileName << ">.";
//message << methodName.c_str() << " Opened file=<" << fileName << ">.";
// SimTKOpenMMLog::printMessage( message );
}
int
atomCount
=
0
;
int
lineCount
=
1
;
// skip first line
fgets
(
buffer
,
bufferSize
,
xyzFile
);
lineCount
++
;
//fprintf( AmoebaLog::getAmoebaLogFile(), "\nStart %s <%s>", methodName.c_str(), buffer );
//fflush( AmoebaLog::getAmoebaLogFile() );
while
(
atomCount
<
numberOfAtoms
&&
fgets
(
buffer
,
bufferSize
,
xyzFile
)
){
buffer
[
strlen
(
buffer
)
-
1
]
=
'\0'
;
// fprintf( AmoebaLog::getAmoebaLogFile(), "\n%d <%s>", atomCount, buffer );
// fflush( AmoebaLog::getAmoebaLogFile() );
// std::stringstream message;
// message << "\n<" << buffer << ">";
StringVector
tokens
;
SimTKOpenMMUtilities
::
tokenizeString
(
buffer
,
tokens
);
if
(
tokens
.
size
()
<
5
){
std
::
stringstream
message
;
message
<<
"
\n
Problem w/ line="
<<
lineCount
<<
" <"
<<
buffer
<<
">"
;
SimTKOpenMMLog
::
printMessage
(
message
);
return
SimTKOpenMMCommon
::
ErrorReturn
;
}
StringVectorI
ii
=
tokens
.
begin
()
+
2
;
int
coordinateCount
=
0
;
while
(
ii
!=
tokens
.
end
()
&&
coordinateCount
++
<
3
){
//if( SimTKOpenMMUtilities::isValidRealOpenMM( *ii ) ){
atomCoordinates
[
atomCount
][
coordinateCount
++
]
=
0.1
f
*
((
RealOpenMM
)
atof
(
(
*
ii
).
c_str
()
));
ii
++
;
/*
} else {
std::stringstream message;
message << "\nProblem w/ line=" << lineCount << " token=<" << *ii << "> is not real: line=<" << buffer << ">";
SimTKOpenMMLog::printMessage( message );
return SimTKOpenMMCommon::ErrorReturn;
}
*/
}
lineCount
++
;
atomCount
++
;
}
(
void
)
fclose
(
xyzFile
);
// validate atom count
if
(
atomCount
!=
numberOfAtoms
){
std
::
stringstream
message
;
message
<<
"
\n
Atom count="
<<
atomCount
<<
" does not match number of atoms="
<<
numberOfAtoms
;
SimTKOpenMMLog
::
printMessage
(
message
);
return
SimTKOpenMMCommon
::
ErrorReturn
;
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
platforms/reference/src/SimTKUtilities/SimTKOpenMMGromacsUtilities.h
0 → 100755
View file @
598e076c
/* Portions copyright (c) 2006 Stanford University and Simbios.
* Contributors: Pande Group
*
* 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.
*/
#ifndef __SimTKOpenMMGromacsUtilities_H_
#define __SimTKOpenMMGromacsUtilities_H_
// ---------------------------------------------------------------------------------------
// class of shared, static utility methods
#include "SimTKOpenMMCommon.h"
#include <stdio.h>
#include <string.h>
#include <string>
#include <stdlib.h>
#include <sstream>
// ---------------------------------------------------------------------------------------
// Gromac's types
#include "typedefs.h"
// ---------------------------------------------------------------------------------------
#define ATOM_ID_STRING_TAB 12
#define MAX_DEBUG_FIELDS 20
/**---------------------------------------------------------------------------------------
Class of static methods to be shared
Most methods are standalone 'utility' methods
--------------------------------------------------------------------------------------- */
class
SimTKOpenMMGromacsUtilities
{
public:
enum
ForceField
{
AmoebaForceField
,
AmberForceField
};
// dummy constructor/destructor
SimTKOpenMMGromacsUtilities
(){};
~
SimTKOpenMMGromacsUtilities
(){};
/**---------------------------------------------------------------------------------------
Find distances**2 from a given atom (Simbios)
@param atomCoordinates atom coordinates
@param atomIndex atom index to find distances from
@param numberOfAtoms number of atoms
@param distances array of distances squared on @return; array size must be at least
numberOfAtoms
@return distances
--------------------------------------------------------------------------------------- */
static
int
getDistanceSquaredFromSpecifiedAtom
(
const
rvec
*
atomCoordinates
,
int
atomIndex
,
int
numberOfAtoms
,
float
*
distances
);
/**---------------------------------------------------------------------------------------
Find distances**2 from a given point (Simbios)
@param atomCoordinates atom coordinates
@param point point to find distances from
@param numberOfAtoms number of atoms
@param distances array of distances squared on @return; array size must be at least
numberOfAtoms
@return distances
--------------------------------------------------------------------------------------- */
static
int
getDistanceSquaredFromSpecifiedPoint
(
const
rvec
*
atomCoordinates
,
float
*
point
,
int
numberOfAtoms
,
float
*
distances
);
/**---------------------------------------------------------------------------------------
Get atom name from top data struct
@param atomIndex atom index
@param outputAtomName output atom name
@param top GMX t_topology struct
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
getAtomNameGivenAtomIndex
(
int
atomIndex
,
char
*
outputAtomName
,
const
t_topology
*
top
);
/**---------------------------------------------------------------------------------------
Get residue name from top data struct given atom index
@param atomIndex atom index
@param top GMX t_topology struct
@param outputResidueName output residue name
@param outputResidueIndex if not null, then *outputResidueIndex is residue index
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
getResidueNameGivenAtomIndex
(
int
atomIndex
,
const
t_topology
*
top
,
char
*
outputResidueName
,
int
*
outputResidueIndex
);
/**---------------------------------------------------------------------------------------
Get atom name from top data struct
@param atomIndex atom index
@param top GMX t_topology struct
@param buffer output buffer (enough space should have been reserved)
@param maxAtoms max number of atoms for this run (may change -- used mainly
to keep from reallocating cache array)
@param tab tab spacing
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
getAtomIdStringGivenAtomIndex
(
int
atomIndex
,
const
t_topology
*
top
,
int
sizeOfBuffer
,
char
*
buffer
,
int
maxAtoms
,
unsigned
int
tab
);
/**---------------------------------------------------------------------------------------
Get (1-2) bonds (Simbios)
@param maxAtoms max number of atoms
@param IntSetVector vector of integer sets
@param top Gromacs t_topolgy struct
@return 0 if no errors or
return x, where x is the number of errors encountered
covalentBonds[i] = set of atom indices that are covalent partners
--------------------------------------------------------------------------------------- */
static
int
getCovalentBondIndices
(
int
maxAtoms
,
IntSetVector
&
covalentBonds
,
const
t_topology
*
top
);
/**---------------------------------------------------------------------------------------
Get SETTLE stretch (1-2) bonds (Simbios)
@param maxAtoms max number of atoms
@param IntSetVector vector of integer sets
@param top Gromacs t_topolgy struct
@return SimTKOpenMMCommon::DefaultReturn if no errors or
return x, where x is the number of errors encountered
--------------------------------------------------------------------------------------- */
static
int
getSettleCovalentBondIndices
(
int
maxAtoms
,
IntSetVector
&
covalentBonds
,
const
t_topology
*
top
);
/**---------------------------------------------------------------------------------------
Read xyz file
@param numberOfAtoms number of atoms
@param atomCoordinates atom coordinates
@param top Gromacs topology struct
@param xyzFileName xyz file name
@return SimTKOpenMMCommon::DefaultReturn if no errors; SimTKOpenMMCommon::ErrorReturn if
file not found or invalid values found in file or number of atoms does
not match expected number
--------------------------------------------------------------------------------------- */
static
int
readXyzFile
(
int
numberOfAtoms
,
rvec
*
atomCoordinates
,
const
t_topology
*
top
,
const
char
*
xyzFileName
);
/**---------------------------------------------------------------------------------------
Write Tinker xyz file (Simbios)
@param numberOfAtoms number of atoms
@param atomCoordinates atom coordinates
@param header header
@param xyzFileName output file name
@param top Gromacs topology struct
@return 0 unless error detected
Currently no attempt is made to get the atom name/type to accurately
reflect the Tinker names/types. Rather method is used to output atoms
in Gromacs order and then reorder those in a corresponding xyz file
w/ the correct atom names/types so that they match the Gromacs order
This makes it easier to compare results between Gromacs and Tinker
--------------------------------------------------------------------------------------- */
static
int
writeTinkerXyzFile
(
int
numberOfAtoms
,
const
rvec
*
atomCoordinates
,
const
std
::
string
&
header
,
const
std
::
string
&
xyzFileName
,
const
t_topology
*
top
);
/**---------------------------------------------------------------------------------------
Get Tinker biotypes (Simbios)
@param numberOfAtoms number of atoms
@param top Gromacs topology struct
@param tinkerAtomNames Tinker atom names upon return
@param tinkerResidueNames Tinker residue names upon return
@param tinkerBiotypes Tinker biotypes upon return
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
getTinkerBiotypes
(
int
numberOfAtoms
,
const
t_topology
*
top
,
StringVector
&
tinkerAtomNames
,
StringVector
&
tinkerResidueNames
,
IntVector
&
tinkerBiotypes
);
/**---------------------------------------------------------------------------------------
Get atomic numbers
@param top Gromac's topology struct
@param atomicNumber output atomic numbers
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
getAtomicNumbers
(
const
t_topology
*
top
,
IntVector
&
atomicNumber
);
/**---------------------------------------------------------------------------------------
Get OBC scale factors
@param top Gromac's topology struct
@param scaleFactors output atomic numbers
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
getObcScaleFactors
(
const
t_topology
*
top
,
RealOpenMM
*
scaleFactors
);
/**---------------------------------------------------------------------------------------
Get OBC scale factors
@param top Gromac's topology struct
@param scaleFactors output atomic numbers
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
getObcScaleFactors
(
const
t_topology
*
top
,
RealOpenMMVector
&
scaleFactors
);
/**---------------------------------------------------------------------------------------
Get Tinker biotype index given residue and atom names (Simbios)
@param tinkerResidueName Tinker residue name
@param tinkerAtomName Tinker atom name
@return biotype if able to map names; otherwise return -1
--------------------------------------------------------------------------------------- */
static
int
getBiotypeGivenResidueAtomNames
(
const
std
::
string
&
tinkerResidueName
,
const
std
::
string
&
tinkerAtomName
);
/**---------------------------------------------------------------------------------------
Get Tinker biotype residue name given Gromacs residue name (Simbios)
@param gromacsResidueName Gromac's residue name.
@return AmoebaCommon::AmoebaNotSet if name not found in mapping
--------------------------------------------------------------------------------------- */
static
std
::
string
getTinkerBiotypeResidueNameGivenGromacsResidueName
(
const
std
::
string
gromacsResidueName
);
/**---------------------------------------------------------------------------------------
Get Tinker-Gromacs residue name map (Simbios)
The hash map is implemented as singleton
@return StringMap mapping Gromac's residue names to Tinker biotype residue names
--------------------------------------------------------------------------------------- */
static
StringMap
*
getTinkerGromacsResidueNameMap
(
void
);
/**---------------------------------------------------------------------------------------
Get residue name map ( Gromacs -> Tinker ) string (Simbios)
@return string containing contents of residue map
--------------------------------------------------------------------------------------- */
static
std
::
string
getTinkerGromacsResidueNameMapString
(
void
);
/**---------------------------------------------------------------------------------------
Get Tinker residue/atom name -> biotype map (Simbios)
@param forceField forceFileIndex
The hash map is implemented as singleton
@return StringIntMap mapping Tinker residue_atomName -> Tinker biotype
--------------------------------------------------------------------------------------- */
static
StringIntMap
*
getTinkerResidueAtomNameBiotypeMap
(
int
forceField
);
/**---------------------------------------------------------------------------------------
Get solvent radii from parameter file (Simbios)
@param numberOfAtoms number of atoms
@param parameterFileName parameter file name
@param top Gromacs topology data struct
@param radii array store Macromodel radii for each atom
@param scaleFactor scale factor
@return SimTKOpenMMCommon::DefaultReturn unless paramter file not opened
in which case return SimTKOpenMMCommon::ErrorReturn
--------------------------------------------------------------------------------------- */
static
int
getMacroModelAtomicRadii
(
int
numberOfAtoms
,
const
std
::
string
parameterFileName
,
const
t_topology
*
top
,
RealOpenMM
*
radii
,
RealOpenMM
scaleFactor
=
1.0
);
/**---------------------------------------------------------------------------------------
Get solvent radii from parameter file (Simbios)
@param numberOfAtoms number of atoms
@param parameterFileName parameter file name
@param top Gromacs topology data struct
@param radii vector to store Macromodel radii for each atom
@param scaleFactor scale factor
@return SimTKOpenMMCommon::DefaultReturn unless paramter file not opened
in which case return SimTKOpenMMCommon::ErrorReturn
--------------------------------------------------------------------------------------- */
static
int
getMacroModelAtomicRadii
(
int
numberOfAtoms
,
const
std
::
string
parameterFileName
,
const
t_topology
*
top
,
RealOpenMMVector
&
radii
,
RealOpenMM
scaleFactor
=
1.0
);
/**---------------------------------------------------------------------------------------
Get solvent radii from parameter file (Simbios)
@param numberOfAtoms number of atoms
@param agbFile pointer to agb file contents
@param agbFileLength agb file length
@param top Gromacs topology data struct
@param radii vector to store Macromodel radii for each atom
@param scaleFactor scale factor
@return SimTKOpenMMCommon::DefaultReturn unless paramter file not opened
in which case return SimTKOpenMMCommon::ErrorReturn
--------------------------------------------------------------------------------------- */
static
int
getMacroModelAtomicRadii
(
int
numberOfAtoms
,
char
*
agbFile
,
int
agbFileLength
,
const
t_topology
*
top
,
RealOpenMMVector
&
radii
,
RealOpenMM
scaleFactor
=
1.0
);
/**---------------------------------------------------------------------------------------
Get solvent radii from parameter file (Simbios)
@param numberOfAtoms number of atoms
@param fileContents StringVector containing file contents
@param top Gromacs topology data struct
@param radii vector to store Macromodel radii for each atom
@param scaleFactor scale factor
@return SimTKOpenMMCommon::DefaultReturn unless paramter file not opened
in which case return SimTKOpenMMCommon::ErrorReturn
--------------------------------------------------------------------------------------- */
static
int
getMacroModelAtomicRadii
(
int
numberOfAtoms
,
const
StringVector
&
fileContents
,
const
t_topology
*
top
,
RealOpenMMVector
&
radii
,
RealOpenMM
scaleFactor
);
/**---------------------------------------------------------------------------------------
Get string containing atom types
@param top Gromacs topology data struct
@return string
--------------------------------------------------------------------------------------- */
static
std
::
string
getAtomTypesString
(
const
t_topology
*
top
);
/**---------------------------------------------------------------------------------------
Copy contents of Gromacs rvec array to RealOpenMM array
If realArray == NULL on input, then memory is allocated -- callee is responsible for
freeing memory:
SimTKOpenMMUtilities::Xfree( "realArrayBlock", __FILE__, __LINE__, realArray[0] );
SimTKOpenMMUtilities::Xfree( "realArray", __FILE__, __LINE__, realArray );
@param numberOfEntries number of entries in array
@param gromacsArray Gromac's array
@param realArray RealOpenMM** array (allocated if NULL on input)
@param scaleFactor scale factor
@return realArray
--------------------------------------------------------------------------------------- */
static
RealOpenMM
**
copyRvecArrayToRealOpenMMArray
(
int
numberOfEntries
,
rvec
*
gromacsArray
,
RealOpenMM
**
realArray
,
RealOpenMM
scaleFactor
=
1.0
);
/**---------------------------------------------------------------------------------------
Get vectors of atom names, residue indices, and residue names from
Gromacs data structs (Simbios)
@param top Gromacs t_topolgy struct.
@param residueNames output residue names
@param residueIndices output residue indices
@param atomNames output atom names
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
getAtomResidueNames
(
const
t_topology
*
top
,
StringVector
&
residueNames
,
IntVector
&
residueIndices
,
StringVector
&
atomNames
);
// ---------------------------------------------------------------------------------------
};
// ---------------------------------------------------------------------------------------
#endif // __SimTKOpenMMGromacsUtilities_H__
platforms/reference/src/SimTKUtilities/SimTKOpenMMLog.cpp
0 → 100644
View file @
598e076c
/* Portions copyright (c) 2006 Stanford University and Simbios.
* Contributors: Pande Group
*
* 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 "SimTKOpenMMLog.h"
// static settings
SimTKOpenMMLog
*
SimTKOpenMMLog
::
_simTKOpenMMLog
=
NULL
;
/**---------------------------------------------------------------------------------------
SimTKOpenMMLog constructor (Simbios)
@param logFile file reference for logging
--------------------------------------------------------------------------------------- */
SimTKOpenMMLog
::
SimTKOpenMMLog
(
FILE
*
logFile
)
:
_logFile
(
logFile
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMLog::SimTKOpenMMLog";
// ---------------------------------------------------------------------------------------
_logLevel
=
LogLowLevel
;
}
/**---------------------------------------------------------------------------------------
SimTKOpenMMLog destructor (Simbios)
--------------------------------------------------------------------------------------- */
SimTKOpenMMLog
::~
SimTKOpenMMLog
(
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMLog::~SimTKOpenMMLog";
// ---------------------------------------------------------------------------------------
}
/**---------------------------------------------------------------------------------------
Get LogFile
@return logFile
--------------------------------------------------------------------------------------- */
FILE
*
SimTKOpenMMLog
::
getLogFile
(
void
)
const
{
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMLog::getLogFile";
// ---------------------------------------------------------------------------------------
return
_logFile
;
}
/**---------------------------------------------------------------------------------------
Set LogFile
@param input logFile
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMLog
::
setLogFile
(
FILE
*
logFile
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMLog::setLogFile";
// ---------------------------------------------------------------------------------------
_logFile
=
logFile
;
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/**---------------------------------------------------------------------------------------
Set LogLevel
@param input logLevel
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMLog
::
setLogLevel
(
SimTKOpenMMLog
::
LogLevels
logLevel
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMLog::setLogLevel";
// ---------------------------------------------------------------------------------------
_logLevel
=
logLevel
;
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/**---------------------------------------------------------------------------------------
SimTKOpenMMLog log message to log (Simbios)
@param message message to log
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMLog
::
logMessage
(
const
std
::
stringstream
&
message
)
const
{
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMLog::logMessage";
// ---------------------------------------------------------------------------------------
if
(
_logFile
){
// (void) fprintf( stderr, "%s", message.str().c_str() );
// (void) fflush( stderr );
(
void
)
fprintf
(
_logFile
,
"%s"
,
message
.
str
().
c_str
()
);
(
void
)
fflush
(
_logFile
);
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/**---------------------------------------------------------------------------------------
Set global simTKOpenMMLog (Simbios)
@param logFile file to log to
@return new SimTKOpenMMLog
--------------------------------------------------------------------------------------- */
SimTKOpenMMLog
*
SimTKOpenMMLog
::
setSimTKOpenMMLog
(
FILE
*
logFile
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMLog::setSimTKOpenMMLog";
// ---------------------------------------------------------------------------------------
// allow for multiple logs
/*
if( _simTKOpenMMLog ){
delete _simTKOpenMMLog;
}
*/
_simTKOpenMMLog
=
new
SimTKOpenMMLog
(
logFile
);
return
_simTKOpenMMLog
;
}
/**---------------------------------------------------------------------------------------
Get global simTKOpenMMLog -- static method (Simbios)
@return static member
--------------------------------------------------------------------------------------- */
SimTKOpenMMLog
*
SimTKOpenMMLog
::
getSimTKOpenMMLog
(
void
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMLog::getSimTKOpenMMLog";
// ---------------------------------------------------------------------------------------
if
(
!
_simTKOpenMMLog
){
_simTKOpenMMLog
=
new
SimTKOpenMMLog
(
);
}
return
_simTKOpenMMLog
;
}
/**---------------------------------------------------------------------------------------
Get global simTKOpenMMLog (Simbios)
@return FILE reference
--------------------------------------------------------------------------------------- */
FILE
*
SimTKOpenMMLog
::
getSimTKOpenMMLogFile
(
void
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMLog::getSimTKOpenMMLogFile";
// ---------------------------------------------------------------------------------------
SimTKOpenMMLog
*
simTKOpenMMLog
=
getSimTKOpenMMLog
(
);
return
simTKOpenMMLog
->
getLogFile
();
}
/**---------------------------------------------------------------------------------------
Static method to print message (Simbios)
@param message message to log
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMLog
::
printMessage
(
const
std
::
stringstream
&
message
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMLog::printMessage";
// ---------------------------------------------------------------------------------------
if
(
_simTKOpenMMLog
){
_simTKOpenMMLog
->
logMessage
(
message
);
}
else
{
(
void
)
fprintf
(
stderr
,
"%s"
,
message
.
str
().
c_str
()
);
(
void
)
fflush
(
stderr
);
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/**---------------------------------------------------------------------------------------
Static method to print warning message (Simbios)
If global _simTKOpenMMLog is not set, then print to stderr
@param message message to log
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMLog
::
printWarning
(
const
std
::
stringstream
&
message
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMLog::printWarning";
// ---------------------------------------------------------------------------------------
if
(
_simTKOpenMMLog
){
std
::
stringstream
messageWithHeader
;
messageWithHeader
<<
"Warning: "
<<
message
.
str
();
_simTKOpenMMLog
->
logMessage
(
messageWithHeader
);
}
else
{
(
void
)
fprintf
(
stderr
,
"Warning: %s"
,
message
.
str
().
c_str
()
);
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/**---------------------------------------------------------------------------------------
Static method to print error message and exit program (Simbios)
If global _simTKOpenMMLog is not set, then print to stderr
@param message message to log
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMLog
::
printError
(
const
std
::
stringstream
&
message
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMLog::printError";
// ---------------------------------------------------------------------------------------
if
(
_simTKOpenMMLog
){
std
::
stringstream
messageWithHeader
;
messageWithHeader
<<
"Error: "
<<
message
.
str
();
_simTKOpenMMLog
->
logMessage
(
messageWithHeader
);
}
else
{
(
void
)
fprintf
(
stderr
,
"Error: %s"
,
message
.
str
().
c_str
()
);
(
void
)
fflush
(
stderr
);
}
exit
(
-
1
);
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
platforms/reference/src/SimTKUtilities/SimTKOpenMMLog.h
0 → 100644
View file @
598e076c
/* Portions copyright (c) 2006 Stanford University and Simbios.
* Contributors: Pande Group
*
* 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.
*/
#ifndef __SimTKOpenMMLog_H__
#define __SimTKOpenMMLog_H__
#include <stdio.h>
#include <sstream>
#include "SimTKOpenMMCommon.h"
/** ---------------------------------------------------------------------------------------
SimTKOpenMMLog class used for logging
--------------------------------------------------------------------------------------- */
class
SimTKOpenMMLog
{
public:
// log levels
enum
LogLevels
{
LogOff
,
LogLowLevel
,
LogHighLevel
};
private:
// file to write to
FILE
*
_logFile
;
// log level
LogLevels
_logLevel
;
// global reference
static
SimTKOpenMMLog
*
_simTKOpenMMLog
;
public:
/**---------------------------------------------------------------------------------------
SimTKOpenMMLog constructor (Simbios)
@param logFile file reference for logging
--------------------------------------------------------------------------------------- */
SimTKOpenMMLog
(
FILE
*
logFile
=
NULL
);
/**---------------------------------------------------------------------------------------
SimTKOpenMMLog destructor (Simbios)
--------------------------------------------------------------------------------------- */
~
SimTKOpenMMLog
(
);
/**---------------------------------------------------------------------------------------
SimTKOpenMMLog log message to log (Simbios)
@param message message to log
@return 0
--------------------------------------------------------------------------------------- */
int
logMessage
(
const
std
::
stringstream
&
message
)
const
;
/**---------------------------------------------------------------------------------------
Get LogFile
@return logFile
--------------------------------------------------------------------------------------- */
FILE
*
getLogFile
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Set LogFile
@param input logFile
@return AmoebaCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
setLogFile
(
FILE
*
logFile
);
/**---------------------------------------------------------------------------------------
Set LogLevel
@param input logLevel
@return AmoebaCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
setLogLevel
(
SimTKOpenMMLog
::
LogLevels
logLevel
);
/**---------------------------------------------------------------------------------------
Set global simTKLog (Simbios)
@param logFile file to log to
@return new SimTKOpenMMLog
--------------------------------------------------------------------------------------- */
static
SimTKOpenMMLog
*
setSimTKOpenMMLog
(
FILE
*
logFile
=
NULL
);
/**---------------------------------------------------------------------------------------
Get global simTKLog -- static method (Simbios)
@return static member
--------------------------------------------------------------------------------------- */
static
SimTKOpenMMLog
*
getSimTKOpenMMLog
(
void
);
/**---------------------------------------------------------------------------------------
Get global simTKLog (Simbios)
@return FILE reference
--------------------------------------------------------------------------------------- */
static
FILE
*
getSimTKOpenMMLogFile
(
void
);
/**---------------------------------------------------------------------------------------
Staitc method to print message (Simbios)
@param message message to log
@return 0
--------------------------------------------------------------------------------------- */
static
int
printMessage
(
const
std
::
stringstream
&
message
);
/**---------------------------------------------------------------------------------------
Staitc method to print warning message (Simbios)
@param message message to log
@return 0
--------------------------------------------------------------------------------------- */
static
int
printWarning
(
const
std
::
stringstream
&
message
);
/**---------------------------------------------------------------------------------------
Static method to print error message and exist program (Simbios)
@param message message to log
@return 0
--------------------------------------------------------------------------------------- */
static
int
printError
(
const
std
::
stringstream
&
message
);
};
#endif //__SimTKOpenMMLog_H__
platforms/reference/src/SimTKUtilities/SimTKOpenMMRealType.h
0 → 100755
View file @
598e076c
/* Portions copyright (c) 2006 Stanford University and Simbios.
* Contributors: Pande Group
*
* 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.
*/
#ifndef __RealSimTk_H_
#define __RealSimTk_H__
#include <math.h>
// Set RealOpenMMType to 2 for double precision, 1 for float
#ifndef RealOpenMMType
#define RealOpenMMType 1
#endif
#if RealOpenMMType == 1
#define RealOpenMM float
#define SQRT sqrtf
#define POW powf
#define SIN sinf
#define COS cosf
#define TAN tanf
// LOG is used in Vishal's gpu code; modifying LOG -> LN
#define LN logf
#define EXP expf
#define FABS fabsf
#define ACOS acosf
#define ASIN asinf
#define ATAN atanf
#define TANH tanhf
#define ATOF atoff
#define PI_M 3.141592653589f
#define TWO_SIX 1.122462048309372981f
#define RADIAN 57.29577951308f
#define RADIAN_TO_DEGREE 57.29577951308f
#define LOG_TEN 2.302585092994045684f
#define SQRT_TWO 1.41421356237309504f
#define DEGREE_TO_RADIAN 0.01745329252f
#define RADIAN_INVERSE 0.01745329252f
#else
#define RealOpenMM double
#define SQRT sqrt
#define POW pow
#define SIN sin
#define COS cos
#define TAN tan
// LOG is used in Vishal's gpu code; modifying LOG -> LN
#define LN log
#define EXP exp
#define FABS fabs
#define ACOS acos
#define ASIN asin
#define ATAN atan
#define TANH tanh
#define ATOF atof
#define PI_M 3.141592653589
#define TWO_SIX 1.122462048309372981
#define RADIAN 57.29577951308
#define RADIAN_TO_DEGREE 57.29577951308
#define LOG_TEN 2.302585092994045684
#define SQRT_TWO 1.41421356237309504
#define DEGREE_TO_RADIAN 0.01745329252
#define RADIAN_INVERSE 0.01745329252
#endif
#define DOT3(u,v) ((u[0])*(v[0]) + (u[1])*(v[1]) + (u[2])*(v[2]))
#define MATRIXDOT3(u,v) u[0]*v[0] + u[1]*v[1] + u[2]*v[2] + \
u[3]*v[3] + u[4]*v[4] + u[5]*v[5] + \
u[6]*v[6] + u[7]*v[7] + u[8]*v[8]
// physics constants -- from Gromacs physics.h
#ifndef M_PI
#ifdef _PI
#define M_PI _PI
#else
#define M_PI 3.14159265358979323846
#endif
#endif
#define ANGSTROM (1e-10)
#define KILO (1e3)
#define NANO (1e-9)
#define PICO (1e-12)
#define A2NM (ANGSTROM/NANO)
#define NM2A (NANO/ANGSTROM)
#define RAD2DEG (180.0/M_PI)
// #define DEG2RAD (M_PI/180.0)
#define CAL2JOULE (4.184)
#define E_CHARGE (1.60217733e-19)
#define AMU (1.6605402e-27)
#define BOLTZMANN (1.380658e-23)
/* (J/K) */
#define AVOGADRO (6.0221367e23)
#define RGAS (BOLTZMANN*AVOGADRO)
/* (J/(mol K)) */
#define BOLTZ (RGAS/KILO)
/* (kJ/(mol K)) */
#define FARADAY (E_CHARGE*AVOGADRO)
/* (C/mol) */
#define ELECTRONVOLT (E_CHARGE*AVOGADRO/KILO)
/* (kJ/mol) */
#define EPSILON0 (5.72765E-4)
/* (e^2 Na/(kJ nm)) == (e^2/(kJ mol nm)) */
#define SPEED_OF_LIGHT (2.9979245800E05)
/* nm/ps */
#define ATOMICMASS_keV (940000.0)
/* Atomic mass in keV */
#define ELECTRONMASS_keV (512.0)
/* Electron mas in keV */
#define FACEL 332.0636*CAL2JOULE
/* (sqrt(ONE_4PI_EPS0)) */
#define ONE_4PI_EPS0 FACEL*0.1
#define PRESFAC (16.6054)
/* bar / pressure unity */
#define ENM2DEBYE 48.0321
/* Convert electron nm to debye */
#define DEBYE2ENM 0.02081941
#endif // __RealSimTk_H__
platforms/reference/src/SimTKUtilities/SimTKOpenMMUtilities.cpp
0 → 100644
View file @
598e076c
/* Portions copyright (c) 2006 Stanford University and Simbios.
* Contributors: Pande Group
*
* 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.
*/
// class of shared, static utility methods
#include "SimTKOpenMMUtilities.h"
#include "SimTKOpenMMLog.h"
// fabs(), ...
#include <math.h>
/* ---------------------------------------------------------------------------------------
Find distances**2 from a given atom (Simbios)
@param atomCoordinates atom coordinates
@param atomIndex atom index to find distances from
@param numberOfAtoms number of atoms
@param distances array of distances squared on return; array size must be at least
numberOfAtoms
@param log if set, then print error messages to log file
@return distances
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMUtilities
::
getDistanceSquaredFromSpecifiedAtom
(
RealOpenMM
**
atomCoordinates
,
int
atomIndex
,
int
numberOfAtoms
,
RealOpenMM
*
distances
,
FILE
*
log
){
// ---------------------------------------------------------------------------------------
RealOpenMM
atomXyz
[
3
];
// static const char* methodName = "\nSimTKOpenMMUtilities::getDistanceSquaredFromSpecifiedAtom";
// ---------------------------------------------------------------------------------------
for
(
int
jj
=
0
;
jj
<
3
;
jj
++
){
atomXyz
[
jj
]
=
atomCoordinates
[
atomIndex
][
jj
];
}
return
getDistanceSquaredFromSpecifiedPoint
(
atomCoordinates
,
atomXyz
,
numberOfAtoms
,
distances
,
log
);
}
/* ---------------------------------------------------------------------------------------
Find distances**2 from a given point (Simbios)
@param atomCoordinates atom coordinates
@param point point to find distances from
@param numberOfAtoms number of atoms
@param distances array of distances squared on return; array size must be at least \n
numberOfAtoms
@param log if set, then print error messages to log file
@return distances
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMUtilities
::
getDistanceSquaredFromSpecifiedPoint
(
RealOpenMM
**
atomCoordinates
,
RealOpenMM
*
point
,
int
numberOfAtoms
,
RealOpenMM
*
distances
,
FILE
*
log
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMUtilities::getDistanceSquaredFromSpecifiedPoint";
// ---------------------------------------------------------------------------------------
memset
(
distances
,
0
,
sizeof
(
RealOpenMM
)
*
numberOfAtoms
);
for
(
int
ii
=
0
;
ii
<
numberOfAtoms
;
ii
++
){
for
(
int
jj
=
0
;
jj
<
3
;
jj
++
){
RealOpenMM
diff
=
(
point
[
jj
]
-
atomCoordinates
[
ii
][
jj
]);
distances
[
ii
]
+=
diff
*
diff
;
}
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/* ---------------------------------------------------------------------------------------
Helper method to allocate RealOpenMM arrays (Simbios)
@param bufferIndex buffer index
@param allocatedSz array of allocated sizes
@param bufferArray array of allocated RealOpenMM arrays
@param requestedSize requested size
@param dataAction action flag: -1 = free memory \n
1 = zero memory
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMUtilities
::
allocateRealOpenMMBufferArray
(
int
bufferIndex
,
int
*
allocatedSz
,
RealOpenMM
**
bufferArray
,
int
requestedSize
,
int
dataAction
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMUtilities::allocateRealOpenMMBufferArray";
// ---------------------------------------------------------------------------------------
// clear data
if
(
dataAction
==
-
1
){
if
(
allocatedSz
[
bufferIndex
]
&&
bufferArray
[
bufferIndex
]
){
SimTKOpenMMUtilities
::
Xfree
(
"bufferArray"
,
__FILE__
,
__LINE__
,
bufferArray
[
bufferIndex
]
);
allocatedSz
[
bufferIndex
]
=
0
;
bufferArray
[
bufferIndex
]
=
NULL
;
}
}
// return if requested size is less than allocated
if
(
allocatedSz
[
bufferIndex
]
>
requestedSize
){
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
// free space if currently allocated
if
(
allocatedSz
[
bufferIndex
]
&&
bufferArray
[
bufferIndex
]
){
SimTKOpenMMUtilities
::
Xfree
(
"bufferArray"
,
__FILE__
,
__LINE__
,
bufferArray
[
bufferIndex
]
);
}
// allocate
// bufferArray[bufferIndex] = (RealOpenMM*) malloc( requestedSize*sizeof( RealOpenMM ) );
bufferArray
[
bufferIndex
]
=
(
RealOpenMM
*
)
SimTKOpenMMUtilities
::
Xmalloc
(
"bufferArray"
,
__FILE__
,
__LINE__
,
requestedSize
*
sizeof
(
RealOpenMM
)
);
allocatedSz
[
bufferIndex
]
=
requestedSize
;
// zero?
if
(
dataAction
==
1
){
memset
(
bufferArray
[
bufferIndex
],
0
,
requestedSize
*
sizeof
(
RealOpenMM
)
);
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/* ---------------------------------------------------------------------------------------
Print atom coordinates, ...
@param numberAtoms numberAtoms
@param atomCoordinates atomCoordinates (may be NULL)
@param numberOf1Darrays number of 1-d arrays (may be 0)
@param oneDArrays 1-d arrays
@param idString id string to be printed if set
@param log print messages to log file
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMUtilities
::
printCoordinateAnd1DArrays
(
int
numberAtoms
,
RealOpenMM
**
atomCoordinates
,
int
numberOf1Darrays
,
RealOpenMM
**
oneDArrays
,
const
char
*
idString
,
FILE
*
log
){
// ---------------------------------------------------------------------------------------
if
(
log
==
NULL
){
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
if
(
idString
){
(
void
)
fprintf
(
log
,
"
\n
%s"
,
idString
);
}
for
(
int
ii
=
0
;
ii
<
numberAtoms
;
ii
++
){
if
(
atomCoordinates
!=
NULL
){
(
void
)
fprintf
(
log
,
"
\n
%d %12.4f %12.4f %12.4f"
,
ii
+
1
,
atomCoordinates
[
ii
][
0
],
atomCoordinates
[
ii
][
1
],
atomCoordinates
[
ii
][
2
]
);
}
else
{
(
void
)
fprintf
(
log
,
"
\n
"
);
}
for
(
int
jj
=
0
;
jj
<
numberOf1Darrays
;
jj
++
){
(
void
)
fprintf
(
log
,
" %12.4f"
,
oneDArrays
[
jj
][
ii
]
);
}
}
(
void
)
fflush
(
log
);
// ---------------------------------------------------------------------------------------
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/* ---------------------------------------------------------------------------------------
Free array of strings
@param arraySz atom index
@param arrayOfStrings array of strings
@return SimTKOpenMMCommon::DefaultReturn
Used for freeing an array of strings
@see getAtomIdStringGivenAtomIndex()
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMUtilities
::
freeArrayOfStrings
(
int
arraySz
,
char
**
arrayOfStrings
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMUtilities::freeArrayOfStrings";
// ---------------------------------------------------------------------------------------
// free memory if allocated
for
(
int
ii
=
0
;
ii
<
arraySz
;
ii
++
){
if
(
arrayOfStrings
[
ii
]
){
SimTKOpenMMUtilities
::
Xfree
(
"atomIdStrings"
,
__FILE__
,
__LINE__
,
arrayOfStrings
[
ii
]
);
}
}
SimTKOpenMMUtilities
::
Xfree
(
"arrayOfStrings"
,
__FILE__
,
__LINE__
,
arrayOfStrings
);
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/* ---------------------------------------------------------------------------------------
Tab string in place
@param string string to tab; assume string is of at least length=tab + 1
@param tab tab spacing length
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMUtilities
::
tabStringInPlace
(
char
*
string
,
int
tab
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMUtilities::tabStringInPlace";
// ---------------------------------------------------------------------------------------
for
(
int
ii
=
(
int
)
strlen
(
string
);
ii
<
tab
;
ii
++
){
string
[
ii
]
=
' '
;
}
string
[
tab
]
=
'\0'
;
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/* ---------------------------------------------------------------------------------------
Write debug fields (Simbios)
@param numberOfFields number of fields to print
@param fields fields
@param numberOfStringFields number of string fields to print
@param stringFields string fields
@param comment comment (optinal -- ignored if NULL)
@param debugFileName output debug file name
@param action 0 open file and return w/o printing \n
1 open file and print \n
2 close file (no print) \n
@param log if set, then print error messages to log file
@return debugFile unless file coud not be opened (or other errors )
or file is closed -- for these cases return NULL
stringFields printed after RealOpenMM fields
--------------------------------------------------------------------------------------- */
FILE
*
SimTKOpenMMUtilities
::
writeDebugFile
(
int
numberOfFields
,
const
RealOpenMM
*
fields
,
int
numberOfStringFields
,
const
StringVector
&
stringFields
,
const
char
*
comment
,
const
char
*
debugFileName
,
int
action
,
FILE
*
debugFile
,
FILE
*
log
){
// ---------------------------------------------------------------------------------------
static
const
char
*
methodName
=
"
\n
SimTKOpenMMUtilities::writeDebugFile"
;
// ---------------------------------------------------------------------------------------
if
(
debugFileName
!=
NULL
&&
(
action
<=
WriteDebugFile
||
debugFile
==
NULL
)
){
// open file
#ifdef WIN32
fopen_s
(
&
debugFile
,
debugFileName
,
"w"
);
#else
debugFile
=
fopen
(
debugFileName
,
"w"
);
#endif
if
(
debugFile
!=
NULL
){
if
(
log
!=
NULL
){
(
void
)
fprintf
(
log
,
"%s opened file=<%s>."
,
methodName
,
debugFileName
);
(
void
)
fflush
(
log
);
}
}
else
{
if
(
log
!=
NULL
){
(
void
)
fprintf
(
log
,
"%s could not open file=<%s> -- abort output."
,
methodName
,
debugFileName
);
(
void
)
fflush
(
log
);
}
return
NULL
;
}
if
(
action
==
OpenDebugFile
){
return
debugFile
;
}
}
else
if
(
action
==
CloseDebugFile
){
// close file
if
(
debugFile
){
if
(
log
!=
NULL
){
(
void
)
fprintf
(
log
,
"%s closed debug file=<%s>."
,
methodName
,
debugFileName
==
NULL
?
"??"
:
debugFileName
);
(
void
)
fflush
(
log
);
}
(
void
)
fclose
(
debugFile
);
}
return
NULL
;
}
if
(
comment
!=
NULL
){
(
void
)
fprintf
(
debugFile
,
"%s"
,
comment
);
}
if
(
numberOfFields
>
0
||
numberOfStringFields
>
0
){
(
void
)
fprintf
(
debugFile
,
"
\n
"
);
if
(
numberOfFields
>
0
||
fields
!=
NULL
){
for
(
int
ii
=
0
;
ii
<
numberOfFields
;
ii
++
){
(
void
)
fprintf
(
debugFile
,
"%.5e "
,
fields
[
ii
]
);
}
}
if
(
numberOfStringFields
>
0
){
for
(
StringVectorCI
ii
=
stringFields
.
begin
();
ii
!=
stringFields
.
end
()
;
ii
++
){
(
void
)
fprintf
(
debugFile
,
"%s "
,
(
*
ii
).
c_str
()
);
}
}
}
(
void
)
fflush
(
debugFile
);
return
debugFile
;
}
/* ---------------------------------------------------------------------------------------
Allocate 1D RealOpenMM array (Simbios)
array[i]
@param iSize i-dimension
@param array1D array (if null on entry allocated)
@param initialize if true, then initialize array
@param initialValue intitial value
@param idString id string
@return allocated array
--------------------------------------------------------------------------------------- */
RealOpenMM
*
SimTKOpenMMUtilities
::
allocateOneDRealOpenMMArray
(
int
iSize
,
RealOpenMM
*
array1D
,
int
initialize
,
RealOpenMM
initialValue
,
const
std
::
string
&
idString
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMUtilities::allocate1DRealOpenMMArray";
static
const
RealOpenMM
zero
=
0.0
;
// ---------------------------------------------------------------------------------------
if
(
array1D
==
NULL
){
array1D
=
(
RealOpenMM
*
)
SimTKOpenMMUtilities
::
Xmalloc
(
idString
.
c_str
(),
__FILE__
,
__LINE__
,
iSize
*
sizeof
(
RealOpenMM
)
);
}
if
(
initialize
){
if
(
initialValue
==
zero
){
memset
(
array1D
,
0
,
iSize
*
sizeof
(
RealOpenMM
)
);
}
else
{
for
(
int
ii
=
0
;
ii
<
iSize
;
ii
++
){
array1D
[
ii
]
=
initialValue
;
}
}
}
return
array1D
;
}
/* ---------------------------------------------------------------------------------------
Allocate 2D RealOpenMM array (Simbios)
array[i][j]
@param iSize i-dimension
@param jSize j-dimension
@param array2D array (if null on entry allocated)
@param initialize if true, then initialize array
@param initialValue intitial value
@param idString id string
@return allocated array
--------------------------------------------------------------------------------------- */
RealOpenMM
**
SimTKOpenMMUtilities
::
allocateTwoDRealOpenMMArray
(
int
iSize
,
int
jSize
,
RealOpenMM
**
array2D
,
int
initialize
,
RealOpenMM
initialValue
,
const
std
::
string
&
idString
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMUtilities::allocate2DRealOpenMMArray";
// ---------------------------------------------------------------------------------------
if
(
array2D
==
NULL
){
array2D
=
(
RealOpenMM
**
)
SimTKOpenMMUtilities
::
Xmalloc
(
idString
.
c_str
(),
__FILE__
,
__LINE__
,
iSize
*
sizeof
(
RealOpenMM
*
)
);
std
::
string
blockString
=
idString
;
blockString
.
append
(
"Block"
);
RealOpenMM
*
block
=
(
RealOpenMM
*
)
SimTKOpenMMUtilities
::
Xmalloc
(
blockString
.
c_str
(),
__FILE__
,
__LINE__
,
jSize
*
iSize
*
sizeof
(
RealOpenMM
)
);
for
(
int
ii
=
0
;
ii
<
iSize
;
ii
++
){
array2D
[
ii
]
=
block
;
block
+=
jSize
;
}
}
if
(
initialize
){
initialize2DRealOpenMMArray
(
iSize
,
jSize
,
array2D
,
initialValue
);
}
return
array2D
;
}
/* ---------------------------------------------------------------------------------------
Free 2D RealOpenMM array (Simbios)
array[i][j]
@param array2D array (if null on entry allocated)
@param idString id string
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMUtilities
::
freeTwoDRealOpenMMArray
(
RealOpenMM
**
array2D
,
const
std
::
string
&
idString
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMUtilities::freeTwoDRealOpenMMArray";
// ---------------------------------------------------------------------------------------
if
(
array2D
!=
NULL
){
std
::
string
blockString
=
idString
;
blockString
.
append
(
"Block"
);
SimTKOpenMMUtilities
::
Xfree
(
blockString
.
c_str
(),
__FILE__
,
__LINE__
,
array2D
[
0
]
);
SimTKOpenMMUtilities
::
Xfree
(
idString
.
c_str
(),
__FILE__
,
__LINE__
,
array2D
);
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/* ---------------------------------------------------------------------------------------
Free 1D RealOpenMM array (Simbios)
array[i]
@param array1D array (if null on entry allocated)
@param idString id string
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMUtilities
::
freeOneDRealOpenMMArray
(
RealOpenMM
*
array1D
,
const
std
::
string
&
idString
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMUtilities::freeOneDRealOpenMMArray";
// ---------------------------------------------------------------------------------------
if
(
array1D
!=
NULL
){
SimTKOpenMMUtilities
::
Xfree
(
idString
.
c_str
(),
__FILE__
,
__LINE__
,
array1D
);
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/* ---------------------------------------------------------------------------------------
Initialize 2D RealOpenMM array (Simbios)
array[i][j]
@param iSize i-dimension
@param jSize j-dimension
@param array2D array (if null on entry allocated)
@param initialValue intitial value
@return array
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMUtilities
::
initialize2DRealOpenMMArray
(
int
iSize
,
int
jSize
,
RealOpenMM
**
array2D
,
RealOpenMM
initialValue
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMUtilities::initialize2DRealOpenMMArray";
// ---------------------------------------------------------------------------------------
bool
useMemset
;
bool
useMemsetSingleBlock
;
if
(
initialValue
==
0.0
f
){
useMemset
=
true
;
if
(
jSize
>
1
&&
(
array2D
[
0
]
+
jSize
)
==
array2D
[
1
]
){
useMemsetSingleBlock
=
true
;
}
else
{
useMemsetSingleBlock
=
false
;
}
}
else
{
useMemset
=
false
;
}
if
(
useMemset
){
if
(
useMemsetSingleBlock
){
memset
(
array2D
[
0
],
0
,
iSize
*
jSize
*
sizeof
(
RealOpenMM
)
);
}
else
{
for
(
int
ii
=
0
;
ii
<
iSize
;
ii
++
){
memset
(
array2D
[
ii
],
0
,
jSize
*
sizeof
(
RealOpenMM
)
);
}
}
}
else
{
for
(
int
ii
=
0
;
ii
<
iSize
;
ii
++
){
for
(
int
jj
=
0
;
jj
<
jSize
;
jj
++
){
array2D
[
ii
][
jj
]
=
initialValue
;
}
}
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/* ---------------------------------------------------------------------------------------
Malloc memory of size bytesToAllocate and zero
@param bytesToAllocate bytes to allocate
@return ptr to allocated memory; NULL if bytesToAllocate <= 0
--------------------------------------------------------------------------------------- */
char
*
SimTKOpenMMUtilities
::
allocateAndZero
(
unsigned
int
bytesToAllocate
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMUtilities::allocateAndZero";
// ---------------------------------------------------------------------------------------
if
(
bytesToAllocate
<=
0
){
return
NULL
;
}
char
*
ptrToMemory
=
(
char
*
)
SimTKOpenMMUtilities
::
Xmalloc
(
"ptrToMemory"
,
__FILE__
,
__LINE__
,
bytesToAllocate
*
sizeof
(
char
)
);
memset
(
ptrToMemory
,
0
,
bytesToAllocate
);
return
ptrToMemory
;
}
/* ---------------------------------------------------------------------------------------
Normalize 3-vector -- helper method
@param vector 3-vector to normalize
--------------------------------------------------------------------------------------- */
void
SimTKOpenMMUtilities
::
normalizeVector3
(
RealOpenMM
*
vector
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMUtilities::normalizeVector3";
// ---------------------------------------------------------------------------------------
RealOpenMM
sum
=
vector
[
0
]
*
vector
[
0
]
+
vector
[
1
]
*
vector
[
1
]
+
vector
[
2
]
*
vector
[
2
];
sum
=
sum
>
0.0
?
(
RealOpenMM
)
(
1.0
/
SQRT
(
sum
))
:
(
RealOpenMM
)
0.0
;
vector
[
0
]
*=
sum
;
vector
[
1
]
*=
sum
;
vector
[
2
]
*=
sum
;
return
;
}
/* ---------------------------------------------------------------------------------------
Remove 3-vector -- helper method
@param vectorToRemove vector to remove
@param vector vector to from which 'vectorToRemove' is to be removed
vector is normalized after the component is subtracted out
--------------------------------------------------------------------------------------- */
void
SimTKOpenMMUtilities
::
removeVector3
(
RealOpenMM
*
vectorToRemove
,
RealOpenMM
*
vector
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMUtilities::removeVector3";
// ---------------------------------------------------------------------------------------
RealOpenMM
dot
=
vectorToRemove
[
0
]
*
vector
[
0
]
+
vectorToRemove
[
1
]
*
vector
[
1
]
+
vectorToRemove
[
2
]
*
vector
[
2
];
vector
[
0
]
-=
dot
*
vectorToRemove
[
0
];
vector
[
1
]
-=
dot
*
vectorToRemove
[
1
];
vector
[
2
]
-=
dot
*
vectorToRemove
[
2
];
normalizeVector3
(
vector
);
}
/* ---------------------------------------------------------------------------------------
Compute cross product of two 3-vectors and place in 3rd vector -- helper method
vectorZ = vectorX x vectorY
@param vectorX x-vector
@param vectorY y-vector
@param vectorZ z-vector
@return vector is vectorZ
--------------------------------------------------------------------------------------- */
void
SimTKOpenMMUtilities
::
crossProductVector3
(
RealOpenMM
*
vectorX
,
RealOpenMM
*
vectorY
,
RealOpenMM
*
vectorZ
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMUtilities::crossProductVector3";
// ---------------------------------------------------------------------------------------
vectorZ
[
0
]
=
vectorX
[
1
]
*
vectorY
[
2
]
-
vectorX
[
2
]
*
vectorY
[
1
];
vectorZ
[
1
]
=
vectorX
[
2
]
*
vectorY
[
0
]
-
vectorX
[
0
]
*
vectorY
[
2
];
vectorZ
[
2
]
=
vectorX
[
0
]
*
vectorY
[
1
]
-
vectorX
[
1
]
*
vectorY
[
0
];
return
;
}
/**---------------------------------------------------------------------------------------
Compute matrix product of 3x3 matrix and 3-vector and place in 3rd vector -- helper method
vectorZ = matrixX . vectorY
@param matrixX matrixX
@param vectorY y-vector
@param vectorZ z-vector
@return vector is vectorZ
--------------------------------------------------------------------------------------- */
void
SimTKOpenMMUtilities
::
matrixProductVector3
(
RealOpenMM
*
matrixX
,
RealOpenMM
*
vectorY
,
RealOpenMM
*
vectorZ
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMUtilities::matrixProductVector3";
// ---------------------------------------------------------------------------------------
vectorZ
[
0
]
=
matrixX
[
0
]
*
vectorY
[
0
]
+
matrixX
[
3
]
*
vectorY
[
1
]
+
matrixX
[
6
]
*
vectorY
[
2
];
vectorZ
[
1
]
=
matrixX
[
1
]
*
vectorY
[
0
]
+
matrixX
[
4
]
*
vectorY
[
1
]
+
matrixX
[
7
]
*
vectorY
[
2
];
vectorZ
[
2
]
=
matrixX
[
2
]
*
vectorY
[
0
]
+
matrixX
[
5
]
*
vectorY
[
1
]
+
matrixX
[
8
]
*
vectorY
[
2
];
return
;
}
/**---------------------------------------------------------------------------------------
Compute cross product between two 3x3 matrices
@param vectorZ = matrixX x matrixY
@param matrixX matrixX
@param matrixY matrixY
@param vectorZ z-vector
@return vector is vectorZ
--------------------------------------------------------------------------------------- */
void
SimTKOpenMMUtilities
::
matrixCrossProductMatrix3
(
RealOpenMM
*
matrixX
,
RealOpenMM
*
matrixY
,
RealOpenMM
*
vectorZ
){
// ---------------------------------------------------------------------------------------
// static const int indices[3][2] = { { 3, 6 }, { 6, 0 }, { 0 , 3 } };
// static const char* methodName = "\nSimTKOpenMMUtilities::matrixCrossProductMatrix3";
RealOpenMM
*
xPtr
[
3
];
RealOpenMM
*
yPtr
[
3
];
// ---------------------------------------------------------------------------------------
xPtr
[
0
]
=
matrixX
;
xPtr
[
1
]
=
matrixX
+
3
;
xPtr
[
2
]
=
matrixX
+
6
;
yPtr
[
0
]
=
matrixY
;
yPtr
[
1
]
=
matrixY
+
3
;
yPtr
[
2
]
=
matrixY
+
6
;
vectorZ
[
0
]
=
DOT3
(
xPtr
[
1
],
yPtr
[
2
]
)
-
DOT3
(
xPtr
[
2
],
yPtr
[
1
]
);
vectorZ
[
1
]
=
DOT3
(
xPtr
[
2
],
yPtr
[
0
]
)
-
DOT3
(
xPtr
[
0
],
yPtr
[
2
]
);
vectorZ
[
2
]
=
DOT3
(
xPtr
[
0
],
yPtr
[
1
]
)
-
DOT3
(
xPtr
[
1
],
yPtr
[
0
]
);
return
;
}
/* ---------------------------------------------------------------------------------------
Centralized malloc/new
@param name ptr name
@param fileName file name
@param line file line no.
@param file line size in bytes to be allocated
@return ptr to allocated object
--------------------------------------------------------------------------------------- */
void
*
SimTKOpenMMUtilities
::
Xmalloc
(
const
char
*
name
,
char
*
fileName
,
int
line
,
unsigned
int
size
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMUtilities::Xmalloc";
// ---------------------------------------------------------------------------------------
#ifdef UseGromacsMalloc
return
save_malloc
(
name
,
fileName
,
line
,
size
);
#else
return
(
void
*
)
new
char
[
size
];
#endif
}
/* ---------------------------------------------------------------------------------------
Centralized free/delete
@param name ptr name
@param fileName file name
@param line file line no.
@param ptr ptr to be freed
--------------------------------------------------------------------------------------- */
void
SimTKOpenMMUtilities
::
Xfree
(
const
char
*
name
,
char
*
fileName
,
int
line
,
void
*
ptr
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMUtilities::Xfree";
// ---------------------------------------------------------------------------------------
#ifdef UseGromacsMalloc
return
save_free
(
name
,
fileName
,
line
,
ptr
);
#else
delete
(
char
*
)
ptr
;
return
;
#endif
}
/* ---------------------------------------------------------------------------------------
Format array of reals
@param message input string stream
@param realArray array of RealOpenMMs
@param numberOfFields number of fields (optional - defaults to 3)
@param factor scale factor
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMUtilities
::
formatRealStringStream
(
std
::
stringstream
&
message
,
const
RealOpenMM
*
realArray
,
int
numberOfFields
,
RealOpenMM
factor
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nSimTKOpenMMUtilities::Xfree";
// ---------------------------------------------------------------------------------------
for
(
int
ii
=
0
;
ii
<
numberOfFields
;
ii
++
){
message
<<
factor
*
realArray
[
ii
]
<<
" "
;
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/**---------------------------------------------------------------------------------------
Tokenize a string (static method) (Simbios)
@param lineBuffer string to tokenize
@param tokenArray upon return vector of tokens
@param delimiter token delimter
@return number of args
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMUtilities
::
tokenizeString
(
char
*
lineBuffer
,
StringVector
&
tokenArray
,
const
std
::
string
delimiter
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMUtilities::tokenizeString";
// ---------------------------------------------------------------------------------------
// (void) fprintf( stdout, "\nIn SimTKOpenMMUtilities::tokenizeString <%s>", lineBuffer );
// (void) fflush( stdout );
char
*
ptr_c
=
NULL
;
for
(
;
(
ptr_c
=
SimTKOpenMMUtilities
::
strsep
(
&
lineBuffer
,
delimiter
.
c_str
()
))
!=
NULL
;
){
if
(
*
ptr_c
){
tokenArray
.
push_back
(
std
::
string
(
ptr_c
)
);
}
}
return
(
int
)
tokenArray
.
size
();
}
/**---------------------------------------------------------------------------------------
Local version of strncasecmp (missing in Windows) (static method) (Simbios)
@param string1 first string
@param string2 second string
@param matchLength match length
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMUtilities
::
localStrncasecmp
(
const
char
*
string1
,
const
char
*
string2
,
int
matchLength
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMUtilities::localStrncasecmp"
char
ch1
,
ch2
;
// ---------------------------------------------------------------------------------------
if
(
matchLength
==
0
){
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
do
{
ch1
=
toupper
(
*
(
string1
++
));
ch2
=
toupper
(
*
(
string2
++
));
if
(
ch1
!=
ch2
)
return
(
ch1
-
ch2
);
matchLength
--
;
}
while
(
ch1
&&
matchLength
);
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/**---------------------------------------------------------------------------------------
Check that string is valid integer
@param stringToCheck string to check
@return true if string is a valid integer
--------------------------------------------------------------------------------------- */
bool
SimTKOpenMMUtilities
::
isValidInteger
(
std
::
string
stringToCheck
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMUtilities::isValidInteger";
// ---------------------------------------------------------------------------------------
int
ii
;
return
checkString
<
int
>
(
ii
,
stringToCheck
,
std
::
dec
);
}
/**---------------------------------------------------------------------------------------
Check that string is valid RealOpenMM
@param stringToCheck string to check
@return true if string is a valid RealOpenMM
--------------------------------------------------------------------------------------- */
bool
SimTKOpenMMUtilities
::
isValidRealOpenMM
(
std
::
string
stringToCheck
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMUtilities::isValidRealOpenMM";
// ---------------------------------------------------------------------------------------
RealOpenMM
ii
;
return
checkString
<
RealOpenMM
>
(
ii
,
stringToCheck
,
std
::
dec
);
}
/**---------------------------------------------------------------------------------------
Read file into string vector (Simbios)
@param fileName file name
@param fileContents string vector containing file contents upon return
one string per line
@return SimTKOpenMMCommon::DefaultReturn unless file could not be opened
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMUtilities
::
readFileIntoStringVector
(
const
std
::
string
&
fileName
,
StringVector
&
fileContents
){
// ---------------------------------------------------------------------------------------
static
int
bufferSize
=
2048
;
static
char
buffer
[
2048
];
static
const
std
::
string
methodName
=
"
\n
SimTKOpenMMUtilities::readFileIntoStringVector"
;
// ---------------------------------------------------------------------------------------
// open file
FILE
*
file
=
NULL
;
#ifdef WIN32
fopen_s
(
&
file
,
fileName
.
c_str
(),
"r"
);
#else
file
=
fopen
(
fileName
.
c_str
(),
"r"
);
#endif
if
(
file
!=
NULL
){
std
::
stringstream
message
;
message
<<
methodName
.
c_str
()
<<
" opened file=<"
<<
fileName
.
c_str
()
<<
">."
;
SimTKOpenMMLog
::
printMessage
(
message
);
}
else
{
std
::
stringstream
message
;
message
<<
methodName
.
c_str
()
<<
" could not open file=<"
<<
fileName
.
c_str
()
<<
">."
;
//(void) fprintf( stderr, "\n%s\n", message.str().c_str() );
//(void) fflush( stderr );
SimTKOpenMMLog
::
printMessage
(
message
);
return
SimTKOpenMMCommon
::
ErrorReturn
;
}
// loop over all lines in file, checking for end-of-file
int
lineNumber
=
0
;
while
(
!
feof
(
file
)
){
// read next line
int
bufferLen
;
lineNumber
++
;
if
(
fgets
(
buffer
,
bufferSize
,
file
)
!=
NULL
){
bufferLen
=
(
int
)
strlen
(
buffer
);
if
(
bufferLen
>
0
){
buffer
[
bufferLen
-
1
]
=
'\0'
;
}
// (void) fprintf( log, "%s", buffer );
// (void) fflush( log );
fileContents
.
push_back
(
buffer
);
}
}
// done
(
void
)
fclose
(
file
);
if
(
file
){
//std::stringstream message;
//message << methodName.c_str() << " read " << lineNumber << " lines from file=<" << fileName->c_str() << ">.";
// AmoebaLog::printMessage( message );
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/**---------------------------------------------------------------------------------------
Read file into string vector (Simbios)
@param charArray character array
@param arrayLength array length
@param arrayContents string vector containing array contents upon return
one string per line
@return SimTKOpenMMCommon::DefaultReturn unless file could not be opened
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMUtilities
::
readCharacterArrayIntoStringVector
(
const
char
*
charArray
,
int
arrayLength
,
StringVector
&
fileContents
){
// ---------------------------------------------------------------------------------------
static
int
bufferSize
=
2048
;
static
char
buffer
[
2048
];
static
const
std
::
string
methodName
=
"
\n
SimTKOpenMMUtilities::readCharacterArrayIntoStringVector"
;
// ---------------------------------------------------------------------------------------
// loop over all lines in file, checking for end-of-file
int
byteIndex
=
0
;
//int lineIndex = 0;
while
(
byteIndex
<
arrayLength
){
// get next line
int
lineLength
=
0
;
int
done
=
0
;
while
(
byteIndex
<
arrayLength
&&
lineLength
<
bufferSize
&&
!
done
){
buffer
[
lineLength
++
]
=
charArray
[
byteIndex
++
];
if
(
(
int
)
charArray
[
byteIndex
]
==
10
||
(
int
)
charArray
[
byteIndex
]
==
13
){
while
(
(
int
)
charArray
[
byteIndex
]
<
32
&&
byteIndex
<
arrayLength
)
byteIndex
++
;
done
=
1
;
}
}
buffer
[
lineLength
]
=
'\0'
;
//lineIndex++;
// (void) fprintf( stdout, "%s readCharacterArrayIntoStringVector: %d %d <%s>", methodName.c_str(), lineIndex, lineLength, buffer );
// (void) fflush( stdout );
fileContents
.
push_back
(
buffer
);
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/**---------------------------------------------------------------------------------------
Tokenize a string (static method) (Simbios)
@param line string to tokenize
@param tokenVector upon return vector of tokens
@param delimiter token delimter
@param clearTokenVector if true, clear tokenVector
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMUtilities
::
tokenizeString
(
const
std
::
string
&
line
,
StringVector
&
tokenVector
,
const
std
::
string
&
delimiter
,
int
clearTokenVector
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMUtilities::tokenizeString";
static
int
bufferSz
=
8192
;
static
char
*
lineBuffer
=
NULL
;
// ---------------------------------------------------------------------------------------
char
*
ptr_c
;
// clear token vector
if
(
clearTokenVector
){
tokenVector
.
clear
();
}
// allocate space for line buffer and copy via sprintf()
if
(
lineBuffer
==
NULL
||
bufferSz
<
(
int
)
line
.
size
()
){
if
(
lineBuffer
!=
NULL
){
free
(
lineBuffer
);
}
if
(
bufferSz
<
(
int
)
line
.
size
()
){
bufferSz
=
(
int
)
(
2
*
line
.
size
());
}
lineBuffer
=
(
char
*
)
malloc
(
bufferSz
*
sizeof
(
char
)
);
}
#ifdef WIN32
(
void
)
sprintf_s
(
lineBuffer
,
bufferSz
,
"%s"
,
line
.
c_str
()
);
#else
(
void
)
sprintf
(
lineBuffer
,
"%s"
,
line
.
c_str
()
);
#endif
// parse
while
(
(
ptr_c
=
SimTKOpenMMUtilities
::
strsep
(
&
lineBuffer
,
delimiter
.
c_str
()
))
!=
NULL
){
if
(
*
ptr_c
){
tokenVector
.
push_back
(
std
::
string
(
ptr_c
)
);
}
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/**---------------------------------------------------------------------------------------
Replacement of sorts for strtok() (static method) (Simbios)
Used to parse parameter file lines
Should be moved to Utilities file
@param lineBuffer string to tokenize
@param delimiter token delimter
@return number of args; if return value equals maxTokens, then more tokens than allocated
--------------------------------------------------------------------------------------- */
char
*
SimTKOpenMMUtilities
::
strsep
(
char
**
lineBuffer
,
const
char
*
delimiter
){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nTinkerParameterSet::strsep"
char
*
s
;
const
char
*
spanp
;
int
c
,
sc
;
char
*
tok
;
// ---------------------------------------------------------------------------------------
s
=
*
lineBuffer
;
if
(
s
==
NULL
){
return
(
NULL
);
}
for
(
tok
=
s
;;
){
c
=
*
s
++
;
spanp
=
delimiter
;
do
{
if
(
(
sc
=
*
spanp
++
)
==
c
){
if
(
c
==
0
){
s
=
NULL
;
}
else
{
s
[
-
1
]
=
0
;
}
*
lineBuffer
=
s
;
return
(
tok
);
}
}
while
(
sc
!=
0
);
}
}
/**---------------------------------------------------------------------------------------
Return lower case copy of string
@param string string
@return lower cased string
--------------------------------------------------------------------------------------- */
//int SimTKOpenMMUtilities::toLower( std::string& string ){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "\nSimTKOpenMMUtilities::toLower"
// ---------------------------------------------------------------------------------------
// transform string to lower case
// std::transform( string.begin(), string.end(), string.begin(), (int(*)(int)) std::tolower);
//return SimTKOpenMMCommon::DefaultReturn;
//}
/**---------------------------------------------------------------------------------------
Write file (helper method) (Simbios)
@param lineVector line entries for file
@param inputFileName inputFileName
@return SimTKOpenMMCommon::ErrorReturn if error -- else SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMUtilities
::
writeFile
(
const
StringVector
&
lineVector
,
const
std
::
string
&
fileName
){
// ---------------------------------------------------------------------------------------
static
const
std
::
string
methodName
=
"
\n
SimTKOpenMMUtilities::writeFile"
;
// ---------------------------------------------------------------------------------------
// open file
FILE
*
file
=
NULL
;
#ifdef WIN32
fopen_s
(
&
file
,
fileName
.
c_str
(),
"w"
);
#else
file
=
fopen
(
fileName
.
c_str
(),
"w"
);
#endif
if
(
file
!=
NULL
){
//std::stringstream message;
//message << methodName.c_str() << " opened file=<" << fileName.c_str() << ">.";
//SimTKOpenMMLog::printMessage( message );
}
else
{
std
::
stringstream
message
;
message
<<
methodName
.
c_str
()
<<
" could not open file=<"
<<
fileName
.
c_str
()
<<
">."
;
SimTKOpenMMLog
::
printMessage
(
message
);
return
SimTKOpenMMCommon
::
ErrorReturn
;
}
// ---------------------------------------------------------------------------------------
// loop over lines
int
bodyLines
=
(
int
)
lineVector
.
size
();
for
(
StringVectorCI
ii
=
lineVector
.
begin
();
ii
!=
lineVector
.
end
();
ii
++
){
if
(
(
*
ii
).
length
()
>
1
){
(
void
)
fprintf
(
file
,
"%s
\n
"
,
(
*
ii
).
c_str
()
);
}
else
{
bodyLines
--
;
}
}
(
void
)
fflush
(
file
);
(
void
)
fclose
(
file
);
/*
std::stringstream message;
message << " :: closed file=<" << fileName.c_str() << "> number of body lines in file=" << bodyLines;
SimTKOpenMMLog::printMessage( message );
*/
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/**---------------------------------------------------------------------------------------
Get statistics on an array
@param numberOfEntries number of entries in array
@param array array
@param average average of array on output
@param stdDev std dev of array on output
@param minValue min value in array on output
@param minIndex index of min value in array on output
@param maxValue max value in array on output
@param maxIndex index of max value in array on output
if numberOfEntries <= 0, return 0 for all RealOpenMM values and -1 for index values
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMUtilities
::
getArrayStatistics
(
int
numberOfEntries
,
const
RealOpenMM
*
array
,
RealOpenMM
*
average
,
RealOpenMM
*
stdDev
,
RealOpenMM
*
minValue
,
int
*
minIndex
,
RealOpenMM
*
maxValue
,
int
*
maxIndex
){
// ---------------------------------------------------------------------------------------
static
const
std
::
string
methodName
=
"
\n
SimTKOpenMMUtilities::getArrayStatistics"
;
static
const
RealOpenMM
zero
=
1.0
;
static
const
RealOpenMM
one
=
1.0
;
// ---------------------------------------------------------------------------------------
if
(
numberOfEntries
<=
0
){
*
average
=
*
stdDev
=
*
minValue
=
*
maxValue
=
zero
;
*
maxIndex
=
*
minIndex
=
-
1
;
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
*
average
=
array
[
0
];
*
stdDev
=
(
*
average
)
*
(
*
average
);
*
minValue
=
array
[
0
];
*
maxValue
=
array
[
0
];
*
maxIndex
=
*
minIndex
=
0
;
for
(
int
ii
=
1
;
ii
<
numberOfEntries
;
ii
++
){
*
average
+=
array
[
ii
];
*
stdDev
+=
array
[
ii
]
*
array
[
ii
];
if
(
array
[
ii
]
<
*
minValue
){
*
minValue
=
array
[
ii
];
*
minIndex
=
ii
;
}
if
(
array
[
ii
]
>
*
maxValue
){
*
maxValue
=
array
[
ii
];
*
maxIndex
=
ii
;
}
}
RealOpenMM
numberOfEntriesR
=
(
RealOpenMM
)
numberOfEntries
;
*
average
/=
numberOfEntriesR
;
*
stdDev
=
*
stdDev
-
numberOfEntriesR
*
(
*
average
)
*
(
*
average
);
if
(
numberOfEntriesR
>
one
){
*
stdDev
=
SQRT
(
(
*
stdDev
)
/
(
numberOfEntriesR
-
one
)
);
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
/**---------------------------------------------------------------------------------------
Get one 2D array to another
@param dimension1 first dimension
@param dimension2 second dimension
@param arrayToAdd array to add [dimension1][dimension2]
@param sumArray summed array to add [dimension1][dimension2]
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
int
SimTKOpenMMUtilities
::
addTwoDimArray
(
int
dimension1
,
int
dimension2
,
RealOpenMM
**
arrayToAdd
,
RealOpenMM
**
sumArray
){
// ---------------------------------------------------------------------------------------
//static const std::string methodName = "\nSimTKOpenMMUtilities::addTwoDimArray";
// ---------------------------------------------------------------------------------------
for
(
int
ii
=
0
;
ii
<
dimension1
;
ii
++
){
for
(
int
jj
=
0
;
jj
<
dimension2
;
jj
++
){
sumArray
[
ii
][
jj
]
+=
arrayToAdd
[
ii
][
jj
];
}
}
return
SimTKOpenMMCommon
::
DefaultReturn
;
}
platforms/reference/src/SimTKUtilities/SimTKOpenMMUtilities.h
0 → 100755
View file @
598e076c
/* Portions copyright (c) 2006 Stanford University and Simbios.
* Contributors: Pande Group
*
* 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.
*/
#ifndef __SimTKOpenMMUtilities_H_
#define __SimTKOpenMMUtilities_H_
// class of shared, static utility methods
#include "SimTKOpenMMCommon.h"
#include <stdio.h>
#include <string.h>
#include <string>
#include <stdlib.h>
#include <sstream>
// template is used to check if a string is integer, real, ...
template
<
class
T
>
bool
checkString
(
T
&
t
,
const
std
::
string
&
s
,
std
::
ios_base
&
(
*
f
)(
std
::
ios_base
&
)
){
std
::
istringstream
iss
(
s
);
return
!
(
iss
>>
f
>>
t
).
fail
();
}
/**---------------------------------------------------------------------------------------
Class of static methods to be shared
Most methods are standalone 'utility' methods
--------------------------------------------------------------------------------------- */
class
SimTKOpenMMUtilities
{
public:
// file flag enums
enum
FileFlags
{
OpenDebugFile
,
WriteDebugFile
,
CloseDebugFile
};
// dummy constructor/destructor
SimTKOpenMMUtilities
(){};
~
SimTKOpenMMUtilities
(){};
/**---------------------------------------------------------------------------------------
Find distances**2 from a given atom (Simbios)
@param atomCoordinates atom coordinates
@param atomIndex atom index to find distances from
@param numberOfAtoms number of atoms
@param distances array of distances squared on @return; array size must be at least
numberOfAtoms
@param log if set, then print error messages to log file
@return distances
--------------------------------------------------------------------------------------- */
static
int
getDistanceSquaredFromSpecifiedAtom
(
RealOpenMM
**
atomCoordinates
,
int
atomIndex
,
int
numberOfAtoms
,
RealOpenMM
*
distances
,
FILE
*
log
);
/**---------------------------------------------------------------------------------------
Find distances**2 from a given point (Simbios)
@param atomCoordinates atom coordinates
@param point point to find distances from
@param numberOfAtoms number of atoms
@param distances array of distances squared on @return; array size must be at least
numberOfAtoms
@param log if set, then print error messages to log file
@return distances
--------------------------------------------------------------------------------------- */
static
int
getDistanceSquaredFromSpecifiedPoint
(
RealOpenMM
**
atomCoordinates
,
RealOpenMM
*
point
,
int
numberOfAtoms
,
RealOpenMM
*
distances
,
FILE
*
log
);
/**---------------------------------------------------------------------------------------
Helper method to allocate RealOpenMM arrays (Simbios)
@param bufferIndex buffer index
@param allocatedSz array of allocated sizes
@param bufferArray array of allocated RealOpenMM arrays
@param requestedSize requested size
@param dataAction action flag: -1 = free memory \n
1 = zero memory
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
allocateRealOpenMMBufferArray
(
int
bufferIndex
,
int
*
allocatedSz
,
RealOpenMM
**
bufferArray
,
int
requestedSize
,
int
dataAction
);
/**---------------------------------------------------------------------------------------
Print atom coordinates, ...
@param numberAtoms numberAtoms
@param atomCoordinates atomCoordinates (may be NULL)
@param numberOf1Darrays number of 1-d arrays (may be 0)
@param oneDArrays 1-d arrays
@param idString id string to be printed if set
@param log print messages to log file
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
printCoordinateAnd1DArrays
(
int
numberAtoms
,
RealOpenMM
**
atomCoordinates
,
int
numberOf1Darrays
,
RealOpenMM
**
oneDArrays
,
const
char
*
idString
,
FILE
*
log
);
/**---------------------------------------------------------------------------------------
Free array of strings
@param arraySz atom index
@param arrayOfStrings array of strings
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
freeArrayOfStrings
(
int
arraySz
,
char
**
arrayOfStrings
);
/**---------------------------------------------------------------------------------------
Tab string in place
@param string string to tab; assume string is of at least length=tab + 1
@param tab tab length
--------------------------------------------------------------------------------------- */
static
int
tabStringInPlace
(
char
*
string
,
int
tab
);
/**---------------------------------------------------------------------------------------
Write debug fields (Simbios)
@param numberOfFields number of fields to print
@param fields fields
@param numberOfStringFields number of string fields to print
@param stringFields string fields
@param comment comment (optinal -- ignored if NULL)
@param debugFileName output debug file name
@param action 0 open file and @return w/o printing
1 open file and print
2 close file (no print)
@param debugFile debug file reference
@param log if set, then print error messages to log file
@return debugFile unless file is closed
stringFields printed after RealOpenMM fields
--------------------------------------------------------------------------------------- */
static
FILE
*
writeDebugFile
(
int
numberOfFields
,
const
RealOpenMM
*
fields
,
int
numberOfStringFields
,
const
StringVector
&
stringFields
,
const
char
*
comment
,
const
char
*
debugFileName
,
int
action
,
FILE
*
debugFile
,
FILE
*
log
);
/**---------------------------------------------------------------------------------------
Allocate 1D RealOpenMM array (Simbios)
array[i]
@param iSize i-dimension
@param array1D array (if null on entry allocated)
@param initialize if true, then initialize array
@param initialValue intitial value
@param idString id string
@return array
--------------------------------------------------------------------------------------- */
static
RealOpenMM
*
allocateOneDRealOpenMMArray
(
int
iSize
,
RealOpenMM
*
array1D
,
int
initialize
,
RealOpenMM
initialValue
,
const
std
::
string
&
idString
=
std
::
string
(
"1DArray"
)
);
/**---------------------------------------------------------------------------------------
Allocate 2D RealOpenMM array (Simbios)
array[i][j]
@param iSize i-dimension
@param jSize j-dimension
@param array2D array (if null on entry allocated)
@param initialize if true, then initialize array
@param initialValue intitial value
@param idString id string
@return array
--------------------------------------------------------------------------------------- */
static
RealOpenMM
**
allocateTwoDRealOpenMMArray
(
int
iSize
,
int
jSize
,
RealOpenMM
**
array2D
,
int
initialize
,
RealOpenMM
initialValue
,
const
std
::
string
&
idString
=
std
::
string
(
"2DArray"
)
);
/* ---------------------------------------------------------------------------------------
Free 2D RealOpenMM array (Simbios)
array[i][j]
@param array2D array (if null on entry allocated)
@param idString id string
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
freeOneDRealOpenMMArray
(
RealOpenMM
*
array1D
,
const
std
::
string
&
idString
=
std
::
string
(
"1DArray"
)
);
/* ---------------------------------------------------------------------------------------
Free 2D RealOpenMM array (Simbios)
array[i][j]
@param array2D array (if null on entry allocated)
@param idString id string
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
freeTwoDRealOpenMMArray
(
RealOpenMM
**
array2D
,
const
std
::
string
&
idString
=
std
::
string
(
"2DArray"
)
);
/**---------------------------------------------------------------------------------------
Initialize 2D RealOpenMM array (Simbios)
array[i][j]
@param iSize i-dimension
@param jSize j-dimension
@param array2D array (if null on entry allocated)
@param initialValue intitial value
@return array
--------------------------------------------------------------------------------------- */
static
int
initialize2DRealOpenMMArray
(
int
iSize
,
int
jSize
,
RealOpenMM
**
array2D
,
RealOpenMM
initialValue
);
/**---------------------------------------------------------------------------------------
Malloc memory of size bytesToAllocate and zero
@param bytesToAllocate bytes to allocate
@return ptr to allocated memory; NULL if bytesToAllocate <= 0
--------------------------------------------------------------------------------------- */
static
char
*
allocateAndZero
(
unsigned
int
bytesToAllocate
);
/**---------------------------------------------------------------------------------------
Normalize 3-vector -- helper method
@param vector vector to normalize
--------------------------------------------------------------------------------------- */
static
void
normalizeVector3
(
RealOpenMM
*
vector
);
/**---------------------------------------------------------------------------------------
Remove 3-vector -- helper method
@param vectorToRemove vector to remove
@param vector vector to from which 'vectorToRemove' is to be removed \n
vector is normalized after the component is subtracted out
--------------------------------------------------------------------------------------- */
static
void
removeVector3
(
RealOpenMM
*
vectorToRemove
,
RealOpenMM
*
vector
);
/**---------------------------------------------------------------------------------------
Compute cross product of two 3-vectors and place in 3rd vector -- helper method
@param vectorZ = vectorX x vectorY
@param vectorX x-vector
@param vectorY y-vector
@param vectorZ z-vector
@return vector is vectorZ
--------------------------------------------------------------------------------------- */
static
void
crossProductVector3
(
RealOpenMM
*
vectorX
,
RealOpenMM
*
vectorY
,
RealOpenMM
*
vectorZ
);
/**---------------------------------------------------------------------------------------
Compute matrix product of 3x3 matrix and 3-vector and place in 3rd vector -- helper method
@param vectorZ = matrixX . vectorY
@param matrixX matrixX
@param vectorY y-vector
@param vectorZ z-vector
@return vector is vectorZ
--------------------------------------------------------------------------------------- */
static
void
matrixProductVector3
(
RealOpenMM
*
matrixX
,
RealOpenMM
*
vectorY
,
RealOpenMM
*
vectorZ
);
/**---------------------------------------------------------------------------------------
Compute cross product between two 3x3 matrices
@param vectorZ = matrixX . matrixY
@param matrixX matrixX
@param matrixY matrixY
@param vectorZ z-vector
@return vector is vectorZ
--------------------------------------------------------------------------------------- */
static
void
matrixCrossProductMatrix3
(
RealOpenMM
*
matrixX
,
RealOpenMM
*
matrixY
,
RealOpenMM
*
vectorZ
);
/* ---------------------------------------------------------------------------------------
Centralized malloc/new
@param name ptr name
@param fileName file name
@param line file line no.
@param file line size in bytes to be allocated
@return ptr to allocated object
--------------------------------------------------------------------------------------- */
static
void
*
Xmalloc
(
const
char
*
name
,
char
*
fileName
,
int
line
,
unsigned
int
size
);
/* ---------------------------------------------------------------------------------------
Centralized free/delete
@param name ptr name
@param fileName file name
@param line file line no.
@param ptr ptr to be freed
--------------------------------------------------------------------------------------- */
static
void
Xfree
(
const
char
*
name
,
char
*
fileName
,
int
line
,
void
*
ptr
);
/* ---------------------------------------------------------------------------------------
Format array of reals
@param message input string stream
@param realArray array of RealOpenMMs
@param numberOfFields number of fields (optional - defaults to 3)
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
formatRealStringStream
(
std
::
stringstream
&
message
,
const
RealOpenMM
*
realArray
,
int
numberOfFields
=
3
,
RealOpenMM
factor
=
(
RealOpenMM
)
1.0
f
);
/**---------------------------------------------------------------------------------------
Tokenize a string (static method) (Simbios)
@param lineBuffer string to tokenize
@param tokenArray upon return vectory of tokens
@param delimiter token delimter
@return number of args
--------------------------------------------------------------------------------------- */
static
int
tokenizeString
(
char
*
lineBuffer
,
StringVector
&
tokenArray
,
const
std
::
string
delimiter
=
"
\t\n
"
);
/**---------------------------------------------------------------------------------------
Tokenize a string (static method) (Simbios)
@param line string to tokenize
@param tokenVector upon return vector of tokens
@param delimiter token delimter
@param clearTokenVector if true, clear tokenVector
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
tokenizeString
(
const
std
::
string
&
line
,
StringVector
&
tokenVector
,
const
std
::
string
&
delimiter
,
int
clearTokenVector
);
/**---------------------------------------------------------------------------------------
Local version of strncasecmp (missing in Windows) (static method) (Simbios)
@param string1 first string
@param string2 second string
@param matchLength match length
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
localStrncasecmp
(
const
char
*
string1
,
const
char
*
string2
,
int
matchLength
);
/**---------------------------------------------------------------------------------------
Check that string is valid integer
@param stringToCheck string to check
@return true if string is a valid integer
--------------------------------------------------------------------------------------- */
static
bool
isValidInteger
(
std
::
string
stringToCheck
);
/**---------------------------------------------------------------------------------------
Check that string is valid RealOpenMM
@param stringToCheck string to check
@return true if string is a valid RealOpenMM
--------------------------------------------------------------------------------------- */
static
bool
isValidRealOpenMM
(
std
::
string
stringToCheck
);
/**---------------------------------------------------------------------------------------
Read file into string vector (Simbios)
@param fileName file name
@param fileContents string vector containing file contents upon return
one string per line
@return SimTKOpenMMCommon::DefaultReturn unless file could not be opened
--------------------------------------------------------------------------------------- */
static
int
readFileIntoStringVector
(
const
std
::
string
&
fileName
,
StringVector
&
fileContents
);
/**---------------------------------------------------------------------------------------
Read file into string vector (Simbios)
@param charArray character array
@param arrayLength array length
@param arrayContents string vector containing array contents upon return
one string per line
@return SimTKOpenMMCommon::DefaultReturn unless file could not be opened
--------------------------------------------------------------------------------------- */
static
int
readCharacterArrayIntoStringVector
(
const
char
*
charArray
,
int
arrayLength
,
StringVector
&
fileContents
);
/**---------------------------------------------------------------------------------------
Replacement of sorts for strtok() (static method) (Simbios)
Used to parse parameter file lines
Should be moved to Utilities file
@param lineBuffer string to tokenize
@param delimiter token delimter
@return number of args; if return value equals maxTokens, then more tokens than allocated
--------------------------------------------------------------------------------------- */
static
char
*
strsep
(
char
**
lineBuffer
,
const
char
*
delimiter
);
/**---------------------------------------------------------------------------------------
Write file (helper method) (Simbios)
@param lineVector line entries for file
@param inputFileName inputFileName
@return SimTKOpenMMCommon::ErrorReturn if error -- else SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
writeFile
(
const
StringVector
&
lineVector
,
const
std
::
string
&
fileName
);
/**---------------------------------------------------------------------------------------
Get statistics on an array
@param numberOfEntries number of entries in array
@param array array
@param average average of array on output
@param stdDev std dev of array on output
@param minValue min value in array on output
@param minIndex index of min value in array on output
@param maxValue max value in array on output
@param maxIndex index of max value in array on output
if numberOfEntries <= 0, return 0 for all RealOpenMM values and -1 for index values
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
getArrayStatistics
(
int
numberOfEntries
,
const
RealOpenMM
*
array
,
RealOpenMM
*
average
,
RealOpenMM
*
stdDev
,
RealOpenMM
*
minValue
,
int
*
minIndex
,
RealOpenMM
*
maxValue
,
int
*
maxIndex
);
/**---------------------------------------------------------------------------------------
Get one 2D array to another
@param dimension1 first dimension
@param dimension2 second dimension
@param arrayToAdd array to add [dimension1][dimension2]
@param sumArray summed array to add [dimension1][dimension2]
@return SimTKOpenMMCommon::DefaultReturn
--------------------------------------------------------------------------------------- */
static
int
addTwoDimArray
(
int
dimension1
,
int
dimension2
,
RealOpenMM
**
arrayToAdd
,
RealOpenMM
**
sumArray
);
};
// ---------------------------------------------------------------------------------------
#endif // __SimTKOpenMMUtilities_H__
platforms/reference/src/SimTKUtilities/SimTKOpenMMWindowLinux.h
0 → 100755
View file @
598e076c
/* Portions copyright (c) 2006 Stanford University and Simbios.
* Contributors: Pande Group
*
* 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.
*/
#ifndef __SimTKOpenMMWindowLinux_H_
#define __SimTKOpenMMWindowLinux_H__
#ifdef WIN32
#define FOPEN fopen_s
#else
#define FOPEN fopen
#endif
#endif // __SimTKOpenMMWindowLinux_H__
platforms/reference/src/SimTKUtilities/SimTKlapack.h
0 → 100755
View file @
598e076c
This source diff could not be displayed because it is too large. You can
view the blob
instead.
platforms/reference/src/SimTKUtilities/SimTk-old-2005.sln
0 → 100755
View file @
598e076c
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimTk", "SimTk-old-2005.vcproj", "{82165226-E7AC-4C35-8914-80C31C7B4754}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{82165226-E7AC-4C35-8914-80C31C7B4754}.Debug|Win32.ActiveCfg = Debug|Win32
{82165226-E7AC-4C35-8914-80C31C7B4754}.Debug|Win32.Build.0 = Debug|Win32
{82165226-E7AC-4C35-8914-80C31C7B4754}.Release|Win32.ActiveCfg = Release|Win32
{82165226-E7AC-4C35-8914-80C31C7B4754}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
platforms/reference/src/SimTKUtilities/SimTk-old-2005.vcproj
0 → 100755
View file @
598e076c
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType=
"Visual C++"
Version=
"8.00"
Name=
"SimTk"
ProjectGUID=
"{82165226-E7AC-4C35-8914-80C31C7B4754}"
RootNamespace=
"SimTk"
Keyword=
"Win32Proj"
>
<Platforms>
<Platform
Name=
"Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name=
"Debug|Win32"
OutputDirectory=
"Debug"
IntermediateDirectory=
"Debug"
ConfigurationType=
"4"
>
<Tool
Name=
"VCPreBuildEventTool"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCXMLDataGeneratorTool"
/>
<Tool
Name=
"VCWebServiceProxyGeneratorTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCCLCompilerTool"
Optimization=
"0"
AdditionalIncludeDirectories=
"..\gromacs\include"
PreprocessorDefinitions=
"WIN32;_DEBUG;_LIB;"
MinimalRebuild=
"true"
BasicRuntimeChecks=
"3"
RuntimeLibrary=
"1"
UsePrecompiledHeader=
"0"
WarningLevel=
"3"
Detect64BitPortabilityProblems=
"true"
DebugInformationFormat=
"4"
/>
<Tool
Name=
"VCManagedResourceCompilerTool"
/>
<Tool
Name=
"VCResourceCompilerTool"
/>
<Tool
Name=
"VCPreLinkEventTool"
/>
<Tool
Name=
"VCLibrarianTool"
OutputFile=
"$(OutDir)\simtkUtilities.lib"
/>
<Tool
Name=
"VCALinkTool"
/>
<Tool
Name=
"VCXDCMakeTool"
/>
<Tool
Name=
"VCBscMakeTool"
/>
<Tool
Name=
"VCFxCopTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name=
"Release|Win32"
OutputDirectory=
"Release"
IntermediateDirectory=
"Release"
ConfigurationType=
"4"
>
<Tool
Name=
"VCPreBuildEventTool"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCXMLDataGeneratorTool"
/>
<Tool
Name=
"VCWebServiceProxyGeneratorTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
"..\gromacs\include"
PreprocessorDefinitions=
"WIN32;NDEBUG;_LIB;"
RuntimeLibrary=
"0"
UsePrecompiledHeader=
"0"
WarningLevel=
"3"
Detect64BitPortabilityProblems=
"true"
DebugInformationFormat=
"3"
/>
<Tool
Name=
"VCManagedResourceCompilerTool"
/>
<Tool
Name=
"VCResourceCompilerTool"
/>
<Tool
Name=
"VCPreLinkEventTool"
/>
<Tool
Name=
"VCLibrarianTool"
OutputFile=
"$(OutDir)\simtkUtilities.lib"
/>
<Tool
Name=
"VCALinkTool"
/>
<Tool
Name=
"VCXDCMakeTool"
/>
<Tool
Name=
"VCBscMakeTool"
/>
<Tool
Name=
"VCFxCopTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name=
"Debug_FAHCORE|Win32"
OutputDirectory=
"$(ConfigurationName)"
IntermediateDirectory=
"$(ConfigurationName)"
ConfigurationType=
"4"
>
<Tool
Name=
"VCPreBuildEventTool"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCXMLDataGeneratorTool"
/>
<Tool
Name=
"VCWebServiceProxyGeneratorTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCCLCompilerTool"
Optimization=
"0"
AdditionalIncludeDirectories=
"..\gromacs\include"
PreprocessorDefinitions=
"WIN32;_DEBUG;_LIB;"
MinimalRebuild=
"true"
BasicRuntimeChecks=
"3"
RuntimeLibrary=
"3"
UsePrecompiledHeader=
"0"
WarningLevel=
"3"
Detect64BitPortabilityProblems=
"true"
DebugInformationFormat=
"4"
/>
<Tool
Name=
"VCManagedResourceCompilerTool"
/>
<Tool
Name=
"VCResourceCompilerTool"
/>
<Tool
Name=
"VCPreLinkEventTool"
/>
<Tool
Name=
"VCLibrarianTool"
OutputFile=
"$(OutDir)/simtkUtilities.lib"
/>
<Tool
Name=
"VCALinkTool"
/>
<Tool
Name=
"VCXDCMakeTool"
/>
<Tool
Name=
"VCBscMakeTool"
/>
<Tool
Name=
"VCFxCopTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name=
"Release_FAHCORE|Win32"
OutputDirectory=
"$(ConfigurationName)"
IntermediateDirectory=
"$(ConfigurationName)"
ConfigurationType=
"4"
>
<Tool
Name=
"VCPreBuildEventTool"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCXMLDataGeneratorTool"
/>
<Tool
Name=
"VCWebServiceProxyGeneratorTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCCLCompilerTool"
Optimization=
"0"
AdditionalIncludeDirectories=
"..\gromacs\include;../../corewrap"
PreprocessorDefinitions=
"WIN32;_LIB;FULLINDIRECT"
MinimalRebuild=
"true"
BasicRuntimeChecks=
"3"
RuntimeLibrary=
"0"
UsePrecompiledHeader=
"0"
WarningLevel=
"3"
Detect64BitPortabilityProblems=
"true"
DebugInformationFormat=
"4"
ForcedIncludeFiles=
"swindirect.h"
/>
<Tool
Name=
"VCManagedResourceCompilerTool"
/>
<Tool
Name=
"VCResourceCompilerTool"
/>
<Tool
Name=
"VCPreLinkEventTool"
/>
<Tool
Name=
"VCLibrarianTool"
OutputFile=
"$(OutDir)/simtkUtilities.lib"
/>
<Tool
Name=
"VCALinkTool"
/>
<Tool
Name=
"VCXDCMakeTool"
/>
<Tool
Name=
"VCBscMakeTool"
/>
<Tool
Name=
"VCFxCopTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name=
"DebugNoGPU_FAH|Win32"
OutputDirectory=
"$(ConfigurationName)"
IntermediateDirectory=
"$(ConfigurationName)"
ConfigurationType=
"4"
>
<Tool
Name=
"VCPreBuildEventTool"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCXMLDataGeneratorTool"
/>
<Tool
Name=
"VCWebServiceProxyGeneratorTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCCLCompilerTool"
Optimization=
"0"
AdditionalIncludeDirectories=
"..\gromacs\include"
PreprocessorDefinitions=
"WIN32;_DEBUG;_LIB;NoGPU"
MinimalRebuild=
"true"
BasicRuntimeChecks=
"3"
RuntimeLibrary=
"3"
UsePrecompiledHeader=
"0"
WarningLevel=
"3"
Detect64BitPortabilityProblems=
"true"
DebugInformationFormat=
"4"
/>
<Tool
Name=
"VCManagedResourceCompilerTool"
/>
<Tool
Name=
"VCResourceCompilerTool"
/>
<Tool
Name=
"VCPreLinkEventTool"
/>
<Tool
Name=
"VCLibrarianTool"
OutputFile=
"$(OutDir)\simtkUtilities.lib"
/>
<Tool
Name=
"VCALinkTool"
/>
<Tool
Name=
"VCXDCMakeTool"
/>
<Tool
Name=
"VCBscMakeTool"
/>
<Tool
Name=
"VCFxCopTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name=
"Header Files"
Filter=
"h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier=
"{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=
".\AssertSimTk.h"
>
</File>
<File
RelativePath=
".\SimTKlapack.h"
>
</File>
<File
RelativePath=
".\SimTKOpenMMCommon.h"
>
</File>
<File
RelativePath=
".\SimTKOpenMMGpuUtilities.h"
>
</File>
<File
RelativePath=
".\SimTKOpenMMGromacsUtilities.h"
>
</File>
<File
RelativePath=
".\SimTKOpenMMLog.h"
>
</File>
<File
RelativePath=
".\SimTKOpenMMRealType.h"
>
</File>
<File
RelativePath=
".\SimTKOpenMMUtilities.h"
>
</File>
<File
RelativePath=
".\SimTKOpenMMWindowLinux.h"
>
</File>
<File
RelativePath=
".\TwoDimArraySimTk.h"
>
</File>
</Filter>
<Filter
Name=
"Resource Files"
Filter=
"rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier=
"{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<Filter
Name=
"Source Files"
Filter=
"cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier=
"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=
".\NewOverrideSimTk.cpp"
>
<FileConfiguration
Name=
"Debug|Win32"
ExcludedFromBuild=
"true"
>
<Tool
Name=
"VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name=
"DebugNoGPU_FAH|Win32"
ExcludedFromBuild=
"true"
>
<Tool
Name=
"VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=
".\SimTKOpenMMCommon.cpp"
>
</File>
<File
RelativePath=
".\SimTKOpenMMGpuUtilities.cpp"
>
</File>
<File
RelativePath=
".\SimTKOpenMMGromacsUtilities.cpp"
>
</File>
<File
RelativePath=
".\SimTKOpenMMLog.cpp"
>
</File>
<File
RelativePath=
".\SimTKOpenMMUtilities.cpp"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
platforms/reference/src/SimTKUtilities/SimTk.vcproj
0 → 100644
View file @
598e076c
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType=
"Visual C++"
Version=
"9.00"
Name=
"SimTk"
ProjectGUID=
"{82165226-E7AC-4C35-8914-80C31C7B4754}"
RootNamespace=
"SimTk"
Keyword=
"Win32Proj"
TargetFrameworkVersion=
"131072"
>
<Platforms>
<Platform
Name=
"Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name=
"Debug|Win32"
OutputDirectory=
"Debug"
IntermediateDirectory=
"Debug"
ConfigurationType=
"4"
>
<Tool
Name=
"VCPreBuildEventTool"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCXMLDataGeneratorTool"
/>
<Tool
Name=
"VCWebServiceProxyGeneratorTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCCLCompilerTool"
Optimization=
"0"
AdditionalIncludeDirectories=
"..\gromacs\include"
PreprocessorDefinitions=
"WIN32;_DEBUG;_LIB;"
MinimalRebuild=
"true"
BasicRuntimeChecks=
"3"
RuntimeLibrary=
"1"
UsePrecompiledHeader=
"0"
WarningLevel=
"3"
DebugInformationFormat=
"4"
/>
<Tool
Name=
"VCManagedResourceCompilerTool"
/>
<Tool
Name=
"VCResourceCompilerTool"
/>
<Tool
Name=
"VCPreLinkEventTool"
/>
<Tool
Name=
"VCLibrarianTool"
OutputFile=
"$(OutDir)\simtkUtilities.lib"
/>
<Tool
Name=
"VCALinkTool"
/>
<Tool
Name=
"VCXDCMakeTool"
/>
<Tool
Name=
"VCBscMakeTool"
/>
<Tool
Name=
"VCFxCopTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name=
"Release|Win32"
OutputDirectory=
"Release"
IntermediateDirectory=
"Release"
ConfigurationType=
"4"
>
<Tool
Name=
"VCPreBuildEventTool"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCXMLDataGeneratorTool"
/>
<Tool
Name=
"VCWebServiceProxyGeneratorTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCCLCompilerTool"
AdditionalIncludeDirectories=
"..\gromacs\include"
PreprocessorDefinitions=
"WIN32;NDEBUG;_LIB;"
RuntimeLibrary=
"0"
UsePrecompiledHeader=
"0"
WarningLevel=
"3"
DebugInformationFormat=
"3"
/>
<Tool
Name=
"VCManagedResourceCompilerTool"
/>
<Tool
Name=
"VCResourceCompilerTool"
/>
<Tool
Name=
"VCPreLinkEventTool"
/>
<Tool
Name=
"VCLibrarianTool"
OutputFile=
"$(OutDir)\simtkUtilities.lib"
/>
<Tool
Name=
"VCALinkTool"
/>
<Tool
Name=
"VCXDCMakeTool"
/>
<Tool
Name=
"VCBscMakeTool"
/>
<Tool
Name=
"VCFxCopTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name=
"Debug_FAHCORE|Win32"
OutputDirectory=
"$(ConfigurationName)"
IntermediateDirectory=
"$(ConfigurationName)"
ConfigurationType=
"4"
>
<Tool
Name=
"VCPreBuildEventTool"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCXMLDataGeneratorTool"
/>
<Tool
Name=
"VCWebServiceProxyGeneratorTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCCLCompilerTool"
Optimization=
"0"
AdditionalIncludeDirectories=
"..\gromacs\include"
PreprocessorDefinitions=
"WIN32;_DEBUG;_LIB;"
MinimalRebuild=
"true"
BasicRuntimeChecks=
"3"
RuntimeLibrary=
"3"
UsePrecompiledHeader=
"0"
WarningLevel=
"3"
DebugInformationFormat=
"4"
/>
<Tool
Name=
"VCManagedResourceCompilerTool"
/>
<Tool
Name=
"VCResourceCompilerTool"
/>
<Tool
Name=
"VCPreLinkEventTool"
/>
<Tool
Name=
"VCLibrarianTool"
OutputFile=
"$(OutDir)/simtkUtilities.lib"
/>
<Tool
Name=
"VCALinkTool"
/>
<Tool
Name=
"VCXDCMakeTool"
/>
<Tool
Name=
"VCBscMakeTool"
/>
<Tool
Name=
"VCFxCopTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name=
"Release_FAHCORE|Win32"
OutputDirectory=
"$(ConfigurationName)"
IntermediateDirectory=
"$(ConfigurationName)"
ConfigurationType=
"4"
>
<Tool
Name=
"VCPreBuildEventTool"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCXMLDataGeneratorTool"
/>
<Tool
Name=
"VCWebServiceProxyGeneratorTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCCLCompilerTool"
Optimization=
"0"
AdditionalIncludeDirectories=
"..\gromacs\include;../../corewrap"
PreprocessorDefinitions=
"WIN32;_LIB;FULLINDIRECT"
MinimalRebuild=
"true"
BasicRuntimeChecks=
"3"
RuntimeLibrary=
"0"
UsePrecompiledHeader=
"0"
WarningLevel=
"3"
DebugInformationFormat=
"4"
ForcedIncludeFiles=
"swindirect.h"
/>
<Tool
Name=
"VCManagedResourceCompilerTool"
/>
<Tool
Name=
"VCResourceCompilerTool"
/>
<Tool
Name=
"VCPreLinkEventTool"
/>
<Tool
Name=
"VCLibrarianTool"
OutputFile=
"$(OutDir)/simtkUtilities.lib"
/>
<Tool
Name=
"VCALinkTool"
/>
<Tool
Name=
"VCXDCMakeTool"
/>
<Tool
Name=
"VCBscMakeTool"
/>
<Tool
Name=
"VCFxCopTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name=
"DebugNoGPU_FAH|Win32"
OutputDirectory=
"$(ConfigurationName)"
IntermediateDirectory=
"$(ConfigurationName)"
ConfigurationType=
"4"
>
<Tool
Name=
"VCPreBuildEventTool"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCXMLDataGeneratorTool"
/>
<Tool
Name=
"VCWebServiceProxyGeneratorTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCCLCompilerTool"
Optimization=
"0"
AdditionalIncludeDirectories=
"..\gromacs\include"
PreprocessorDefinitions=
"WIN32;_DEBUG;_LIB;NoGPU"
MinimalRebuild=
"true"
BasicRuntimeChecks=
"3"
RuntimeLibrary=
"3"
UsePrecompiledHeader=
"0"
WarningLevel=
"3"
DebugInformationFormat=
"4"
/>
<Tool
Name=
"VCManagedResourceCompilerTool"
/>
<Tool
Name=
"VCResourceCompilerTool"
/>
<Tool
Name=
"VCPreLinkEventTool"
/>
<Tool
Name=
"VCLibrarianTool"
OutputFile=
"$(OutDir)\simtkUtilities.lib"
/>
<Tool
Name=
"VCALinkTool"
/>
<Tool
Name=
"VCXDCMakeTool"
/>
<Tool
Name=
"VCBscMakeTool"
/>
<Tool
Name=
"VCFxCopTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name=
"Header Files"
Filter=
"h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier=
"{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=
".\AssertSimTk.h"
>
</File>
<File
RelativePath=
".\SimTKlapack.h"
>
</File>
<File
RelativePath=
".\SimTKOpenMMCommon.h"
>
</File>
<File
RelativePath=
".\SimTKOpenMMGpuUtilities.h"
>
</File>
<File
RelativePath=
".\SimTKOpenMMGromacsUtilities.h"
>
</File>
<File
RelativePath=
".\SimTKOpenMMLog.h"
>
</File>
<File
RelativePath=
".\SimTKOpenMMRealType.h"
>
</File>
<File
RelativePath=
".\SimTKOpenMMUtilities.h"
>
</File>
<File
RelativePath=
".\SimTKOpenMMWindowLinux.h"
>
</File>
<File
RelativePath=
".\TwoDimArraySimTk.h"
>
</File>
</Filter>
<Filter
Name=
"Resource Files"
Filter=
"rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier=
"{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<Filter
Name=
"Source Files"
Filter=
"cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier=
"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=
".\NewOverrideSimTk.cpp"
>
<FileConfiguration
Name=
"Debug|Win32"
ExcludedFromBuild=
"true"
>
<Tool
Name=
"VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name=
"DebugNoGPU_FAH|Win32"
ExcludedFromBuild=
"true"
>
<Tool
Name=
"VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=
".\SimTKOpenMMCommon.cpp"
>
</File>
<File
RelativePath=
".\SimTKOpenMMGpuUtilities.cpp"
>
</File>
<File
RelativePath=
".\SimTKOpenMMGromacsUtilities.cpp"
>
</File>
<File
RelativePath=
".\SimTKOpenMMLog.cpp"
>
</File>
<File
RelativePath=
".\SimTKOpenMMUtilities.cpp"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
platforms/reference/src/SimTKUtilities/TwoDimArraySimTk.h
0 → 100755
View file @
598e076c
/* Portions copyright (c) 2006 Stanford University and Simbios.
* Contributors: Pande Group
*
* 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.
*/
#ifndef __TwoDimArraySimTk_H_
#define __TwoDimArraySimTk_H_
// ---------------------------------------------------------------------------------------
#include "UtilitiesSimTk.h"
/**---------------------------------------------------------------------------------------
Class for 2D arrays
--------------------------------------------------------------------------------------- */
template
<
typename
T
>
class
TwoDimArraySimTk
{
private:
int
_rowSize
;
int
_columnSize
;
T
**
_2Darray
;
T
*
_2DMemoryBlock
;
std
::
string
_name
;
public:
TwoDimArraySimTk
(
int
rowSize
,
int
columnSize
);
~
TwoDimArraySimTk
();
/**---------------------------------------------------------------------------------------
Get 2D array
@return ptr to array
--------------------------------------------------------------------------------------- */
T
**
get2DArray
(
void
)
const
{
return
_2Darray
;
};
/**---------------------------------------------------------------------------------------
Get print string
@return std::string
--------------------------------------------------------------------------------------- */
std
::
string
getPrintString
(
void
)
const
;
/**---------------------------------------------------------------------------------------
Get name
@return array name
--------------------------------------------------------------------------------------- */
std
::
string
getName
(
void
)
const
{
return
_name
;
};
/**---------------------------------------------------------------------------------------
Set name
@param array name
--------------------------------------------------------------------------------------- */
void
setName
(
std
::
string
name
){
_name
=
name
;
};
};
/**---------------------------------------------------------------------------------------
TwoDimArraySimTk constructor
@param rowSize row dimension
@param columnSize column dimension
--------------------------------------------------------------------------------------- */
template
<
typename
T
>
TwoDimArraySimTk
<
T
>::
TwoDimArraySimTk
(
int
rowSize
,
int
columnSize
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nTwoDimArraySimTk<T>::TwoDimArraySimTk";
// ---------------------------------------------------------------------------------------
_name
=
"NotSet"
;
_rowSize
=
rowSize
;
_columnSize
=
columnSize
;
#ifdef useXMalloc
_2Darray
=
(
T
**
)
UtilitiesSimTk
::
Xmalloc
(
"TwoDimArraySimTk"
,
__FILE__
,
__LINE__
,
rowSize
*
sizeof
(
T
*
)
);
_2DMemoryBlock
=
(
T
*
)
UtilitiesSimTk
::
Xmalloc
(
"block"
,
__FILE__
,
__LINE__
,
columnSize
*
rowSize
*
sizeof
(
T
)
);
#else
_2Darray
=
(
T
**
)
UtilitiesSimTk
::
Xmalloc
(
"TwoDimArraySimTk"
,
__FILE__
,
__LINE__
,
rowSize
*
sizeof
(
T
*
)
);
_2DMemoryBlock
=
(
T
*
)
UtilitiesSimTk
::
Xmalloc
(
"block"
,
__FILE__
,
__LINE__
,
columnSize
*
rowSize
*
sizeof
(
T
)
);
#endif
T
*
blockPtr
=
_2DMemoryBlock
;
for
(
int
ii
=
0
;
ii
<
rowSize
;
ii
++
){
_2Darray
[
ii
]
=
blockPtr
;
blockPtr
+=
columnSize
;
}
memset
(
_2DMemoryBlock
,
0
,
columnSize
*
rowSize
*
sizeof
(
T
)
);
// (void) fprintf( stdout, "\nTwoDimArraySimTk %s ", getPrintString().c_str() );
// (void) fflush( stdout );
}
/**---------------------------------------------------------------------------------------
TwoDimArraySimTk destructor
array[i][j]
@param rowSize row dimension
@param columnSize column dimension
--------------------------------------------------------------------------------------- */
template
<
typename
T
>
TwoDimArraySimTk
<
T
>::~
TwoDimArraySimTk
(
){
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nTwoDimArraySimTk<T>::~TwoDimArraySimTk";
// ---------------------------------------------------------------------------------------
if
(
_2DMemoryBlock
){
UtilitiesSimTk
::
Xfree
(
"2DMemoryBlock"
,
__FILE__
,
__LINE__
,
_2DMemoryBlock
);
}
if
(
_2Darray
){
UtilitiesSimTk
::
Xfree
(
"2Darray"
,
__FILE__
,
__LINE__
,
_2Darray
);
}
}
/**---------------------------------------------------------------------------------------
TwoDimArraySimTk print string
@return id string
--------------------------------------------------------------------------------------- */
template
<
typename
T
>
std
::
string
TwoDimArraySimTk
<
T
>::
getPrintString
(
void
)
const
{
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nTwoDimArraySimTk<T>::getPrintString";
// ---------------------------------------------------------------------------------------
std
::
stringstream
message
;
message
<<
_name
<<
" [ "
<<
_rowSize
<<
", "
<<
_columnSize
<<
" ] sizeT="
<<
sizeof
(
T
);
message
<<
" array="
<<
(
unsigned
int
)
_2Darray
<<
" block="
<<
(
unsigned
int
)
_2DMemoryBlock
;
// message << " array=" << (void *) _2Darray << " block=" << (void*) _2DMemoryBlock;
return
message
.
str
();
}
/**---------------------------------------------------------------------------------------
Typdefs to make code more readable
--------------------------------------------------------------------------------------- */
typedef
TwoDimArraySimTk
<
Real
>
TwoDimRealArraySimTk
;
typedef
std
::
vector
<
TwoDimRealArraySimTk
*>
TwoDimRealArraySimTkVector
;
typedef
std
::
vector
<
TwoDimRealArraySimTk
*>::
iterator
TwoDimRealArraySimTkVectorI
;
#endif // __TwoDimArraySimTk_H_
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