/ProgrammingProjects

Chemistry-based projects for learning to program (in Rust)

Primary LanguageShell

Programming Tutorial in Chemistry

This is a fork of the Crawford Programming Projects that seeks to place more emphasis on learning to program in general. In contrast to the originals, which are written in C++, this version also uses the Rust programming language. The original projects are a great resource, but some of the instructions can be a bit vague, and C++ itself is not the easiest language to begin with. As such, this version will give fuller instructions for the chemistry problems as well as embed more language information directly in the tutorial. One of the difficulties of learning to program is that the best way to learn is by working on a concrete project. The goal of this tutorial then is to offer a substantial, quantum chemistry-flavored project to help people learn to program in general and to learn Rust in particular.

Getting Started

This repository is organized into several projects, each with its own directory. In each one you will find a README.md file like this one with instructions and output for you to check your implementation against. These projects will also require some input files that will be discussed in each project as they become relevant. These input files can be found in the input subdirectory of each project. Within input there are directories for several different molecule/basis-set combinations where you will find integrals, molecular geometries and other files to use as input to your programs. There is also a tarball of the inputs and outputs in each project directory to make it more convenient to download all of the files you need. At least this is the case in the Projects I have at least started working on. If you don't see a .tar file and you want the updated Rust version of the project, you probably need to wait. Downloading and extracting these is covered in Project 1. Before Project 1 is Project 0, which will help you get set up to write and run Rust programs. If you already know how to do that, skip ahead to Project 1.

Typographical Conventions

Following the conventions of many other programming tutorials, code snippets will be written in monospace font, while new keywords will be presented in bold. Part of being a good programmer is knowing how to look for help on the internet and in documentation, so these will try to help you know what terms to search for. There will also be a Table of Contents below the Summary of each project providing quick links to the important concepts introduced in that project to make it easier to refer to them later. Commands that should be typed at the command line are prefaced with a $, such as $ pwd.

Code snippets are divided into two types: Tutorial and Solution. As you might guess, the Tutorial blocks include full explanations of the code and build up to the final solutions, introducing new concepts as needed. In contrast, the Solution blocks only include the code required to get the desired output. If you are learning Rust for the first time, you will obviously want to read the Tutorials, but programming experts (hopefully including the future selves of current beginners!) may want to refer directly to the Solutions. New concepts are primarily introduced in the early projects, so that is where most of the Tutorials are found. Similarly, the original versions of these projects did not provide full solutions to later projects. In an effort to keep these projects usable as class assignments, I have also limited the full solutions to those in the original version.

The available solutions may not be the shortest or most efficient. I usually like playing code golf , but for the sake of teaching I have sought to write in a more verbose style, including defining some (strictly) unnecessary intermediate variables . If you know how to do something faster, please feel free to do it that way. If an instructor one day chooses to use this version of the projects and tries to grade your code based on similarity to mine instead of on the correctness of the output, please show them this sentence telling them not to.

Quantum Chemistry Programming Projects

  • Project #0: Setting up your programming environment

Possible Future Projects

  • Loading basis sets and computing integrals