Skip to content

Commit

Permalink
i-PI version 2.0.0
Browse files Browse the repository at this point in the history
As archived with the publication: https://doi.org/10.1016/j.cpc.2018.09.020
  • Loading branch information
OndrejMarsalek committed Nov 1, 2018
1 parent 7e9661d commit 94456a2
Show file tree
Hide file tree
Showing 978 changed files with 479,904 additions and 75,537 deletions.
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#ignored patterns

bin/*
bin/i-pi-driver
doc/manual.pdf
doc/manual.xml
*.pyc
*.pyo
*.x
*.mod
*.out
*.o
*.pdf
*~
\#*
*.orig
regtest-ref
4 changes: 0 additions & 4 deletions .vimrc

This file was deleted.

95 changes: 67 additions & 28 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,42 +1,81 @@
i-PI V1.0
--------
====
i-PI: a Universal Force Engine
====

A Python interface for ab initio path integral molecular dynamics simulations.
i-PI is composed of a Python server (i-pi itself, that does not need to be
A Python interface for ab initio path integral molecular dynamics simulations.
i-PI is composed of a Python server (i-pi itself, that does not need to be
compiled but only requires a relatively recent version of Python and Numpy)
that propagates the (path integral) dynamics of the nuclei, and of an external
code that acts as client and computes the electronic energy and forces.
code that acts as a client and computes the electronic energy and forces.

This is typically a patched version of an electronic structure code, but a
simple self-contained Fortran driver that implements Lennard-Jones and
Silveira-Goldman potentials is included for test purposes.
This is typically a patched version of an electronic structure code, but a
simple self-contained Fortran driver that implements Lennard-Jones and
Silvera-Goldman potentials is included for test purposes.


Quick Installation and Test
---------------------------
Quick Setup and Test
====================

Follow these instruction to test i-PI. These assume to be run from a Linux
environment, with a recent version of Python, Numpy and gfortran, and that
the terminal is initially in the i-pi package directory (the directory
containing this file).
Follow these instructions to set up and test i-PI. It is assumed that i-PI will
be run from a Linux environment, with a recent version of Python, Numpy and
gfortran, and that the terminal is initially in the i-pi package directory (the
directory containing this file).

* Generate the driver code
Source the environment settings file :code:`env.sh` as :code:`$ source env.sh` or :code:`$ .
env.sh`. It is useful to put this in your :code:`.bashrc` or other settings file if
you always want to have i-PI available.

$ cd driver
$ make
$ cd ..

* Run one of the examples
Compile the driver code
-----------------------

This will first start the wrapper in the background, redirecting the output on
a log file, then run a couple of instances of the driver code and then follow
the progress of the wrapper by monitoring the log file
::

$ cd examples/tutorial/tutorial-1/
$ ../../../i-pi tutorial-1.xml > log &
$ ../../../drivers/driver.x -h localhost -p 31415 -m sg -o 15 &
$ ../../../drivers/driver.x -h localhost -p 31415 -m sg -o 15 &
$ tail -f log
$ cd drivers
$ make
$ cd ..

The monitoring can be interrupted with CTRL+C when the run has finished (5000 steps)

Run one of the examples
-----------------------

This will first start the wrapper in the background, redirecting the output to
a log file, and then run a couple of instances of the driver code. The progress
of the wrapper is followed by monitoring the log file with the `tail` Linux
command.

Optionally, you can make a copy of the directory with the example somewhere
else if you want to keep the i-PI directory clean.

::

$ cd examples/tutorial/tutorial-1/
$ i-pi tutorial-1.xml > log &
$ i-pi-driver -h localhost -p 31415 -m sg -o 15 &
$ i-pi-driver -h localhost -p 31415 -m sg -o 15 &
$ tail -f log

The monitoring can be interrupted with CTRL+C when the run has finished (5000 steps).


Run the automatic test suite
----------------------------

The automatic test suite can be run with the Python package `pytest` from the
root directory of the i-PI project.

::

$ pytest -v


PEP-8 Compliance
================

i-PI code should be compliant to a minimal subset of PEP-8 recommendations.
Before proceeding to a pull request, or to the merging of a large commit, you
can use the following script to automatically prettify the code

```
i-pi-pepper -p $IPI_ROOT
```
112 changes: 0 additions & 112 deletions TODO

This file was deleted.

105 changes: 105 additions & 0 deletions bin/i-pi
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#!/usr/bin/env python2

"""Main script from which the simulation is run.
Deals with creation of the simulation object, reading the input file and
initialising the system.
Run using:
i-pi input_file.xml
Where 'input_file.xml' should be replaced by the name of the xml input file
from which the system data will be read. For a description of how the input
file should be formatted, see the reference manual.
"""

# This file is part of i-PI.
# i-PI Copyright (C) 2014-2015 i-PI developers
# See the "licenses" directory for full license information.


import sys
import os

# Check that we have the import path for this i-PI set and if not, add it.
dir_root = os.path.realpath(
os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))
if not dir_root in sys.path:
sys.path.insert(0, dir_root)

from ipi.utils.softexit import softexit
from ipi.engine.simulation import Simulation


def main(fn_input, options):
"""Loads and runs the simulation stored in `fn_input`."""

# optionally profile this run - set up
# ~ if do_yappi:
# ~ try:
# ~ import yappi
#~ yappi.start(builtins=True, profile_threads=True)
# ~ except ImportError:
# ~ print 'Profiling with yappi was enabled but could not be imported.'
# ~ print "Profiling with yappi was enabled but could not be imported."
#~ sys.exit(1)

# construct simulation based on input file
simulation = Simulation.load_from_xml(fn_input, request_banner=True, custom_verbosity=options.verbosity)

# run the simulation
simulation.run()

# optionally profile this run - wrap up
# TODO
# We do not get to this if the run is ctrl interrupted and exits cleanly.
# Maybe the profiler should be global and cleaned up on exit?
if options.do_yappi:
yappi.stop()
yappi.get_thread_stats().print_all()
yfs = yappi.get_func_stats()
yfs.save("profile.kgrind", type="callgrind")
ypo = open("profile.yappi", "w")
yfs.print_all(out=ypo)
ypo.close()

# It seems that checkpoints are written by the following.
# TODO: Have them written when simulation.run() finishes instead.
# It should be sufficient to run `self.softexit() at the end of
# `Simulation.run()`. Anything else missing?
softexit.trigger(" @ SIMULATION: Exiting cleanly.")


if __name__ == '__main__':

# TODO: Use argparse once we move to Python 2.7.

from optparse import OptionParser

parser = OptionParser(usage='%prog [options] <input file>',
description='The main i-PI executable used to run '
'a simulation, given an XML input file.'
)

parser.add_option('-p', '--profile',
action='store_true', dest='do_yappi', default=False,
help='Profile this run using Yappi.')

parser.add_option('-V', '--verbosity', dest='verbosity', default=None,
choices=['quiet', 'low', 'medium', 'high', 'debug'],
help='Define the verbosity level.')

options, args = parser.parse_args()

# make sure that we have exactly one input file and it exists
if len(args) == 0:
parser.error('No input file name provided.')
elif len(args) > 1:
parser.error('Provide only one input file name.')
else:
fn_in = args[0]
if not os.path.exists(fn_in):
parser.error('Input file not found: {:s}'.format(fn_in))

# Everything is ready. Go!
main(args[0], options)
1 change: 1 addition & 0 deletions bin/i-pi-contract-trajectory
1 change: 1 addition & 0 deletions bin/i-pi-getacf
1 change: 1 addition & 0 deletions bin/i-pi-getproperty
1 change: 1 addition & 0 deletions bin/i-pi-gleacf
1 change: 1 addition & 0 deletions bin/i-pi-kinetic2tag
1 change: 1 addition & 0 deletions bin/i-pi-mergebeadspdb
1 change: 1 addition & 0 deletions bin/i-pi-mux-positions
1 change: 1 addition & 0 deletions bin/i-pi-paraweights
1 change: 1 addition & 0 deletions bin/i-pi-pepper
1 change: 1 addition & 0 deletions bin/i-pi-posforce2kinetic
1 change: 1 addition & 0 deletions bin/i-pi-regtest
1 change: 1 addition & 0 deletions bin/i-pi-remdsort
1 change: 1 addition & 0 deletions bin/i-pi-trimsim
Loading

0 comments on commit 94456a2

Please sign in to comment.