Category Archives: scripts

ll4D: the LXD(LXC)-LAMP environment For Development

There are plenty of tools for development, but I really wanted to take advantage of LXD for web development, so I ended up writing ll4d: the LXD(LXC)-LAMP environment For Development environment.

There are probably better ways to do this, and highly optimized juju charms to build something much better. But for my persona use case, this script is just perfect. It takes just 48 seconds to build everything and it has 100% all the functionality I need.

It is a very simple script, which works as follows:

  • Sets up a basic LXC/LXD environment
  • Creates a container with a LAMP (Linux Apache MySQL PHP) server
  • Creates a fancy symbolic link from the apache root directory at the LAMP container to somewhere in your home or desktop. This allows you to work on your code using your visual tools and view the result on the fly
  • Create a simple website to test Apache, PHP and MySQL

Here is an screenshot of a working environment. You work from a directory directly under your home, access the LAMP server for working with configurations and MySQL databases and access the server on at the given IP.

Screenshot of a work environment with ll4d.

Screenshot of a work environment with ll4d.

ll4d is available on my github repository: https://github.com/julenl/ll4d

The few instructions on how to download and exectute it, can be found at the README file.

I hope you find it useful… if you don’t, you can remove it completely in 3 simple steps:

./ll4d.sh –clean
rm -rf ll4d*
sudo aptitude purge lxd

 

Troubleshooting OpenStack the cool way: ini_comparer.py

If OpenStack is already complex enough, troubleshooting OpenStack issues can be a nightmare! If you agree, you might be interested on the ini_comparer script.

The source of most of the issues with OpenStack is usually on the configuration files, which have the “ini” format. This format is not particularly easy to handle by old school “sed” people like me and in addition, the standard configuration files are meant to be self-documented, which means tons of lines of comments and commented options.

Putting this together, we get huge configuration files, with very similar lines and it is a pain in the lower back to check word by word, character by character every single keyword in the file.

So, provided that we have another configuration file that works fine, we can use the ini_comparer python script to do that for us. It can work with a combination of local or remote files. For example, a file on the local machine and another one in a remote one, both files are in the local machine, or both are in remote machines. Continue reading

Logo of BOMSI

The easiest way to install OpenStack: BOMSI GUI

Installing OpenStack is quite difficult, specially for the people who is not really into basically most of IT topics. In my attempt to get started, and after searching for the easiest way to install OpenStack, I ended up writing my own automated tasks in BASH, and at some point I decided to generalice those scripts a little bit more and release them to the community.

I named the installer as BOMSI: the Bash OpenStack Multinode Scripted Installer. Descriptive and catchy, isn’t it? 🙂

BOMSI follows the official install guide at OpenStack Docs for CentOS7, and it does it in plain BASH, so it is easy to understand whatever is going on during the installation, and easily improve it. It’s GPL v2 license, so you are all very welcome to contribute on GitHub repository.

The command line API is very simple and it allows to install OpenStack on a virtual environment with just 3 commans:


git clone https://github.com/julenl/BOMSI.git
cd BOMSI/CentOS7-Kilo/
for NODE in controller compute1 network; do ./bomsi-iso.sh -n=$NODE; done

… and that’s it. In some 15 minutes a horizon dashboard will be waiting for you at http://10.0.0.11/dashboard.

For generating the 3 node virtual environment it is recommended that have 8 or 16 Gb of RAM, a i5 or i7 processor (or equivalent) and some 20 Gb of free space on the hard disk, to host the KVM virtual machines. Ideally the computer should be running Ubuntu, but it should work somehow in other GNU/Linux distributions.

Furthermore, being aware that some people prefer graphical user interfaces (GUIs) to work on the configuration files and execute the options, I also added a very simple GUI.

This GUI can be run the same as the API, but with even less letters on the command line:

git clone https://github.com/julenl/BOMSI.git
cd BOMSI/CentOS7-Kilo/
./bomsi_gui.py

And you’ll get this:

Graphical User Interface for installing OpenStack with BOMSI

If you are OK with the default options, just click on the “Local KVM” square button and wait for some 15 minutes. That’s it.

Additional features of BOMSI:

  • Generate a fully automated multiboot ISO file, which can be burned onto a CD or provisioned via PXE
  • Install this ISO file into a pen-drive
  • Install a temporal CentOS machine with kickstart. This machine can be used to download all necessary packages to allow full offline installations

So… 3 commands, or 3 commands and a click, isn’t this the easiest way to install OpenStack at the moment?

now for HLRN III

This is a new version of my now python script for monitoring the HLRN III.
I am usually on the Hannover partition, but it should work perfectly in Berlin too.

In this version, I keep all the features of the cluster version except the “gossip” section for checking on who is calculating what and how many resources are they using, since a supercomputer has too many users and we would need a terminal of a couple of square meters.

Screenshot of now HLRN III

now version 0.5 specially modified for working on HLRN III supercomputer in Hannover and Berlin.

Continue reading

IR and Raman spectra calculated with Quantum Espresso

Infrared (IR) and Raman spectra are two very valuable tools for the characterization of chemical compounds. And although there seem to be many different possibilities to produce them computationally, I didn’t find any clear tutorial on how to produce them using free software tools. Some of them, give complicated instructions on how to calculate second derivatives or Raman tensors, or stuff like that, but in the end one wonders: Where are the numbers I have to plot!

…Thereby, here is my post about computing IR and Raman spectra with Quantum Espresso.

For the impatient: most of this post is resumed in my Quantum Espresso example for the PHonon code, which will run for some 15-17 minutes and pop-up the IR/Raman spectra of CO2 and ZnO (Wurtzite).

Continue reading

cube2xyz: convert cube data to xyz and slize segments/planes

In this post, I introduce my new cube2xyz script for converting cube data into “x,y,z,value” format and optionally creating nice 2D or 3D plots displaying the value of the cube property along a segment or a surface.

.cube files are originally from the Gaussian molecular modeling code, but nowadays can be produced and read by most of the computational chemistry programs. They consist of a lot of blocks of data describing the values of a measured property (charge, spin polarization, electronic density, …) on each point of the space inside the simulation cell.

Continue reading

My code hosted on GitHub

I have been putting my scripts in a directory on my own server, and it is starting to get a little bit messy. Therefore, I have created 2 repositories on GitHub in order to keep explanations and code separated and develop new versions in a more structured way.
The address to my GitHub repositories is https://github.com/julenl.
From now on, I will upload most of the scripts I already introduced here and add the new ones (or new versions of the existing ones) directly there, and use the website only for giving a description and a usage explanation of them.

shrink_traj v0.4: xyz with unit cell info

One of the limitations of xyz coordinate format is generally the lack of extra information, such as the unit cell dimensions or lattice vectors. This can become annoying when we are working with solids, or we want to check whether our molecule has enough space around, in order avoid interaction with its own periodic replicas.
The new shrink_traj v0.4, includes the possibility to include the Jmol readable unit cell info the second line of the xyz file. This way, we can shrink a trajectory (or keep it as it is), and generate a new one which allows us to visualize the unit cell.

It also contains an option to insert Jmol commands directly into the xyz file, such as “background white”, which enables the possibility to customize the view of the structure/trajectory. Continue reading

agr2gpt: convert xmgrace to gnuplot or mathplotlib

Some people seem to think that xmgrace is somehow cool, maybe because it contains an “x” on its name. Y personally prefer gnuplot or mathplotlib, but I got recently some “.agr” files I had to edit, and I finally decided to write a python script called agr2gpt, which makes a simple conversion from xmgrace files to gnuplot script, and extracts the data to different files (one per curve).

This is just the first version, so it just handles basic 2D graphs with several curves.
Besides the x and y data for each curve (unlimited amount of curves), it also parses the “xlabel” the “ylabel” and the legend of each curve.

As in most of my scripts, the “-h” option will provide some extra information about the usage, but in this first version, there are only two options: “-f” for the file name, and “-pl” if you want the pylab window to pop up with the image. Continue reading

Checking the optimum cutoff for QE

Rise your hand if you have ever gotten a pseudo-potential from somewhere and you started to use it just by checking the recommended values of the cutoffs inside the file.

Are we sure these values are good?
If you are an skeptic scientist and you do not thrust what you don’t do by yourself, now there is a really simple and cheap way for you to test for the optimum cutoff of any pseudopotential with Quantum Espresso: my pw_cutoff checking script.

The ecutwfc is described in the manual as the kinetic energy cutoff for wave functions in Ry. Continue reading