switched executable flag in cluster_expansion.cpp
[cluster_expansion.git] / cluster_expansion.cpp
bloba117a99f3cc4625bd5961373b2d15edfffa56891
1 /*
2 * Determination of lateral interaction parameters on a c(2x2) square lattice
3 * using linear combinations to express each interaction and then counting
4 * them in terms of cluster-expansion coefficients
6 * Michael Rieger, FHI, 2008
7 * rieger@fhi-berlin.mpg.de
9 */
11 #include <iostream>
13 // some legacy stuff (to be removed)
14 #include <stdio.h>
15 #include <stdarg.h>
17 #include "Lattice.h"
18 #include "LatticeParser.h"
20 #include "Interactions.h"
21 #include "InteractionsParser.h"
23 #include "Symmetry.h"
24 #include "SymmetryParser.h"
27 void usage(const char *prog)
29 cerr << "usage: " << prog
30 << " structure-ini-file interactions-ini-file"
31 << endl;
33 exit(EXIT_FAILURE);
37 void panic(char *msg, ...)
39 va_list vargs;
41 va_start(vargs, msg);
42 fprintf(stderr, "FATAL: ");
43 vfprintf(stderr, msg, vargs);
44 fprintf(stderr, "\n");
45 exit(EXIT_FAILURE);
49 int main(int argc, char* argv[])
51 if (argc != 3)
52 usage(*argv);
54 try {
55 LatticeParser latticeParser(argv[1]);
56 Lattice lattice = latticeParser.getLattice();
58 cout << "lattice:" << endl << lattice.adsorbates;
59 cout << "underlying surface:" << endl << lattice.surface;
61 InteractionsParser interactionsParser(argv[2]);
62 Interactions interactions = interactionsParser.getInteractions();
64 cout << "interactions:" << endl;
65 Interactions::iterator interaction = interactions.begin();
66 Interactions::iterator last_interaction = interactions.end();
67 while (interaction != last_interaction) {
68 cout << "interaction " << interaction->name << ": ";
69 Directions::iterator direction = interaction->directions.begin();
70 Directions::iterator last_direction = interaction->directions.end();
71 while (direction != last_direction) {
72 cout << "(" << direction->x << "/"
73 << direction->y << "), ";
74 direction++;
76 interaction++;
77 cout << endl;
84 catch (exception& e) {
85 cerr << "FATAL: " << e.what() << endl;
86 exit(EXIT_FAILURE);
89 exit(EXIT_SUCCESS);