Compiling/Linking/Running

Compiling Using CMake

LibTPS uses CMake for cross-platform builds.

Before Compiling:

  1. Download and install subversion (http://subversion.tigris.org/)
  2. Download the libtps source via
    $ subversion: svn checkout svn+ssh://$(whoami)@matforge.org/usr/local/svn-mol_sim_api-repos
    
  3. Download and install CMake (http://www.cmake.org/cmake/resources/software.html)

Compiling and Installing:

  1. Change to the directory in which you want to build libtps
  2. run CMake (how you do this depends on how you installed CMake)
    • Option 1: Run the CMake Application
    • Option 2 (*nix): from the command line:
      $ cmake-gui 
      
    • Option 3 (*nix): from the command line:
      $ ccmake path/to/libtps/main/source/directory
      

Configure the options in CMake and then compile and install the library. By default, the library will install to /usr/local on *nix systems such as linux or OS X.

Linking with C/C++

To use libtps with a C/C++ code first include the libtps header file somewhere in the code.

//example.cpp
#include <tps/tps.h>

Then to compile, we use a command something like the following:

$ c++ example.cpp -ltps

This assumes that we have used the default install location /usr/local/. If we specify an install location, we would use a command more like the following:

$ c++ example.cpp -I/my/path/include -L/my/path/lib -ltps
Here, -I specifies a path in which to look for header files and -L specifies a path in which to look for libraries.

Sometimes we need to link with the underlying simulation wrapper. For example, to use LibTPS with LAMMPS, we would use a command like the following

$ mpic++ example.cpp -ltps -llammps
Here, we assume that the name of the LAMMPS library is "lammps" and that libtps.a and liblammps.a live in a globa library search path like /usr/local/lib.

Linking with Python

To use LibTPS from python include a line like:
from tps import *

Before Python can find the tps module, you must do one of two things:


Generated on Tue Jul 21 15:52:40 2009 for TPS by  doxygen 1.5.9