Skip to content

Adding Gromacs environment to a python session

Oliver Beckstein edited this page Nov 11, 2015 · 1 revision

If you run GromacsWrapper in an ipython notebook and you forgot to source GMXRC (or load a gromacs module) then you can patch the paths into the environment. Use the appropriate paths for your installation:

import os

def env_prepend(envvar, path):
    env = os.environ
    try:
        env[envvar] = ":".join([path, env[envvar]])
    except KeyError:
        env[envvar] = path
    return env[envvar]

# add Gromacs paths
# USE YOUR PATHS HERE
env_prepend("PATH", "/nfs/packages/opt/Linux_x86_64/gromacs/5.0.5/cuda6/gnu/sse2/bin")
env_prepend("LD_RUN_PATH", "/nfs/packages/opt/Linux_x86_64/gromacs/5.0.5/cuda6/gnu/sse2/lib")
env_prepend("LD_LIBRARY_PATH", "/nfs/packages/opt/Linux_x86_64/gromacs/5.0.5/cuda6/gnu/sse2/lib")
env_prepend("MANPATH", "/nfs/packages/opt/Linux_x86_64/gromacs/5.0.5/cuda6/gnu/sse2/share/man")
os.environ["GMXDIR"] = "/nfs/packages/opt/Linux_x86_64/gromacs/5.0.5/cuda6/gnu/sse2"
os.environ["GMXBIN"] = "/nfs/packages/opt/Linux_x86_64/gromacs/5.0.5/cuda6/gnu/sse2/bin"
os.environ["GMXLDLIB"] = "/nfs/packages/opt/Linux_x86_64/gromacs/5.0.5/cuda6/gnu/sse2/lib"
os.environ["GMXMAN"] = "/nfs/packages/opt/Linux_x86_64/gromacs/5.0.5/cuda6/gnu/sse2/share/man"
os.environ["GMXDATA"] = "/nfs/packages/opt/Linux_x86_64/gromacs/5.0.5/cuda6/gnu/sse2/share"
os.environ["GMXFONT"] = "10x20"
Clone this wiki locally