Python script to calculate the Madelung constant of an infinite lattice

During my Diploma thesis in Physics I had to calculate the Madelung constant for a lattice of ZnO supercells. For this purpose, I implemented a small Python programm. The only prerequisite is SciPy. The script calculates the Madelung constant for an infinite lattice of point charges, neuralized by a counter-charged jellium background. All documentation is inside the file There’s another script (supercell madelung constant) in there which demonstrates reading a POSCAR file describing an atomic lattice and calculating the Madelung constant for it.

Maybe someone can so something useful with the stuff. I would be happy about feedback whether the implementation actually works for your specific case 🙂

2 commenti su “Python script to calculate the Madelung constant of an infinite lattice

  1. Eva sagt:

    I have downloaded your script and am interested to try it out. Could you please include a sample input? It’s not clear to me what „offset in relative coordinates“ is, and how to use the program.

    e.g. the input
    >python madelung([1 0 0; 0 1 0; 0 0 1],[0.1 0.1 0.1],10,’None‘,’True‘) < NaCl_POSCAR
    returns an error.


  2. admin sagt:

    Hi Eva,

    I cannot make sense of the line of code you posted. How did you call it? Via the shell interface?
    Simply run
    python –help

    to get a list of command line arguments. 🙂

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.