int main(int argc, char* argv[]){
	int N = 16;//Teilchenzahl
    double L = 1.0;//Seitenlänge des Systems
    double h = 0.01;//Schrittweite
	double Temp = 1.0;//Anfangstemperatur
    double rx[N];//x-Koordinate des Ortes
    double ry[N];//y-Koordinate des Ortes
    double vx[N];//x-Koordinate der Geschwindigkeit
    double vy[N];//y-Koordinate der Geschwindigkeit
    initialize(rx, ry, vx, vy, N, L, Temp);
    std::cout << "x\ty\tv_x\t\tv_y" << std::endl;
    for(int i = 0; i < 16; ++i){
    	std::cout << rx[i] << "\t" << ry[i] << "\t" << vx[i] << "\t" << vy[i] << std::endl;
	}
    //Test der Lennard-Jones-Funktion
    std::cout << "Lennard-Jones-Potential: " << Lennard_Jones(1.0, 3.0, 2.0, 4.0) << std::endl;
    //Test der Schwerpunktsfunktion
    std::cout << "Schwerpunktsgeschwindigkeit x: " << Schwerpunkt(vx, vy, N)[0] << std::endl;
    std::cout << "Schwerpunktsgeschwindigkeit y: " << Schwerpunkt(vx, vy, N)[1] << std::endl;
    //Test der potentiellen Energiefunktion
    std::cout << "Potentielle Energie: " << Pot(rx, ry, N) << std::endl;
    //Test der kintetischen Energiefunktion
    std::cout << "Kinetische Energie: " << Kin(vx, vy, N) << std::endl;
    //Test der Temperaturfunktion
    std::cout << "Temperatur: " << Temperatur(vx, vy, N) << std::endl;
    //Test der Kraftfunktion
    double Kraftx = 0.0;
    double Krafty = 0.0;
    int Teilchen = 13;
    for(int i = 0; i < N; ++i){
        if(i != Teilchen) Kraftx += Kraft(rx[Teilchen], ry[Teilchen], rx[i], ry[i])[0];
        if(i != Teilchen) Krafty += Kraft(rx[Teilchen], ry[Teilchen], rx[i], ry[i])[1];
    }
    std::cout << "Kraft x: " << Kraftx << std::endl;
    std::cout << "Kraft y: " << Krafty << std::endl;
    //Test der Gesamtkraftfunktion
    /*double Gesamtkraftx = 0.0;
    double Gesamtkrafty = 0.0;
    int Teilchen = 0;
    for(int i = 0; i < N; ++i){
        if(i != Teilchen) Gesamtkraftx += Gesamtkraft(rx[Teilchen], ry[Teilchen], rx[i], ry[i])[0];
        if(i != Teilchen) Gesamtkrafty += Kraft(rx[Teilchen], ry[Teilchen], rx[i], ry[i])[1];
    }*/
    std::cout << "Gesamtkraft x: " << Gesamtkraft(rx[Teilchen], ry[Teilchen], rx, ry, L, N)[0] << std::endl;
    std::cout << "Gesamtkraft y: " << Gesamtkraft(rx[Teilchen], ry[Teilchen], rx, ry, L, N)[1] << std::endl;
    //Test des Verlet-Algorithmus
    //std::cout << "Verlet x: " << Verlet(rx, ry, vx, vy, h, L, N)[6] << std::endl;
    std::cout << "Verlet x" << std::endl;
    for(int i = 0; i < 16; ++i){
        std::cout << Verlet(rx, ry, vx, vy, h, L, N)[i] << std::endl;
    }

    return 0;
}
Beispiel #2
0
// Wrapper for Bob's potential class.
// This function returns a potential class with
// all the appropriate initializations.
// >> type indicates form factor used for nonlocal potentials:
//      * 1 is the form of Perey and Buck (average)
//      * 0 is the form of D. Van Neck
// >> mvolume is used in the form for the energy dependence
//    of the imaginary volume potential.
// >> AsyVolume is used to specify whether the imaginary volume
// >> potential will have an asymmetry dependence (1 == yes, 0 == no)
// >> tz is the isospin of projectile (-0.5 for neutrons, 0.5 for protons)
// >> Nu holds information about the target (Fermi energy, A, Z, etc.)
// >> p is a struct holding all the parameters
pot get_bobs_pot( int type, int mvolume, int AsyVolume, double tz,
                  const NuclearParameters &Nu, const Parameters &p ) {

    double Zp;
    if ( tz > 0 ) Zp = 1;
    else Zp = 0;

    pot Pot( type );
    Pot.init( Nu.Z, Zp, Nu.A, Nu.readCoulomb );
    Pot.load( p.Rc, p.VHFvol, p.VHFsur, p.RHF, p.aHF,  p.RHFs, p.aHFs, p.beta_nl_R0, p.AHF,
              p.beta_nl_R1, p.RsurfaceAbove,p.RsurfaceBelow, p.asurfaceAbove,p.asurfaceBelow,
              p.AsurfaceAbove, p.AsurfaceBelow, p.BsurfaceA, p.CsurfaceA, p.DsurfaceA, p.Bsurface, p.Csurface, p.Dsurface,
              Nu.Wgap * p.fGap_A , Nu.Wgap * p.fGap_B , Nu.Ef, p.beta_nl_I0,
              p.beta_nl_I1,  p.beta_nl_I0_sur,  p.beta_nl_I1_sur,
              p.RvolumeAbove,p.RvolumeBelow, p.deltaRvolume, p.expRvolume, p.avolumeAbove,p.avolumeBelow,
              p.AvolumeAbove, p.AvolumeBelow, p.BvolumeAbove,p.BvolumeBelow,
              p.EpvolumeAbove,p.EpvolumeBelow, mvolume,
              AsyVolume, p.alphaVolume, p.EaVolume_a , p.EaVolume_b, p.Rso,
              p.aso, p.Vso, p.AWso, p.BWso, p.V_wine, p.R_wine, p.rho_wine );


    return Pot;
}
Beispiel #3
0
int main(int argc, char*argv[]){
	// GalPot Pot("../../Torus/pot/PJM11.Tpot");
	Logarithmic Pot(220.,1.,0.9);

	if(argc<8){
		std::cerr<<"Need to pass phase-space point and filename\n";
		return 0;
	}
	VecDoub X(6,0.);
	for(unsigned i=0;i<6;++i)
		X[i]=atof(argv[i+1]);
	Orbit O(&Pot);
	// Fudge
	Actions_AxisymmetricStackel_Fudge AA(&Pot,-30.);

	// Iterative Torus
	// IterativeTorusMachine Tor(&AA,&Pot,1e-8,5,1e-3);

	// Generating Function
	Actions_Genfunc AG(&Pot,"axisymmetric");

	// Average generating Function
	Actions_Genfunc_Average AGav(&Pot,"axisymmetric");

	// uvorb
	uv_orb UV(&Pot,1.,20.,10,10,"example.delta_uv");

	// Polar Adiabatic
	Actions_PolarAdiabaticApproximation PAA(&Pot,"example.paa",true,false);

	// Spheroidal Adiabatic
	Actions_SpheroidalAdiabaticApproximation SAA(&Pot,"example.saa",true,false,-30.);

	// Spheroidal Adiabatic
	Actions_StackelFit SF(&Pot);

	double tt = 10.;
	if(argc>8) tt=atof(argv[8]);
	O.integrate(X,tt*Pot.torb(X),0.01*Pot.torb(X));
	// O.plot(0,2);

	std::ofstream outfile;
	outfile.open(argv[7]);
	outfile<<"# Fudge Genfunc GenfuncAv uvOrb PAA SAA FIT\n";

	int guess_alpha=1;
	VecDoub Fudge, ITorus, Genfunc, GenfuncAv, uvAct, paaAct, saaAct, fitAct;
	for(auto i:O.results()){
		Fudge = AA.actions(i,&guess_alpha);
		// ITorus = Tor.actions(i);
		Genfunc = AG.actions(i);
		GenfuncAv = AGav.actions(i);
		uvAct = UV.actions(i);
		paaAct = PAA.actions(i);
		saaAct = SAA.actions(i,&guess_alpha);
		fitAct = SF.actions(i);
		outfile
				<<Fudge[0]<<" "<<Fudge[2]<<" "
				// <<ITorus[0]<<" "<<ITorus[2]<<" "
				<<Genfunc[0]<<" "<<Genfunc[2]<<" "
				<<GenfuncAv[0]<<" "<<GenfuncAv[2]<<" "
				<<uvAct[0]<<" "<<uvAct[2]<<" "
				<<paaAct[0]<<" "<<paaAct[2]<<" "
				<<saaAct[0]<<" "<<saaAct[2]<<" "
				<<fitAct[0]<<" "<<fitAct[2]<<" ";
		for(auto j:i) outfile<<j<<" ";
		outfile <<std::endl;
	}
	outfile.close();
}
Beispiel #4
0
#include <Adafruit_IS31FL3731.h>
#include <Arduino.h>
#include <Reference.h>
#include <Pot.h>


Adafruit_IS31FL3731 ledmatrix74 = Adafruit_IS31FL3731();
Adafruit_IS31FL3731 ledmatrix75 = Adafruit_IS31FL3731();

Reference reference = Reference();

Pot pot = Pot(reference.aPin74, &ledmatrix74, false, 3);
Pot pot1 = Pot(reference.aPin75, &ledmatrix75, false, 3);

bool turn75 = false;
bool turn74 = false;

uint8_t startpos = 5;

void setup(){
  Serial.begin(9600);
  //Serial.println("Enter setup");
  Serial.println("On/Off");

  if(!ledmatrix74.begin(reference.address74) || !ledmatrix75.begin(reference.address75)){
    Serial.println("Error! Display not found!");
    while(1);
  }
  Serial.println("Display found");
  ledmatrix74.setRotation(0);
}