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
8097a594
Commit
8097a594
authored
Mar 28, 2020
by
Charlles Abreu
Browse files
Continuous1DFunction with setPeriodic and getPeriodic methods
parent
b04a0a94
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
6 deletions
+16
-6
openmmapi/include/openmm/TabulatedFunction.h
openmmapi/include/openmm/TabulatedFunction.h
+7
-1
openmmapi/src/TabulatedFunction.cpp
openmmapi/src/TabulatedFunction.cpp
+5
-1
platforms/common/src/ExpressionUtilities.cpp
platforms/common/src/ExpressionUtilities.cpp
+1
-1
platforms/reference/src/ReferenceTabulatedFunction.cpp
platforms/reference/src/ReferenceTabulatedFunction.cpp
+2
-2
serialization/src/TabulatedFunctionProxies.cpp
serialization/src/TabulatedFunctionProxies.cpp
+1
-1
No files found.
openmmapi/include/openmm/TabulatedFunction.h
View file @
8097a594
...
...
@@ -96,7 +96,7 @@ public:
*
* @param periodic whether the function is periodic
*/
void
getPeriodic
ityStatus
(
bool
&
periodic
)
const
;
void
getPeriodic
(
bool
&
periodic
)
const
;
/**
* Set the parameters for the tabulated function.
*
...
...
@@ -107,6 +107,12 @@ public:
* @param max the value of x corresponding to the last element of values
*/
void
setFunctionParameters
(
const
std
::
vector
<
double
>&
values
,
double
min
,
double
max
);
/**
* Set the periodicity status for the tabulated function.
*
* @param periodic whether the function is periodic with period L = max - min
*/
void
setPeriodic
(
bool
periodic
);
/**
* Create a deep copy of the tabulated function.
*
...
...
openmmapi/src/TabulatedFunction.cpp
View file @
8097a594
...
...
@@ -46,7 +46,7 @@ void Continuous1DFunction::getFunctionParameters(vector<double>& values, double&
max
=
this
->
max
;
}
void
Continuous1DFunction
::
getPeriodic
ityStatus
(
bool
&
periodic
)
const
{
void
Continuous1DFunction
::
getPeriodic
(
bool
&
periodic
)
const
{
periodic
=
this
->
periodic
;
}
...
...
@@ -67,6 +67,10 @@ void Continuous1DFunction::setFunctionParameters(const vector<double>& values, d
this
->
max
=
max
;
}
void
Continuous1DFunction
::
setPeriodic
(
bool
periodic
)
{
this
->
periodic
=
periodic
;
}
Continuous1DFunction
*
Continuous1DFunction
::
Copy
()
const
{
vector
<
double
>
new_vec
(
values
.
size
());
for
(
size_t
i
=
0
;
i
<
values
.
size
();
i
++
)
...
...
platforms/common/src/ExpressionUtilities.cpp
View file @
8097a594
...
...
@@ -721,7 +721,7 @@ vector<float> ExpressionUtilities::computeFunctionCoefficients(const TabulatedFu
double
min
,
max
;
fn
.
getFunctionParameters
(
values
,
min
,
max
);
bool
periodic
;
fn
.
getPeriodic
ityStatus
(
periodic
);
fn
.
getPeriodic
(
periodic
);
int
numValues
=
values
.
size
();
vector
<
double
>
x
(
numValues
),
derivs
;
for
(
int
i
=
0
;
i
<
numValues
;
i
++
)
...
...
platforms/reference/src/ReferenceTabulatedFunction.cpp
View file @
8097a594
...
...
@@ -76,7 +76,7 @@ extern "C" OPENMM_EXPORT CustomFunction* createReferenceTabulatedFunction(const
ReferenceContinuous1DFunction
::
ReferenceContinuous1DFunction
(
const
Continuous1DFunction
&
function
)
:
function
(
function
)
{
function
.
getFunctionParameters
(
values
,
min
,
max
);
function
.
getPeriodic
ityStatus
(
periodic
);
function
.
getPeriodic
(
periodic
);
int
numValues
=
values
.
size
();
x
.
resize
(
numValues
);
for
(
int
i
=
0
;
i
<
numValues
;
i
++
)
...
...
@@ -89,7 +89,7 @@ ReferenceContinuous1DFunction::ReferenceContinuous1DFunction(const Continuous1DF
ReferenceContinuous1DFunction
::
ReferenceContinuous1DFunction
(
const
ReferenceContinuous1DFunction
&
other
)
:
function
(
other
.
function
)
{
function
.
getFunctionParameters
(
values
,
min
,
max
);
function
.
getPeriodic
ityStatus
(
periodic
);
function
.
getPeriodic
(
periodic
);
x
=
other
.
x
;
values
=
other
.
values
;
derivs
=
other
.
derivs
;
...
...
serialization/src/TabulatedFunctionProxies.cpp
View file @
8097a594
...
...
@@ -52,7 +52,7 @@ void Continuous1DFunctionProxy::serialize(const void* object, SerializationNode&
for
(
auto
v
:
values
)
valuesNode
.
createChildNode
(
"Value"
).
setDoubleProperty
(
"v"
,
v
);
bool
periodic
;
function
.
getPeriodic
ityStatus
(
periodic
);
function
.
getPeriodic
(
periodic
);
node
.
setBoolProperty
(
"periodic"
,
periodic
);
}
...
...
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