Calculating the hydrogen bond occupancy is a frequent task in the analysis of molecular dynamics simulations. Therefore, it has been implemented in packages like VMD hbonds or MDAnalysis.analysis.hbonds. However, these implementations do not fully treat periodic boundary conditions, as hydrogen bonds crossing the simulation box boundary are not incorporated into […]
python
Research is a widely understood as a collaborative effort. This graphic illustrates how researchers from all over the world work together towards a single objective: better understanding of nature. I selected a small community that is working on surface physics of hematite, a mineral that is particularly useful as cost-effective […]
Many journals require you to submit figures associated with a article manuscript in a way that does not allow for a separate graphics subdirectory. However, many people work with LaTeX such that they have a separate directory which is only for graphics generation and then include the resulting PDF files […]
When transferring pen-and-paper calculations into computer code, issues related to floating point precision tend to arise. For my preferred rapid prototyping language, python, this is the case as well. Of course, you can work with the decimal module, but this does not help you out in each and every case. […]
Sometimes, the list of entries on a single page gets very long. For quick navigation, you may either add a table of contents or collapse all content. In order to do so, add the following line to your layout.html template: {% set script_files = script_files + [pathto("_static/collapse.js", 1)] %} Now […]
Have you ever tried to spot a certain message in screens full of debugging output? Normally, you have a hard time scanning the text in order to find the output section you were looking for. Why not making the life easier for yourself (and your users) and start printing messages […]
If you’re not using autodoc, building a list of all your documented classes is not that straightforward. Unfortunately, sphinx does not offer any method to embed this list into your documentation. Below, you find a snippet that creates a sorted list of all classes. Here is what the result looks […]
Although usually it is helpful to define longer but explaining command line parameters, it will be tedious for users who work with this application very often to type out each and every parameter. Here is an example how to solve the problem for the python argparse module and choice options. […]
When using the todo extension of sphinx, I get lines like Todo: configureable random number generator (The original entry is located in /home/ferchault/svndir/colago/lib/colago.rst, line 322.) As the path itself may vary from machine to machine, the absolute path is rather pointless in this setup. Unfortunately, the extension itself has no […]
Sometimes you have some colors and need different ones based on distinguishability. No, I’m not talking about matching colors, just different ones. Here is an example: You have: and You want four additional colors ./colordist.py 4 ff0000 00ff00 You get: , , and You want four […]
Sometimes it is useful to calculate the area covered by ink for a given document e.g. when estimating the total printing costs. I played around with standard tools and to my knowledge the following way is the easiest yet simplest assuming that you are working on a linux machine. First […]
In case you have imagemagick installed, you may see a strange behavior: executing a python script overwrites your data without notice. This effect is due to the command line application import of imagemagick. When you pipe data to a python script the first command of which is import foobar you […]