From a17e005aa906d6c1961c8cc36acd21397d2bec5b Mon Sep 17 00:00:00 2001 From: Rainer Wittmaack Date: Fri, 2 Oct 2009 10:56:55 +0200 Subject: [PATCH] * dimer.py -- plots a default dimer * fixed calculation of the deflection angle * enhanced the deflection angle plot * minor tweaks to plot fonts --- bifandvel.py | 6 +-- calculator.cpp | 23 ++++++-- defangle.py | 22 +++++--- dimer.py | 164 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ pinv.py | 14 +++-- 5 files changed, 209 insertions(+), 20 deletions(-) create mode 100644 dimer.py diff --git a/bifandvel.py b/bifandvel.py index 2dd1bac..ca5547b 100644 --- a/bifandvel.py +++ b/bifandvel.py @@ -7,8 +7,8 @@ import matplotlib.mlab as mlab import matplotlib.axes as axe import matplotlib.text as txt -DATAX = '../rk_bifurcate.dat' -DATAV = '../rk_bif_avg_velo.dat' +DATAX = '/home/raw/rk_bifurcate.dat' +DATAV = '/home/raw/rk_bif_avg_velo.dat' FOUT = '../test.png' # some macros @@ -20,7 +20,7 @@ xpad = 0.002 ypad = 0.1 max = 0.875 tsize = 24 -ticksize = 14 +ticksize = 16 # default values xtks1 = [] diff --git a/calculator.cpp b/calculator.cpp index 80dc412..d8a1e1e 100644 --- a/calculator.cpp +++ b/calculator.cpp @@ -523,8 +523,11 @@ void Calculator::bifparam(const int &v, const QString ¶m, const Doub &r, params[7] = params[3]*params[11]*params[5]; // l1; params[8] = params[3]*params[11]*params[6]; // l2; } - else if (param == "t") + else if (param == "t") { params[10] = fmod(r,360)*PI/180; + params[15] = cos(params[10])*params[2]; + params[16] = sin(params[10])*params[2]; + } else throw("Fatal error!"); break; @@ -587,7 +590,7 @@ void Calculator::calc2(const Int n) qDebug() << "System" << v; Doub x, hnew; - Doub trajectory_length, deflection; + Doub trajectory_length, deflection, velocity_angle, bias_angle; Int k; Doub xpi[samples][s]; @@ -815,13 +818,23 @@ void Calculator::calc2(const Int n) case 4: m_x = yout[0]/L; m_y = yout[1]/L; m_phi = yout[2]/L; // makes only sense with r = params[10] - trajectory_length = sqrt(SQR(abs(yout[0]-x0))+SQR(abs(yout[1]-y0))); - deflection = ABS(fmod(acos(abs(yout[0]-x0)/trajectory_length)-params[10],(2*PI))); + trajectory_length = sqrt(SQR(yout[0]-x0)+SQR(yout[1])-y0); + if (abs(yout[0]-x0) > trajectory_length) { + velocity_angle = PI; + } else { + velocity_angle = (acos((yout[0]-x0)/trajectory_length)); + } + bias_angle = params[10]; + deflection = (180/PI)*ABS(velocity_angle - bias_angle); + qDebug() << velocity_angle << "("<