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
aeed917a
Commit
aeed917a
authored
Jun 12, 2009
by
Michael Sherman
Browse files
This might be the final NaCl in Fortran
parent
0df0cd8b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
24 deletions
+25
-24
examples/HelloSodiumChlorideInFortran.f90
examples/HelloSodiumChlorideInFortran.f90
+25
-24
No files found.
examples/HelloSodiumChlorideInFortran.f90
View file @
aeed917a
...
@@ -118,7 +118,9 @@ END PROGRAM
...
@@ -118,7 +118,9 @@ END PROGRAM
!-------------------------------------------------------------------------------
!-------------------------------------------------------------------------------
! PDB FILE WRITER
! PDB FILE WRITER
!-------------------------------------------------------------------------------
!-------------------------------------------------------------------------------
! Given state data, output a single frame (pdb "model") of the trajectory
! Given state data which was written into the atoms array of the MyAtomInfo
! module, output a single frame (pdb "model") of the trajectory. This has
! nothing to do with OpenMM.
SUBROUTINE
myWritePDBFrame
(
frameNum
,
timeInPs
,
energyInKcal
)
SUBROUTINE
myWritePDBFrame
(
frameNum
,
timeInPs
,
energyInKcal
)
use
MyAtomInfo
;
implicit
none
use
MyAtomInfo
;
implicit
none
integer
frameNum
;
real
*
8
timeInPs
,
energyInKcal
integer
frameNum
;
real
*
8
timeInPs
,
energyInKcal
...
@@ -144,7 +146,7 @@ END SUBROUTINE
...
@@ -144,7 +146,7 @@ END SUBROUTINE
! Fortran main program. (See the C++ version of this example program for
! Fortran main program. (See the C++ version of this example program for
! an implementation of very similar routines.) However, these routines are
! an implementation of very similar routines.) However, these routines are
! reimplemented entirely in Fortran 95 below in case you prefer.
! reimplemented entirely in Fortran 95 below in case you prefer.
!-------------------------------------------------------------------------------
! ------------------------------------------------------------------------------
! ------------------------------------------------------------------------------
! INITIALIZE OpenMM DATA STRUCTURES
! INITIALIZE OpenMM DATA STRUCTURES
...
@@ -171,18 +173,16 @@ SUBROUTINE myInitializeOpenMM(ommHandle, platformName)
...
@@ -171,18 +173,16 @@ SUBROUTINE myInitializeOpenMM(ommHandle, platformName)
! This is the actual type of the opaque handle.
! This is the actual type of the opaque handle.
type
(
OpenMM_RuntimeObjects
)
omm
type
(
OpenMM_RuntimeObjects
)
omm
! These are the objects we'll create here and store in the
RuntimeObjects
! These are the objects we'll create here and store in the
! container for later access.
!
RuntimeObjects
container for later access.
type
(
OpenMM_System
)
system
type
(
OpenMM_System
)
system
type
(
OpenMM_Integrator
)
integrator
type
(
OpenMM_
Langevin
Integrator
)
langevin
type
(
OpenMM_Context
)
context
type
(
OpenMM_Context
)
context
! These are temporary OpenMM objects used and discarded here.
! These are temporary OpenMM objects used and discarded here.
type
(
OpenMM_Vec3Array
)
initialPosInNm
type
(
OpenMM_Vec3Array
)
initialPosInNm
type
(
OpenMM_NonbondedForce
)
nonbond
type
(
OpenMM_NonbondedForce
)
nonbond
type
(
OpenMM_GBSAOBCForce
)
gbsa
type
(
OpenMM_GBSAOBCForce
)
gbsa
type
(
OpenMM_Force
)
force
! generic Force
type
(
OpenMM_LangevinIntegrator
)
langevin
integer
n
integer
n
type
(
OpenMM_String
)
dir
type
(
OpenMM_String
)
dir
...
@@ -202,10 +202,8 @@ SUBROUTINE myInitializeOpenMM(ommHandle, platformName)
...
@@ -202,10 +202,8 @@ SUBROUTINE myInitializeOpenMM(ommHandle, platformName)
! Convert specific force types to generic OpenMM_Force so that we can
! Convert specific force types to generic OpenMM_Force so that we can
! add them to the OpenMM_System.
! add them to the OpenMM_System.
call
OpenMM_NonbondedForce_asForce
(
nonbond
,
force
)
call
OpenMM_System_addForce
(
system
,
transfer
(
nonbond
,
OpenMM_Force
(
null
())))
call
OpenMM_System_addForce
(
system
,
force
)
call
OpenMM_System_addForce
(
system
,
transfer
(
gbsa
,
OpenMM_Force
(
null
())))
call
OpenMM_GBSAOBCForce_asForce
(
gbsa
,
force
)
call
OpenMM_System_addForce
(
system
,
force
)
! Specify dielectrics for GBSA implicit solvation.
! Specify dielectrics for GBSA implicit solvation.
call
OpenMM_GBSAOBCForce_setSolventDielectric
(
gbsa
,
SolventDielectric
)
call
OpenMM_GBSAOBCForce_setSolventDielectric
(
gbsa
,
SolventDielectric
)
...
@@ -245,8 +243,10 @@ SUBROUTINE myInitializeOpenMM(ommHandle, platformName)
...
@@ -245,8 +243,10 @@ SUBROUTINE myInitializeOpenMM(ommHandle, platformName)
call
OpenMM_LangevinIntegrator_create
(
langevin
,
&
call
OpenMM_LangevinIntegrator_create
(
langevin
,
&
Temperature
,
FrictionInPerPs
,
&
Temperature
,
FrictionInPerPs
,
&
StepSizeInFs
*
OpenMM_PsPerFs
)
StepSizeInFs
*
OpenMM_PsPerFs
)
call
OpenMM_LangevinIntegrator_asIntegrator
(
langevin
,
integrator
)
call
OpenMM_Context_create
(
context
,
system
,
integrator
)
! Convert LangevinIntegrator to generic Integrator type for this call.
call
OpenMM_Context_create
(
context
,
system
,
&
transfer
(
langevin
,
OpenMM_Integrator
(
null
())))
call
OpenMM_Context_setPositions
(
context
,
initialPosInNm
)
call
OpenMM_Context_setPositions
(
context
,
initialPosInNm
)
! Get the platform name to return.
! Get the platform name to return.
...
@@ -256,7 +256,8 @@ SUBROUTINE myInitializeOpenMM(ommHandle, platformName)
...
@@ -256,7 +256,8 @@ SUBROUTINE myInitializeOpenMM(ommHandle, platformName)
! container and return an opaque reference to the container.
! container and return an opaque reference to the container.
call
OpenMM_RuntimeObjects_create
(
omm
)
call
OpenMM_RuntimeObjects_create
(
omm
)
call
OpenMM_RuntimeObjects_setSystem
(
omm
,
system
)
call
OpenMM_RuntimeObjects_setSystem
(
omm
,
system
)
call
OpenMM_RuntimeObjects_setIntegrator
(
omm
,
integrator
)
call
OpenMM_RuntimeObjects_setIntegrator
(
omm
,
&
transfer
(
langevin
,
OpenMM_Integrator
(
null
())))
call
OpenMM_RuntimeObjects_setContext
(
omm
,
context
)
call
OpenMM_RuntimeObjects_setContext
(
omm
,
context
)
ommHandle
=
transfer
(
omm
,
ommHandle
)
ommHandle
=
transfer
(
omm
,
ommHandle
)
END
SUBROUTINE
END
SUBROUTINE
...
@@ -271,9 +272,8 @@ SUBROUTINE myGetOpenMMState(ommHandle, timeInPs, energyInKcal)
...
@@ -271,9 +272,8 @@ SUBROUTINE myGetOpenMMState(ommHandle, timeInPs, energyInKcal)
real
*
8
,
intent
(
out
)
::
timeInPs
,
energyInKcal
real
*
8
,
intent
(
out
)
::
timeInPs
,
energyInKcal
type
(
OpenMM_State
)
state
type
(
OpenMM_State
)
state
type
(
OpenMM_Vec3Array
)
posArray
type
(
OpenMM_Vec3Array
)
posArray
InNm
integer
infoMask
,
n
integer
infoMask
,
n
real
*
8
posInNm
(
3
)
type
(
OpenMM_RuntimeObjects
)
omm
type
(
OpenMM_RuntimeObjects
)
omm
type
(
OpenMM_Context
)
context
type
(
OpenMM_Context
)
context
...
@@ -294,10 +294,11 @@ SUBROUTINE myGetOpenMMState(ommHandle, timeInPs, energyInKcal)
...
@@ -294,10 +294,11 @@ SUBROUTINE myGetOpenMMState(ommHandle, timeInPs, energyInKcal)
! Positions are maintained as a Vec3Array inside the State. This will give
! Positions are maintained as a Vec3Array inside the State. This will give
! us access, but don't destroy it yourself -- it will go away with the State.
! us access, but don't destroy it yourself -- it will go away with the State.
call
OpenMM_State_getPositions
(
state
,
posArray
)
call
OpenMM_State_getPositions
(
state
,
posArray
InNm
)
do
n
=
1
,
NumAtoms
do
n
=
1
,
NumAtoms
call
OpenMM_Vec3Array_get
(
posArray
,
n
,
posInNm
)
! Sets atoms(n)%pos = posArray(n) * Angstroms/nm.
call
OpenMM_Vec3_scale
(
posInNm
,
OpenMM_AngstromsPerNm
,
atoms
(
n
)
%
posInAng
)
call
OpenMM_Vec3Array_getScaled
(
posArrayInNm
,
n
,
OpenMM_AngstromsPerNm
,
&
atoms
(
n
)
%
posInAng
)
end
do
end
do
energyInKcal
=
0
energyInKcal
=
0
...
...
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