Giter VIP home page Giter VIP logo

molsturm's Introduction

molsturm

Build Status Licence

molsturm is a modular electronic structure theory program, which tries to employ concepts like lazy matrices and orthogonal programming to achieve a versatile structure. Our motto is flexibility first, but speed second, even though we are probably very far from either of the two still.

Note that this is a very young project. Things may change in incompatible ways at any time.

Dependencies

molsturm consists of a set of compiled C++ libraries as well as a python module, which the user may use to setup and drive the calculations.

For building molsturm the following things are required:

  • cmake >= 3.0.0

  • A compiler supporting C++11: clang starting from clang-3.5 and gcc starting from gcc-5 should work.

  • swig >= 2.0.11

  • python >= 3.4, including the development headers

  • The regular build process mentioned below will automatically build the lazyten linear algebra library as well. This requires further

    See github.com/lazyten/lazyten for more details about lazyten's dependencies.

  • If you want to use Gaussian integrals from libint you further need

    • Eigen3
    • Autoconf
    • GNU Multiprecision library

In order to actually use the molsturm-module once it has been built the following python packages are required:

On a recent Debian/Ubuntu you can install all the aforementioned dependencies by running

apt-get install cmake swig python3-dev libopenblas-dev liblapack-dev libarmadillo-dev \
                python3-h5py python3-yaml python3-numpy python3-scipy libeigen3-dev \
                autoconf libgmp-dev

as root.

Optional dependencies

The dependencies in this section are only needed for some extra functionality. molsturm will work without them, but the mentioned features will be unavailable.

  • pyscf for full-configuration interaction (FCI)

Building molsturm

The recommended build enables Edward Valeev's libint library as an integral backend for Gaussian-type basis functions and installs molsturm to $HOME/opt of the local user:

# Fully download molsturm repository and dependent submodules
git clone https://github.com/molsturm/molsturm molsturm
cd molsturm
git submodule update --init --recursive

# Configure inside build directory
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=~/opt -DAUTOCHECKOUT_MISSING_REPOS=ON -DGINT_ENABLE_LIBINT=ON ..
cmake --build .

# Test and install the build
ctest
cmake --build . --target install

Note, that this will automatically download and build libint as well as rapidcheck and Catch as well. The latter two libraries are only needed for testing molsturm and are not installed to $HOME/opt

Installing molsturm is still experimental and might not work properly in all cases. Please let us know about any problems. Every other feedback to improve the process is welcomed as well.

Configure options

In order to configure the build further there are a number of options, which can be passed to the first invocation of cmake in the instructions above. For example

  • -DCMAKE_INSTALL_PREFIX=<dir>: Choose a different installation directory for molsturm (if you remove the option entirely, the default is /usr/local)
  • -DENABLE_TESTS=OFF: Disable building the unit test executables
  • -DENABLE_EXAMPLES=OFF: Disable building the example executables
  • -DENABLE_DOCUMENTATION=ON: Build and install the sparse doxygen-generated in-source documentation.
  • -DGINT_ENABLE_LIBCINT=ON: Enable Gaussian integrals via the libcint library.
  • -DGINT_ENABLE_STURMINT=ON: Enable the Coulomb-Sturmian basis functions via sturmint (This library is not yet publicly available, but will be released soon.)

Using molsturm from python

Given that you followed the build procedure sketched above, you just need to make sure that your python interpreter finds molsturm in the installation directory. This is done by modifying the PYTHONPATH. For example if you chose the CMAKE_INSTALL_PREFIX of ~/opt as we shown above, you need to type

# Find out the major and minor version of your python interpreter:
VERSION=$(python3 -c 'import sys; print(str(sys.version_info.major) + "." + str(sys.version_info.minor))')
export PYTHONPATH="$PYTHONPATH:$HOME/opt/lib/python${VERSION}/site-packages"

to setup your environment for molsturm.

You might need to change python3 to python in the first line if your operating system uses python to refer to the binary of your python version 3 interpreter.

Running calculations

To get started with molsturm take a look at the examples subfolder. Good entry points are especially the single_point scripts.

In principle a calculation is a sequence of calls to python functions of the molsturm module. For example the snippet

import molsturm
hfres = molsturm.hartree_fock("Be", basis_type="gaussian",
                              basis_set_name="6-31g")
print("Be HF energy", hfres["energy_ground_state"])

just performs a Hartree-Fock calculation on a beryllium atom and prints the resulting SCF energy.

molsturm's People

Contributors

jamesavery avatar mfherbst avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

chrinide hti-3

molsturm's Issues

Allow for more fine-grained selecton of the SCF solver

Allow to influence the automatic scheme molsturm chooses to solve the SCF, i.e. the user should be able to

  • change criteria when solvers are switched
  • supply an arbitrary chain of solver algorithms and criteria to switch between them

Plotting of MOs and density

Use the functionality of gint to plot MOs on an arbitrary grid in order to achieve the following:

  • Export MOs and density to a VTK file
  • Use matplotlib to construct an easy to use interactive plotting session for MOs and density

Coverage analysis

It would be nice to have coverage analysis in molsturm, too. The hard part is, that we would ideally test both the C++ as well as the python code and produce a common coverage.

Download data for tests

The tests should not have binary data (i.e. hdf5 files) in the repository, but instead this data should be downloaded from some remote location to not blow up the repository size.

Some points to be achieved:

  • Add mechanisms to download data from servers (achieved in #36)
  • Upload remaining large data files
  • Enhance tests by a few larger cases

Refactor python state object

Right now the molsturm python state object is pretty much only a python dict, but it would be nice to link the state directly with an hdf5 file in a transparent way, such that large objects could be cached to disk and read later with ease and fully transparent to the user of molsturm.

Milestones:

  • Implement new parameter interface (see #23)
  • Replace state dict by state class
    • Lazy generation of ERI tensor and fock matrix as needed
    • Cache requested objects directly in file
    • Allow reading and writing such states to/from yaml
  • Make sure the tests still work and give the same results.
  • Prepare for state-driven workflow see #41.

Integrate molsturm into Spack

With lazyten being integrated into Spack, it would be nice to get molsturm there, too.

Once this has been achieved one could actually use Spack to setup the build environment to test molsturm on Travis. See the Spack documentation chapter about this for example. The proposed change is therefore:

  • In molsturm have submodules and a build system to build them together with molsturm
  • Each individual submodule (krims, lazyten, gint and gscf) can be build and installed, but only if all required dependencies are met.
  • This avoids the complicated and partially non-portable code to pull in the submodules as needed. If tests are desired or dependencies are needed, the setup can be achieved via Spack or needs to be done one-by-one manually.
  • This is ok in my humble opinion, since the full-fletched project molsturm still comes with cmake build scripts to build all the submodules in one go if this is required.

Ideas about some work packages:

  • Get all submodules into Spack:
    • gint
    • gscf
    • molsturm
    • tests for all of them (i.e. rapidcheck)
  • Replace setup in molsturm such that a git clone followed by a cmake takes care of all required dependencies. Use ExternalProject and git submodules as needed. Take a look at Hunter and check whether that could be useful.
  • Replace test system on Travis by a setup based on Spack. As we go along with doing this also (deprecate and) remove the unnecessary setup scripts and cmake modules.

Improve capabilities for interfacing molsturm

This issue should serve as a collection of ideas for the extension of data and input formats supported inside molsturm and the lists here will probably continue to grow. The formats mentioned here are used by some wide-spread quantum-chemistry programs or packages and it would be nice to implement conversion functions and interface modules/classes for allow an easy interaction with these programs.

Data formats

  • pyscf (most importantly the mo eri data)
  • Psi4
  • Gaussian Fchk
  • Molpro FCIDump
  • molden files

Input formats

  • Gaussian
  • Molpro
  • ORCA
  • Q-Chem
  • Psi4
  • TURBOMOLE (probably harder)

For this openbabel could be a useful resource. Look at how the people from the atomistic simulation environment (ASE) achieve this. Perhaps their efforts could be reused inside molsturm.

Better feature summary and overview

Integrate molsturm and the dependent packages with the
cmake mode FeatureSummary
in order to make it easier to manage and show the list of features
and which are enabled.
Probably it is a good idea to integrate this somehow into
krims/cmake/modules/ProjectFeatures.cmake.

This integration of FeatureSummary is especially important for

  • lazyten (backend libraries and solvers)
  • gint (integral libraries)
  • molsturm (e.g. python packages and 3rd party libraries)

Allow for tests to run if only catch is installed

Many tests, especially the ones driven by python will also work if rapidcheck is not installed.
It would therefore be good to make rapidcheck an opitonal requirement and still allow testing in case it is not available.

This applies especially to the following modules:

  • molsturm
  • gint
  • gscf

State-driven workflow

A rather good workflow for molsturm in my opinion would be based on "propagating"
states during each calculation step.
Roughly the interface I have in mind is:

# Get input parameters from yaml
file_dict = yaml.safe_load(file)
state = molsturm.State.from_dict(file_dict)
# or just set them
state = molsturm.State()
state.system = ...
state.basis = ...
# or first build parameter tree, then set them (maybe even omit this .. let's see)
params = molsturm.Parameters()
params.bla = ...
state.parameters = params

# Get guess from a few parameters
state1 = molsturm.scf.guess(system, basis, restricted=True, n_elec=)
# or from state containing previous solution and/or input parameters
state1 = molsturm.scf.guess(state)
# or a combination of both (where the explict parameters override)
state1 = molsturm.scf.guess(state, restricted=False)

# Run scf -> same interface
state2 = molsturm.scf.hartree_fock(state1)
state2 = molsturm.scf.self_consistent_field(state1, extra_overriding_params)

# Run posthf -> same interfaces
state3 = molsturm.mp.mp2(state2)
# or with parameters
state3 = molsturm.mp.mp2(state2, threshold=1e-6)

In this way

  • Input parameters may contain fci or post-hf parameters
  • All functions have the same interface (state plus optional, overriding parameters)
  • For SCF and guess methods the state may be omitted

Unify conventions for parameter names

I think we should think about a more unified convention for the parameters.
I propose for example:

  • n_max -> nmax (Since no number like for example n_diis_size)
  • Similarly l_max, m_max -> lmax, mmax
  • k_exp -> kexp

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.