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
de366ef7
Commit
de366ef7
authored
Apr 20, 2012
by
Peter Eastman
Browse files
Mike Garrahan's fix to the Fortran wrapper for getState()
parent
d407854c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
2 deletions
+22
-2
examples/HelloArgonInFortran.f90
examples/HelloArgonInFortran.f90
+1
-1
examples/HelloSodiumChlorideInFortran.f90
examples/HelloSodiumChlorideInFortran.f90
+1
-1
wrappers/FortranWrapper_Header.xslt
wrappers/FortranWrapper_Header.xslt
+20
-0
No files found.
examples/HelloArgonInFortran.f90
View file @
de366ef7
...
...
@@ -67,7 +67,7 @@ PROGRAM HelloArgon
frameNum
=
1
do
! Output current state information.
call
OpenMM_Context_getState
(
context
,
OpenMM_State_Positions
,
state
,
0
)
call
OpenMM_Context_getState
(
context
,
OpenMM_State_Positions
,
OpenMM_False
,
state
)
timeInPs
=
OpenMM_State_getTime
(
state
)
call
writePdbFrame
(
frameNum
,
state
)
!output coordinates
call
OpenMM_State_destroy
(
state
)
...
...
examples/HelloSodiumChlorideInFortran.f90
View file @
de366ef7
...
...
@@ -279,7 +279,7 @@ SUBROUTINE myGetOpenMMState(ommHandle, timeInPs, energyInKcal)
! Forces are also available (and cheap).
! Don't forget to destroy this State when you're done with it.
call
OpenMM_Context_getState
(
context
,
infoMask
,
state
,
0
)
call
OpenMM_Context_getState
(
context
,
infoMask
,
OpenMM_False
,
state
)
timeInPs
=
OpenMM_State_getTime
(
state
)
! OpenMM time is in ps already.
! Positions are maintained as a Vec3Array inside the State. This will give
...
...
wrappers/FortranWrapper_Header.xslt
View file @
de366ef7
...
...
@@ -27,6 +27,8 @@
<!-- Do not generate functions for the following classes -->
<xsl:variable
name=
"skip_classes"
select=
"('Vec3', 'Kernel', 'Stream', 'KernelImpl', 'StreamImpl', 'KernelFactory', 'StreamFactory')"
/>
<!-- Do not generate the following functions -->
<xsl:variable
name=
"skip_methods"
select=
"('OpenMM_Context_getState', 'OpenMM_Platform_loadPluginsFromDirectory')"
/>
<!-- Suppress any function which references any of the following classes -->
<xsl:variable
name=
"hide_classes"
select=
"('Kernel', 'Stream', 'KernelImpl', 'StreamImpl', 'KernelFactory', 'StreamFactory', 'ContextImpl')"
/>
...
...
@@ -249,6 +251,22 @@ MODULE OpenMM
<xsl:with-param
name=
"name"
select=
"'OpenMM_DoubleArray'"
/>
</xsl:call-template>
! These methods need to be handled specially, since their C++ APIs cannot be directly translated to Fortran.
! Unlike the C++ versions, the return value is allocated on the heap, and you must delete it yourself.
subroutine OpenMM_Context_getState(target, types, enforcePeriodicBox, result)
use OpenMM_Types; implicit none
type (OpenMM_Context) target
integer*4 types
integer*4 enforcePeriodicBox
type (OpenMM_State) result
end
subroutine OpenMM_Platform_loadPluginsFromDirectory(directory, result)
use OpenMM_Types; implicit none
character(*) directory
type (OpenMM_StringArray) result
end
<!-- Class members -->
<xsl:for-each
select=
"Class[@context=$openmm_namespace_id and empty(index-of($skip_classes, @name))]"
>
<xsl:call-template
name=
"class"
/>
...
...
@@ -507,6 +525,8 @@ END MODULE OpenMM
<!-- Determine whether a method should be hidden -->
<xsl:template
name=
"should_hide"
>
<xsl:variable
name=
"class_id"
select=
"@context"
/>
<xsl:variable
name=
"method_name"
select=
"concat('OpenMM_', /GCC_XML/Class[@id=$class_id]/@name, '_', @name)"
/>
<xsl:if
test=
"not(empty(index-of($skip_methods, $method_name)))"
>
1
</xsl:if>
<xsl:call-template
name=
"hide_type"
>
<xsl:with-param
name=
"type_id"
select=
"@returns"
/>
</xsl:call-template>
...
...
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