Commit 8bb0400f authored by Michael Sherman's avatar Michael Sherman
Browse files

Added some Intel Fortran instructions; deleted obsolete Mac-specific makefile.

parent 38d293e4
## Compiling a Fortran main with C++ can be finicky about libraries.
## Here FCPPLIBS is set the way we had to do it to work on a Mac.
## (Otherwise this is just a copy of 'Makefile')
# ----------------------------------------------------------------------
# Makefile for OpenMM Preview Release 3 workshop "hello world" examples.
# June 24, 2009.
# See https://simtk.org/home/openmm.
# ----------------------------------------------------------------------
# This assumes you have gcc compilers for whatever language you are
# using: g++ for C++ and C, gfortran for Fortran 95.
#
# Note: the C Wrappers and Fortran Module are just prototypes. They are
# incomplete but have enough functionality to get through these examples.
# We would like more complete and better-thought-out interfaces; if you
# have code or ideas please post to the OpenMM forum at the above URL
# (select "Advanced/Public Forums").
#
# This has had only minimal testing, although it has been known to
# work. It is likely to work fine for C and C++. For Fortran, you
# may need to add some of the C/C++ libraries:
# -lc -lm -lstdc++ (or -lstdc++.6) -lgcc -lgcc_s
# but this wasn't required for these examples on Centos 5.2 using
# gcc 4.1.2.
# Check whether this is the right capitalization for your install directory.
OpenMM_INSTALL_DIR=/usr/local/openmm
CFLAGS = -g
FFLAGS = -g
# Extra libraries required when gfortran links with a C++ module.
# Uncomment this on Mac. If this doesn't work, look in /usr/lib to
# see what versions of libstdc++.so you have and try that.
FCPPLIBS = -lstdc++.6
LIB_DIR=$(OpenMM_INSTALL_DIR)/lib
INCLUDE_DIR=$(OpenMM_INSTALL_DIR)/include
# assume local directory for C and Fortran wrappers
WRAPPER_DIR=.
LIBS= -lOpenMM
ALL_CPP_EXAMPLES = HelloArgon HelloSodiumChloride HelloEthane HelloWaterBox
ALL_C_EXAMPLES = HelloArgonInC HelloSodiumChlorideInC
ALL_F95_EXAMPLES = HelloArgonInFortran HelloSodiumChlorideInFortran
ALL_PROGS = $(ALL_CPP_EXAMPLES) $(ALL_C_EXAMPLES) $(ALL_F95_EXAMPLES)
default: HelloArgon
all : $(ALL_PROGS)
# Treat all .cpp source files the same way (except the one that
# implements the C Wrappers).
.cpp :
g++ $(CFLAGS) $< -I$(INCLUDE_DIR) -L$(LIB_DIR) $(LIBS) -o $*
HelloArgonInC: HelloArgonInC.c OpenMM_CWrapper.o
g++ $(CFLAGS) -I$(WRAPPER_DIR) HelloArgonInC.c OpenMM_CWrapper.o \
-L$(LIB_DIR) $(LIBS) -o HelloArgonInC
HelloSodiumChlorideInC: HelloSodiumChlorideInC.c OpenMM_CWrapper.o
g++ $(CFLAGS) -I$(WRAPPER_DIR) HelloSodiumChlorideInC.c OpenMM_CWrapper.o \
-L$(LIB_DIR) $(LIBS) -o HelloSodiumChlorideInC
HelloArgonInFortran: HelloArgonInFortran.f90 openmm.mod OpenMM_CWrapper.o
gfortran $(FFLAGS) HelloArgonInFortran.f90 OpenMM_CWrapper.o \
-L$(LIB_DIR) $(LIBS) $(FCPPLIBS) -o HelloArgonInFortran
HelloSodiumChlorideInFortran: HelloSodiumChlorideInFortran.f90 openmm.mod OpenMM_CWrapper.o
gfortran $(FFLAGS) HelloSodiumChlorideInFortran.f90 OpenMM_CWrapper.o \
-L$(LIB_DIR) $(LIBS) $(FCPPLIBS) -o HelloSodiumChlorideInFortran
# Build C Wrappers (Fortran depends on this too)
OpenMM_CWrapper.o:
g++ -c $(CFLAGS) -I$(WRAPPER_DIR) -I$(INCLUDE_DIR) \
$(WRAPPER_DIR)/OpenMM_CWrapper.cpp -o OpenMM_CWrapper.o
# Build Fortran 95 Module file
openmm.mod:
gfortran -c $(FFLAGS) $(WRAPPER_DIR)/OpenMM_Module.f90
clean :
rm $(ALL_PROGS) *.o *.mod
Instructions for using the Makefile provided. Instructions for using the Makefile provided.
--------------------------------------------- ---------------------------------------------
You must already have the OpenMM binaries installed from SimTK.org/home/OpenMM. Pay careful attention to the installation There is a Makefile for use on Linux and Mac, and an NMakefile
for use with Microsoft's "nmake" program. For Fortran, the
Makefile expects gfortran to be in the path while NMakefile
expects "ifort" (Intel Fortran).
You must already have the OpenMM binaries installed from
SimTK.org/home/OpenMM. Pay careful attention to the installation
instructions -- if you are hoping to get GPU acceleration you instructions -- if you are hoping to get GPU acceleration you
may also have to install appropriate vendor libraries and a driver. may also have to install appropriate vendor libraries and a driver.
You may need to slightly edit the Makefile to make it run on your system, depending where you installed OpenMM and the particular requirements of your version of gcc for mixed Fortran/C++ programming. There is a copy of the Makefile called 'Makefile.mac' which uses a library that worked for us on Mac. You may need to slightly edit the Makefile or NMakefile to make
it run on your system, depending where you installed OpenMM and
the particular requirements of your compiler versions for mixed
Fortran/C++ programming.
Type "make" (or "make default") to get just one C++ example built Type "make" (or "make default") to get just one C++ example built
(HelloArgon). Make sure it runs. (HelloArgon). Make sure it runs.
To compile all example programs type "make all". That includes Fortran To compile all example programs type "make all". That includes Fortran
examples though so you will see failures unless you have gfortran examples though so you will see failures unless you have gfortran
installed. However, the C++ and C examples should compile with just installed (Linux and Mac) or ifort installed (Windows). However,
g++. the C++ and C examples should compile with just g++ or cl.
To build just one example, type "make HelloArgonInC" or whatever. To build just one example, type "make HelloArgonInC" or whatever.
Before you run the executables, remember to add the OpenMM dynamic library directory to your library path. Before you run the executables, remember to add the OpenMM dynamic
library directory to your library path.
The simplest way to do this is to type the following commands: The simplest way to do this is to type the following commands:
For linux (for the bash shell, assuming installation was done in the default location: /usr/local/openmm): For linux (for the bash shell, assuming installation was done in
the default location: /usr/local/openmm):
$ export LD_LIBRARY_PATH=/usr/local/openmm/lib $ export LD_LIBRARY_PATH=/usr/local/openmm/lib
For MAC (for the bash shell, assuming installation was done in the default location: /usr/local/openmm): For MAC (for the bash shell, assuming installation was done
in the default location: /usr/local/openmm):
$ export DYLD_LIBRARY_PATH=/usr/local/openmm/lib $ export DYLD_LIBRARY_PATH=/usr/local/openmm/lib
For Windows (command tool, assuming installation was done
in the default location: C:/Program Files/OpenMM):
C:\> set path=%path%;C:\Program Files\OpenMM\lib
...@@ -6,10 +6,19 @@ See https://simtk.org/home/openmm. ...@@ -6,10 +6,19 @@ See https://simtk.org/home/openmm.
For help go to the Advanced/Public Forums tab and post to the For help go to the Advanced/Public Forums tab and post to the
"help" forum there. "help" forum there.
OpenMM is part of SimTK, the Simbios simulation Toolkit, from the Simbios National Center for Physics-based Simulation of Biological Structures funded by the National Institutes of Health OpenMM is part of SimTK, the Simbios simulation Toolkit, from
through the NIH Roadmap for Medical Research, Grant U54 GM072970. Information on the National Centers for Biomedical Computing can be obtained here: http://nihroadmap.nih.gov/bioinformatics/. the Simbios National Center for Physics-based Simulation of
Biological Structures funded by the National Institutes of Health
OpenMM is developed under the supervision of Simbios P.I. Vijay Pande at Stanford. Any work that uses OpenMM should cite the following paper: M. S. Friedrichs, P. Eastman, V. Vaidyanathan, M. Houston, S. LeGrand, A. L. Beberg, D. L. Ensign, C. M. Bruns, V. S. Pande. “Accelerating Molecular Dynamic Simulation on Graphics Processing Units.” J. Comp. Chem., (2009), 30(6):864-872. through the NIH Roadmap for Medical Research, Grant U54 GM072970.
Information on the National Centers for Biomedical Computing can
be obtained here: http://nihroadmap.nih.gov/bioinformatics/.
OpenMM is developed under the supervision of Simbios P.I. Vijay
Pande at Stanford. Any work that uses OpenMM should cite the
following paper: M. S. Friedrichs, P. Eastman, V. Vaidyanathan,
M. Houston, S. LeGrand, A. L. Beberg, D. L. Ensign, C. M. Bruns,
V. S. Pande. “Accelerating Molecular Dynamic Simulation on
Graphics Processing Units.” J. Comp. Chem., (2009), 30(6):864-872.
These simple "hello world" examples were developed by These simple "hello world" examples were developed by
Christopher Bruns and Michael Sherman for the OpenMM Christopher Bruns and Michael Sherman for the OpenMM
...@@ -17,11 +26,14 @@ workshop on June 24, 2009 at Stanford. ...@@ -17,11 +26,14 @@ workshop on June 24, 2009 at Stanford.
---------------------------------------------------------------- ----------------------------------------------------------------
In addition to the example programs here, there are also two sets of prototype wrappers to enable C and Fortran 95 to call the OpenMM API. However, even if your calling code is in C or Fortran, please consider instead writing your OpenMM-calling routines in C++, using 'extern "C"' In addition to the example programs here, there are also two sets
so that your main program can call them. If that isn't feasible of prototype wrappers to enable C and Fortran 95 to call the
for you, try out our prototype wrappers and let us know what OpenMM API. However, even if your calling code is in C or Fortran,
troubles or better ideas you have. (Post to the OpenMM Forum please consider instead writing your OpenMM-calling routines in
at the above URL.) C++, using 'extern "C"' so that your main program can call them.
If that isn't feasible for you, try out our prototype wrappers
and let us know what troubles or better ideas you have. (Post to
the OpenMM Forum at the above URL.)
Building the examples Building the examples
--------------------- ---------------------
...@@ -30,6 +42,10 @@ This directory includes a Makefile suitable for building the ...@@ -30,6 +42,10 @@ This directory includes a Makefile suitable for building the
examples under Mac or Linux and possibly Cygwin, using the examples under Mac or Linux and possibly Cygwin, using the
gcc compiler suite. See MakefileNotes.txt for more info. gcc compiler suite. See MakefileNotes.txt for more info.
There is a file "NMakefile" which can be used with Microsoft's
NMake program to build the examples using Microsoft's "cl" compiler
for C++ and C, and Intel's "ifort" Fortran compiler.
There is a subdirectory here providing Visual Studio "solutions" There is a subdirectory here providing Visual Studio "solutions"
for building HelloArgon in C++ or C. You will have to make your for building HelloArgon in C++ or C. You will have to make your
own for the other examples or just substitute a different source own for the other examples or just substitute a different source
...@@ -53,7 +69,8 @@ HelloSodiumChloride (C++, C, Fortran 95) ...@@ -53,7 +69,8 @@ HelloSodiumChloride (C++, C, Fortran 95)
This example shows how we recommend using OpenMM so that you This example shows how we recommend using OpenMM so that you
can call it from an existing Molecular Dynamics code with can call it from an existing Molecular Dynamics code with
minimal disruption. The example contains Coulomb and van der minimal disruption. The example contains Coulomb and van der
Waals interactions and implicit solvation in a constant temperature simulation. Waals interactions and implicit solvation in a constant
temperature simulation.
HelloEthane (C++ only) HelloEthane (C++ only)
---------------------- ----------------------
......
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