diff --git a/src/libshowcase.cpp b/src/libshowcase.cpp new file mode 100644 index 0000000000000000000000000000000000000000..aa8c3dc7e877d0be0afc887d44d5cf239d88878d --- /dev/null +++ b/src/libshowcase.cpp @@ -0,0 +1,91 @@ +#include +#include +#include + +//include the MARQOV library +#include "libmarqov/libmarqov.h" + +//include the RegularLattice +#include "lattice/regular_hypercubic.h" + +#include "hamiltonian/Heisenberg.h" +#include "hamiltonian/Ising.h" +#include "hamiltonian/Phi4.h" + +using namespace std; +using namespace MARQOV; + +int pyising(std::string path, int len, double beta, double J) +{ + RegularHypercubic mylatt(len, 2); //2D len x len lattice + + //MARQOV::Config stores a set of Monte Carlo related parameters + MARQOV::Config mp(path); + mp.setnmetro(5); + mp.setncluster(8/2); + mp.setwarmupsteps(500); + mp.setgameloopsteps(3000); + + // A section for setting our Hamiltonian parameters, J, and the inverse temperature beta + auto hp = make_tuple(beta, J); + //Let's create some parameters, a temperature scan for the scheduler to work on. + //prepare the arguments + auto args = make_tuple(std::ref(mylatt), mp, hp); + + //execute core + auto mysim = makeCore >(args); + mysim.init(); + mysim.wrmploop(); + mysim.gameloop(); + return 0; +} + +int pyHeisenberg(std::string path, int len, double beta, double J) +{ + RegularHypercubic mylatt(len, 2); //2D len x len lattice +//MARQOV::Config stores a set of Monte Carlo related parameters + MARQOV::Config mp(path); + mp.setnmetro(5); + mp.setncluster(8/2); + mp.setwarmupsteps(500); + mp.setgameloopsteps(3000); + + // A section for setting our Hamiltonian parameters, J, and the inverse temperature beta + auto hp = make_tuple(beta, J); + //Let's create some parameters, a temperature scan for the scheduler to work on. + //prepare the arguments + auto args = make_tuple(std::ref(mylatt), mp, hp); + + //execute core + auto mysim = makeCore >(args); + mysim.init(); + mysim.wrmploop(); + mysim.gameloop(); + return 0; +} + +int pyPhi4(std::string path, int len, double beta, double lambda, double mass) +{ + RegularHypercubic mylatt(len, 2); //2D len x len lattice + + //MARQOV::Config stores a set of Monte Carlo related parameters + MARQOV::Config mp(path); + mp.setnmetro(5); + mp.setncluster(8/2); + mp.setwarmupsteps(500); + mp.setgameloopsteps(3000); + + // A section for setting our Hamiltonian parameters, J, and the inverse temperature beta + auto hp = make_tuple(beta, beta, lambda, mass); + //Let's create some parameters, a temperature scan for the scheduler to work on. + //prepare the arguments + auto args = make_tuple(std::ref(mylatt), mp, hp); + + //execute core + auto mysim = makeCore >(args); + mysim.init(); + mysim.wrmploop(); + mysim.gameloop(); + return 0; +} +//} diff --git a/src/libshowcase.h b/src/libshowcase.h new file mode 100644 index 0000000000000000000000000000000000000000..2c01acb9205acdfbc02f1bd982b658e6dde20d65 --- /dev/null +++ b/src/libshowcase.h @@ -0,0 +1,4 @@ +#include +int pyising(std::string path, int len, double beta, double J); +int pyHeisenberg(std::string path, int len, double beta, double J); +int pyPhi4(std::string, int len, double beta, double lambda, double mass); diff --git a/src/libshowcase.i b/src/libshowcase.i new file mode 100644 index 0000000000000000000000000000000000000000..6273ef9fc4e8f852509051c655fc2759c516606d --- /dev/null +++ b/src/libshowcase.i @@ -0,0 +1,11 @@ +%module showcase +/*SWIG has a library for doing the string mappings.*/ +%include "std_string.i" +%{ + +/* Includes the header in the wrapper code */ +#include "libshowcase.h" +%} + +/* Parse the header file to generate wrappers */ +%include "libshowcase.h" \ No newline at end of file