Commit de366ef7 authored by Peter Eastman's avatar Peter Eastman
Browse files

Mike Garrahan's fix to the Fortran wrapper for getState()

parent d407854c
...@@ -67,7 +67,7 @@ PROGRAM HelloArgon ...@@ -67,7 +67,7 @@ PROGRAM HelloArgon
frameNum = 1 frameNum = 1
do do
! Output current state information. ! 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) timeInPs = OpenMM_State_getTime(state)
call writePdbFrame(frameNum, state) !output coordinates call writePdbFrame(frameNum, state) !output coordinates
call OpenMM_State_destroy(state) call OpenMM_State_destroy(state)
......
...@@ -279,7 +279,7 @@ SUBROUTINE myGetOpenMMState(ommHandle, timeInPs, energyInKcal) ...@@ -279,7 +279,7 @@ SUBROUTINE myGetOpenMMState(ommHandle, timeInPs, energyInKcal)
! Forces are also available (and cheap). ! Forces are also available (and cheap).
! Don't forget to destroy this State when you're done with it. ! 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. timeInPs = OpenMM_State_getTime(state) ! OpenMM time is in ps already.
! Positions are maintained as a Vec3Array inside the State. This will give ! Positions are maintained as a Vec3Array inside the State. This will give
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
<!-- Do not generate functions for the following classes --> <!-- Do not generate functions for the following classes -->
<xsl:variable name="skip_classes" select="('Vec3', 'Kernel', 'Stream', 'KernelImpl', 'StreamImpl', 'KernelFactory', 'StreamFactory')"/> <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 --> <!-- Suppress any function which references any of the following classes -->
<xsl:variable name="hide_classes" select="('Kernel', 'Stream', 'KernelImpl', 'StreamImpl', 'KernelFactory', 'StreamFactory', 'ContextImpl')"/> <xsl:variable name="hide_classes" select="('Kernel', 'Stream', 'KernelImpl', 'StreamImpl', 'KernelFactory', 'StreamFactory', 'ContextImpl')"/>
...@@ -249,6 +251,22 @@ MODULE OpenMM ...@@ -249,6 +251,22 @@ MODULE OpenMM
<xsl:with-param name="name" select="'OpenMM_DoubleArray'"/> <xsl:with-param name="name" select="'OpenMM_DoubleArray'"/>
</xsl:call-template> </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 --> <!-- Class members -->
<xsl:for-each select="Class[@context=$openmm_namespace_id and empty(index-of($skip_classes, @name))]"> <xsl:for-each select="Class[@context=$openmm_namespace_id and empty(index-of($skip_classes, @name))]">
<xsl:call-template name="class"/> <xsl:call-template name="class"/>
...@@ -507,6 +525,8 @@ END MODULE OpenMM ...@@ -507,6 +525,8 @@ END MODULE OpenMM
<!-- Determine whether a method should be hidden --> <!-- Determine whether a method should be hidden -->
<xsl:template name="should_hide"> <xsl:template name="should_hide">
<xsl:variable name="class_id" select="@context"/> <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:call-template name="hide_type">
<xsl:with-param name="type_id" select="@returns"/> <xsl:with-param name="type_id" select="@returns"/>
</xsl:call-template> </xsl:call-template>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment