#include //The C++ Standard in and out Header used for printing to the screen for example. C has it's own because the names are different like cout << "bla"; and printf("bla"); for printing to the screen.
#include //Header for working with strings(lists/arrays or characters)
#include //Standard library header nescessary for very commonly used functions
#include //Header for using time functions such as get time: time(NULL) etc...
#include //The C standard in and out header.
#include //Used for file writing and reading
//#include //This is only nescessary because I'm using the avi movie writing stuff
//#include
//#include
//#include
#include "C:/users/jstambaugh/Libraries&Headers/random/randomc.h" //The following files are used for the random numbers generator
#include "C:/users/jstambaugh/Libraries&Headers/random/userintf.cpp" //Including this one.
#include "C:/users/jstambaugh/Libraries&Headers/random/mersenne.cpp" //Including this one.
#define RANDOM_GENERATOR TRandomMersenne //This definition is also for the random numbers generator
#include "C:/users/jstambaugh/Libraries&Headers/random/stocc.h" //Including this one.
#include "C:/users/jstambaugh/Libraries&Headers/random/stoc1.cpp" //Including this one.
#include //Used for math functions like sin(theta);
#define PI 3.141592653589793238462643383279
#define RealQ -10
#define RealPx 337
#define RealPy -1669
#define RealPz 198
#define RealQxx -18272.41
#define RealQxy 17583.22
#define RealQxz 3406.63
#define RealQyz 9436.77
#define RealQyy 10632.98
#define RealOxyz 191119.33
#define RealOxxx 698026.99
#define RealOxxz -155297.6
#define RealOxxy -128246.61
#define RealOxyy -178980.52
#define RealOxzz -246513.01
#define RealOyyy -44542.59
#define RealOyyz 76080.14
#define RealOyzz -161539.49
#define RealOzzz -15583.50
#define qSD 300
#define xDimension 60
#define yDimension 30
#define zDimension 30
#define Qimportance 10
#define Pximportance 1
#define Qxximportance 1
#define Oxxximportance 1
#define kT .01
#define fRandomNumber_ZeroToOne rg.Random() //Put the macro fRandomNumber_ZeroToOne anywhere you need a random number. rand() returns a random number up to a large number and RAND_MAX is the max random number rand() will return, so by dividing by RAND_MAX, you will always get a random number between 1 and 0.
#define debugWholeProgram 1 //Used to enable debug mode by using if else / #if #elif (???) statements within the program but is not implemented much if at all in the program.
using namespace std; //Allows us to use functions without specifying that they are within the standard namespace like cout... instead of std::cout<< "blabla";
unsigned long numberOfLoops = 4294967295; //The number of loops to go through.
long int seed = time(0); // random seed
StochasticLib sto(seed);
TRandomMersenne rg(seed); // make instance of random library
bool useFileData = false;
struct myVector
{
double q,x,y,z;
myVector(double qi, double xi, double yi, double zi): q(qi), x(xi), y(yi), z(zi) { } //This is called when you declare a vector and give initial values. it assigns the values to the correct variables.
myVector(): q(0), x(0), y(0), z(0) { } //Default initialization of vector. Called if you create a vector without passing any values to it.
};
double CalculateCharge (double q1, double q2, double q3, double q4, double q5, double q6, double q7, double q8)
{
double Q;
Q= q1 + q2 + q3 + q4 + q5 + q6 + q7 + q8;
return (Q);
}
double CalculateDipole (double q1, double q2, double q3, double q4, double q5, double q6, double q7, double q8,
double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8)
{
double P;
P=q1*x1+q2*x2+q3*x3+q4*x4+q5*x5+q6*x6+q7*x7+q8*x8;
return (P);
}
double CalculateQxx (double q1, double q2, double q3, double q4, double q5, double q6, double q7, double q8,
double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8,
double y1, double y2, double y3, double y4, double y5, double y6, double y7, double y8,
double z1, double z2, double z3, double z4, double z5, double z6, double z7, double z8)
{
double Qxx;
Qxx=2*q1*pow(x1,2) + 2*q2*pow(x2,2) + 2*q3*pow(x3,2) + 2*q4*pow(x4,2) + 2*q5*pow(x5,2) + 2*q6*pow(x6,2)
+ 2*q7*pow(x7,2) + 2*q8*pow(x8,2)- q1*pow(y1,2) - q2*pow(y2,2) - q3*pow(y3,2) - q4*pow(y4,2)
- q5*pow(y5,2) - q6*pow(y6,2) - q7*pow(y7,2) - q8*pow(y8,2) - q1*pow(z1,2) - q2*pow(z2,2)
- q3*pow(z3,2) - q4*pow(z4,2) - q5*pow(z5,2) - q6*pow(z6,2) - q7*pow(z7,2) - q8*pow(z8,2);
return (Qxx);
}
double CalculateQyy (double q1, double q2, double q3, double q4, double q5, double q6, double q7, double q8,
double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8,
double y1, double y2, double y3, double y4, double y5, double y6, double y7, double y8,
double z1, double z2, double z3, double z4, double z5, double z6, double z7, double z8)
{
double Qyy;
Qyy=2*q1*pow(y1,2) + 2*q2*pow(y2,2) + 2*q3*pow(y3,2) + 2*q4*pow(y4,2) + 2*q5*pow(y5,2) + 2*q6*pow(y6,2)
+ 2*q7*pow(y7,2) + 2*q8*pow(y8,2)- q1*pow(x1,2) - q2*pow(x2,2) - q3*pow(x3,2) - q4*pow(x4,2) - q5*pow(x5,2)
- q6*pow(x6,2) - q7*pow(x7,2) - q8*pow(x8,2) - q1*pow(z1,2) - q2*pow(z2,2) -
q3*pow(z3,2) - q4*pow(z4,2) - q5*pow(z5,2) - q6*pow(z6,2) - q7*pow(z7,2) - q8*pow(z8,2);
return (Qyy);
}
double CalculateQxy (double q1, double q2, double q3, double q4, double q5, double q6, double q7, double q8,
double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8,
double y1, double y2, double y3, double y4, double y5, double y6, double y7, double y8)
{
double Qxy;
Qxy=3*q1*x1*y1 + 3*q2*x2*y2 + 3*q3*x3*y3 + 3*q4*x4*y4 + 3*q5*x5*y5 + 3*q6*x6*y6 + 3*q7*x7*y7 + 3*q8*x8*y8;
return (Qxy);
}
double CalculateOxyz (double q1, double q2, double q3, double q4, double q5, double q6, double q7, double q8,
double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8,
double y1, double y2, double y3, double y4, double y5, double y6, double y7, double y8,
double z1, double z2, double z3, double z4, double z5, double z6, double z7, double z8)
{
double Oxyz;
Oxyz=q1*x1*y1*z1 + q2*x2*y2*z2 + q3*x3*y3*z3 + q4*x4*y4*z4 + q5*x5*y5*z5 + q6*x6*y6*z6 + q7*x7*y7*z7 + q8*x8*y8*z8;
return (Oxyz);
}
double CalculateVariance (double Q, double Px, double Py, double Pz,
double Qxx, double Qyy, double Qxy, double Qxz,
double Qyz, double Oxyz, double Oxxx, double Oxxy,
double Oxxz, double Oxyy, double Oxzz, double Oyyy,
double Oyyz, double Oyzz, double Ozzz)
{
double S;
S=pow((Q-RealQ)/(Qimportance*RealQ),2) + pow((Px-RealPx)/(Pximportance*RealPx),2)
+ pow((Py-RealPy)/(Pximportance*RealPy),2) + pow((Pz-RealPz)/(Pximportance*RealPz),2)
+ pow((Qxx-RealQxx)/(Qxximportance*RealQxx),2)+ pow((Qyy-RealQyy)/(Qxximportance*RealQyy),2)
+ pow((Qxy-RealQxy)/(Qxximportance*RealQxy),2)+ pow((Qxz-RealQxz)/(Qxximportance*RealQxz),2)
+ pow((Qyz-RealQyz)/(Qxximportance*RealQyz),2) + pow((Oxyz-RealOxyz)/(Oxxximportance*RealOxyz),2)
+ pow((Oxxz-RealOxxz)/(Oxxximportance*RealOxxz),2) + pow((Oxxy-RealOxxy)/(Oxxximportance*RealOxxy),2)
+ pow((Oxxx-RealOxxx)/(Oxxximportance*RealOxxx),2) + pow((Oxyy-RealOxyy)/(Oxxximportance*RealOxyy),2)
+ pow((Oxzz-RealOxzz)/(Oxxximportance*RealOxzz),2) + pow((Oyyy-RealOyyy)/(Oxxximportance*RealOyyy),2)
+ pow((Oyyz-RealOyyz)/(Oxxximportance*RealOyyz),2)+ pow((Oyzz-RealOyzz)/(Oxxximportance*RealOyzz),2)
+ pow((Ozzz-RealOzzz)/(Oxxximportance*RealOzzz),2);
return (S);
}
class MonteCarlo //This is where the Monte Carlo happens.
{
public:
double Initq1;
double Initx1;
double Inity1;
double Initz1;
double Initq2;
double Initx2;
double Inity2;
double Initz2;
double Initq3;
double Initx3;
double Inity3;
double Initz3;
double Initq4;
double Initx4;
double Inity4;
double Initz4;
double Initq5;
double Initx5;
double Inity5;
double Initz5;
double Initq6;
double Initx6;
double Inity6;
double Initz6;
double Initq7;
double Initx7;
double Inity7;
double Initz7;
double Initq8;
double Initx8;
double Inity8;
double Initz8;
myVector MinimumCharge1;
myVector MinimumCharge2;
myVector MinimumCharge3;
myVector MinimumCharge4;
myVector MinimumCharge5;
myVector MinimumCharge6;
myVector MinimumCharge7;
myVector MinimumCharge8;
myVector newcharge1;
myVector newcharge2;
myVector newcharge3;
myVector newcharge4;
myVector newcharge5;
myVector newcharge6;
myVector newcharge7;
myVector newcharge8;
myVector charge1;
myVector charge2;
myVector charge3;
myVector charge4;
myVector charge5;
myVector charge6;
myVector charge7;
myVector charge8;
double MinimumVariance;
double OldVariance;
MonteCarlo(void)
{
Initq1 = qSD*fRandomNumber_ZeroToOne-qSD/2;
Initx1 = xDimension*fRandomNumber_ZeroToOne-xDimension/2;
Inity1 = yDimension*fRandomNumber_ZeroToOne-yDimension/2;
Initz1 = zDimension*fRandomNumber_ZeroToOne-zDimension/2;
Initq2 = qSD*fRandomNumber_ZeroToOne-qSD/2;
Initx2 = xDimension*fRandomNumber_ZeroToOne-xDimension/2;
Inity2 = yDimension*fRandomNumber_ZeroToOne-yDimension/2;
Initz2 = zDimension*fRandomNumber_ZeroToOne-zDimension/2;
Initq3 = qSD*fRandomNumber_ZeroToOne-qSD/2;
Initx3 = xDimension*fRandomNumber_ZeroToOne-xDimension/2;
Inity3 = yDimension*fRandomNumber_ZeroToOne-yDimension/2;
Initz3 = zDimension*fRandomNumber_ZeroToOne-zDimension/2;
Initq4 = qSD*fRandomNumber_ZeroToOne-qSD/2;
Initx4 = xDimension*fRandomNumber_ZeroToOne-xDimension/2;
Inity4 = yDimension*fRandomNumber_ZeroToOne-yDimension/2;
Initz4 = zDimension*fRandomNumber_ZeroToOne-zDimension/2;
Initq5 = qSD*fRandomNumber_ZeroToOne-qSD/2;
Initx5 = xDimension*fRandomNumber_ZeroToOne-xDimension/2;
Inity5 = yDimension*fRandomNumber_ZeroToOne-yDimension/2;
Initz5 = zDimension*fRandomNumber_ZeroToOne-zDimension/2;
Initq6 = qSD*fRandomNumber_ZeroToOne-qSD/2;
Initx6 = xDimension*fRandomNumber_ZeroToOne-xDimension/2;
Inity6 = yDimension*fRandomNumber_ZeroToOne-yDimension/2;
Initz6 = zDimension*fRandomNumber_ZeroToOne-zDimension/2;
Initq7 = qSD*fRandomNumber_ZeroToOne-qSD/2;
Initx7 = xDimension*fRandomNumber_ZeroToOne-xDimension/2;
Inity7 = yDimension*fRandomNumber_ZeroToOne-yDimension/2;
Initz7 = zDimension*fRandomNumber_ZeroToOne-zDimension/2;
Initq8 = qSD*fRandomNumber_ZeroToOne-qSD/2;
Initx8 = xDimension*fRandomNumber_ZeroToOne-xDimension/2;
Inity8 = yDimension*fRandomNumber_ZeroToOne-yDimension/2;
Initz8 = zDimension*fRandomNumber_ZeroToOne-zDimension/2;
MinimumCharge1.q = 0;
MinimumCharge1.x = 0;
MinimumCharge1.y = 0;
MinimumCharge1.z = 0;
MinimumCharge2.q = 0;
MinimumCharge2.x = 0;
MinimumCharge2.y = 0;
MinimumCharge2.z = 0;
MinimumCharge3.q = 0;
MinimumCharge3.x = 0;
MinimumCharge3.y = 0;
MinimumCharge3.z = 0;
MinimumCharge4.q = 0;
MinimumCharge4.x = 0;
MinimumCharge4.y = 0;
MinimumCharge4.z = 0;
MinimumCharge5.q = 0;
MinimumCharge5.x = 0;
MinimumCharge5.y = 0;
MinimumCharge5.z = 0;
MinimumCharge6.q = 0;
MinimumCharge6.x = 0;
MinimumCharge6.y = 0;
MinimumCharge6.z = 0;
MinimumCharge7.q = 0;
MinimumCharge7.x = 0;
MinimumCharge7.y = 0;
MinimumCharge7.z = 0;
MinimumCharge8.q = 0;
MinimumCharge8.x = 0;
MinimumCharge8.y = 0;
MinimumCharge8.z = 0;
newcharge1.q = Initq1;
newcharge1.x = Initx1;
newcharge1.y = Inity1;
newcharge1.z = Initz1;
newcharge2.q = Initq2;
newcharge2.x = Initx2;
newcharge2.y = Inity2;
newcharge2.z = Initz2;
newcharge3.q = Initq3;
newcharge3.x = Initx3;
newcharge3.y = Inity3;
newcharge3.z = Initz3;
newcharge4.q = Initq4;
newcharge4.x = Initx4;
newcharge4.y = Inity4;
newcharge4.z = Initz4;
newcharge5.q = Initq5;
newcharge5.x = Initx5;
newcharge5.y = Inity5;
newcharge5.z = Initz5;
newcharge6.q = Initq6;
newcharge6.x = Initx6;
newcharge6.y = Inity6;
newcharge6.z = Initz6;
newcharge7.q = Initq7;
newcharge7.x = Initx7;
newcharge7.y = Inity7;
newcharge7.z = Initz7;
newcharge8.q = Initq8;
newcharge8.x = Initx8;
newcharge8.y = Inity8;
newcharge8.z = Initz8;
charge1.q = 0;
charge1.x = 0;
charge1.y = 0;
charge1.z = 0;
charge2.q = 0;
charge2.x = 0;
charge2.y = 0;
charge2.z = 0;
charge3.q = 0;
charge3.x = 0;
charge3.y = 0;
charge3.z = 0;
charge4.q = 0;
charge4.x = 0;
charge4.y = 0;
charge4.z = 0;
charge5.q = 0;
charge5.x = 0;
charge5.y = 0;
charge5.z = 0;
charge6.q = 0;
charge6.x = 0;
charge6.y = 0;
charge6.z = 0;
charge7.q = 0;
charge7.x = 0;
charge7.y = 0;
charge7.z = 0;
charge8.q = 0;
charge8.x = 0;
charge8.y = 0;
charge8.z = 0;
MinimumVariance = 19;
OldVariance = 19;
}
void chooseParameter()
{
for(unsigned long loop = 0; loop < numberOfLoops; loop++)
{
int Rand = (int)(32*fRandomNumber_ZeroToOne);
//cout << "Rand: " << Rand << endl;
if(Rand == 0)
{newcharge1.q = qSD*fRandomNumber_ZeroToOne-qSD/2;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;}
else
{if(Rand == 1)
{newcharge1.x = xDimension*fRandomNumber_ZeroToOne-xDimension/2;
newcharge1.q = charge1.q;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;}
else
{if(Rand == 2)
{newcharge1.y = yDimension*fRandomNumber_ZeroToOne-yDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;}
else
{if(Rand == 3)
{newcharge1.z = zDimension*fRandomNumber_ZeroToOne-zDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;}
else
{if(Rand == 4)
{newcharge2.q = qSD*fRandomNumber_ZeroToOne-qSD/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;}
else
{if(Rand == 5)
{newcharge2.x = xDimension*fRandomNumber_ZeroToOne-xDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;}
else
{if(Rand == 6)
{newcharge2.y = yDimension*fRandomNumber_ZeroToOne-yDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;}
else
{if(Rand == 7)
{newcharge2.z = zDimension*fRandomNumber_ZeroToOne-zDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;}
else
{if(Rand == 8)
{newcharge3.q = qSD*fRandomNumber_ZeroToOne-qSD/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;}
else
{if(Rand == 9)
{newcharge3.x = xDimension*fRandomNumber_ZeroToOne-xDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;}
else
{if(Rand == 10)
{newcharge3.y = yDimension*fRandomNumber_ZeroToOne-yDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;}
else
{if(Rand == 11)
{newcharge3.z = zDimension*fRandomNumber_ZeroToOne-zDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;}
else
{if(Rand == 12)
{newcharge4.q = qSD*fRandomNumber_ZeroToOne-qSD/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;}
else
{if(Rand == 13)
{ newcharge4.x = xDimension*fRandomNumber_ZeroToOne-xDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;}
else
{if(Rand == 14)
{newcharge4.y = yDimension*fRandomNumber_ZeroToOne-yDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;
}
else
{if(Rand == 15)
{newcharge4.z = zDimension*fRandomNumber_ZeroToOne-zDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;
}
else
{if(Rand == 16)
{ newcharge5.q = qSD*fRandomNumber_ZeroToOne-qSD/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;
}
else
{if(Rand == 17)
{ newcharge5.x = xDimension*fRandomNumber_ZeroToOne-xDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;
}
else
{if(Rand == 18)
{ newcharge5.y = yDimension*fRandomNumber_ZeroToOne-yDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.x = charge5.x;
newcharge5.q = charge5.q;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;
}
else
{if(Rand == 19)
{ newcharge5.z = zDimension*fRandomNumber_ZeroToOne-zDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.q = charge5.q;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;
}
else
{if(Rand == 20)
{ newcharge6.q = qSD*fRandomNumber_ZeroToOne-qSD/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge5.q = charge5.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;
}
else
{if(Rand == 21)
{ newcharge6.x = xDimension*fRandomNumber_ZeroToOne-xDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge5.x = charge5.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;
}
else
{if(Rand == 22)
{ newcharge6.y = yDimension*fRandomNumber_ZeroToOne-yDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.x = charge5.x;
newcharge5.q = charge5.q;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge5.y = charge5.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;
}
else
{if(Rand == 23)
{ newcharge6.z = zDimension*fRandomNumber_ZeroToOne-zDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.q = charge5.q;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge5.z = charge5.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;}
else
{if(Rand == 24)
{newcharge7.q = qSD*fRandomNumber_ZeroToOne-qSD/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;}
else
{if(Rand == 25)
{newcharge7.x = xDimension*fRandomNumber_ZeroToOne-xDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge7.q = charge7.q;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;}
else
{if(Rand == 26)
{newcharge7.y = yDimension*fRandomNumber_ZeroToOne-yDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.z = charge7.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;}
else
{if(Rand == 27)
{newcharge7.z = zDimension*fRandomNumber_ZeroToOne-zDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;}
else
{if(Rand == 28)
{newcharge8.q = qSD*fRandomNumber_ZeroToOne-qSD/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;}
else
{if(Rand == 29)
{newcharge8.x = xDimension*fRandomNumber_ZeroToOne-xDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge8.q = charge8.q;
newcharge8.y = charge8.y;
newcharge8.z = charge8.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;}
else
{if(Rand == 30)
{newcharge8.y = yDimension*fRandomNumber_ZeroToOne-yDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.z = charge8.z;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;}
else
{newcharge8.z = zDimension*fRandomNumber_ZeroToOne-zDimension/2;
newcharge1.q = charge1.q;
newcharge1.x = charge1.x;
newcharge1.y = charge1.y;
newcharge1.z = charge1.z;
newcharge8.q = charge8.q;
newcharge8.x = charge8.x;
newcharge8.y = charge8.y;
newcharge3.q = charge3.q;
newcharge3.x = charge3.x;
newcharge3.y = charge3.y;
newcharge3.z = charge3.z;
newcharge4.q = charge4.q;
newcharge4.x = charge4.x;
newcharge4.y = charge4.y;
newcharge4.z = charge4.z;
newcharge5.q = charge5.q;
newcharge5.x = charge5.x;
newcharge5.y = charge5.y;
newcharge5.z = charge5.z;
newcharge6.q = charge6.q;
newcharge6.x = charge6.x;
newcharge6.y = charge6.y;
newcharge6.z = charge6.z;
newcharge7.q = charge7.q;
newcharge7.x = charge7.x;
newcharge7.y = charge7.y;
newcharge7.z = charge7.z;
newcharge2.q = charge2.q;
newcharge2.x = charge2.x;
newcharge2.y = charge2.y;
newcharge2.z = charge2.z;}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
double Q = CalculateCharge(newcharge1.q,newcharge2.q,newcharge3.q,newcharge4.q,newcharge5.q,newcharge6.q,
newcharge7.q,newcharge8.q);
double Px = CalculateDipole(newcharge1.q,newcharge2.q,newcharge3.q,newcharge4.q,newcharge5.q,newcharge6.q,
newcharge7.q,newcharge8.q,newcharge1.x,newcharge2.x,newcharge3.x,newcharge4.x,newcharge5.x,newcharge6.x
,newcharge7.x,newcharge8.x);
double Py = CalculateDipole(newcharge1.q,newcharge2.q,newcharge3.q,newcharge4.q,newcharge5.q,newcharge6.q,
newcharge7.q,newcharge8.q,
newcharge1.y,newcharge2.y,newcharge3.y,newcharge4.y,newcharge5.y,newcharge6.y,newcharge7.y,newcharge8.y);
double Pz = CalculateDipole(newcharge1.q,newcharge2.q,newcharge3.q,newcharge4.q,newcharge5.q,newcharge6.q,
newcharge7.q,newcharge8.q,
newcharge1.z,newcharge2.z,newcharge3.z,newcharge4.z,newcharge5.z,newcharge6.z,newcharge7.z,newcharge8.z);
double Qxx = CalculateQxx(newcharge1.q,newcharge2.q,newcharge3.q,newcharge4.q,newcharge5.q,newcharge6.q,
newcharge7.q,newcharge8.q,
newcharge1.x,newcharge2.x,newcharge3.x,newcharge4.x,newcharge5.x,newcharge6.x,newcharge7.x,newcharge8.x,
newcharge1.y,newcharge2.y,newcharge3.y,newcharge4.y,newcharge5.y,newcharge6.y,newcharge7.y,newcharge8.y,
newcharge1.z,newcharge2.z,newcharge3.z,newcharge4.z,newcharge5.z,newcharge6.z,newcharge7.z,newcharge8.z);
double Qyy = CalculateQyy(newcharge1.q,newcharge2.q,newcharge3.q,newcharge4.q,newcharge5.q,newcharge6.q,
newcharge7.q,newcharge8.q,
newcharge1.x,newcharge2.x,newcharge3.x,newcharge4.x,newcharge5.x,newcharge6.x,newcharge7.x,newcharge8.x,
newcharge1.y,newcharge2.y,newcharge3.y,newcharge4.y,newcharge5.y,newcharge6.y,newcharge7.y,newcharge8.y,
newcharge1.z,newcharge2.z,newcharge3.z,newcharge4.z,newcharge5.z,newcharge6.z,newcharge7.z,newcharge8.z);
double Qxy = CalculateQxy(newcharge1.q,newcharge2.q,newcharge3.q,newcharge4.q,newcharge5.q,newcharge6.q,
newcharge7.q,newcharge8.q,
newcharge1.x,newcharge2.x,newcharge3.x,newcharge4.x,newcharge5.x,newcharge6.x,newcharge7.x,newcharge8.x,
newcharge1.y,newcharge2.y,newcharge3.y,newcharge4.y,newcharge5.y,newcharge6.y,newcharge7.y,newcharge8.y);
double Qxz = CalculateQxy(newcharge1.q,newcharge2.q,newcharge3.q,newcharge4.q,newcharge5.q,newcharge6.q,
newcharge7.q,newcharge8.q,
newcharge1.x,newcharge2.x,newcharge3.x,newcharge4.x,newcharge5.x,newcharge6.x,newcharge7.x,newcharge8.x,
newcharge1.z,newcharge2.z,newcharge3.z,newcharge4.z,newcharge5.z,newcharge6.z,newcharge7.z,newcharge8.z);
double Qyz = CalculateQxy(newcharge1.q,newcharge2.q,newcharge3.q,newcharge4.q,newcharge5.q,newcharge6.q,
newcharge7.q,newcharge8.q,
newcharge1.y,newcharge2.y,newcharge3.y,newcharge4.y,newcharge5.y,newcharge6.y,newcharge7.y,newcharge8.y,
newcharge1.z,newcharge2.z,newcharge3.z,newcharge4.z,newcharge5.z,newcharge6.z,newcharge7.z,newcharge8.z);
double Oxyz = CalculateOxyz(newcharge1.q,newcharge2.q,newcharge3.q,newcharge4.q,newcharge5.q,newcharge6.q,
newcharge7.q,newcharge8.q,
newcharge1.x,newcharge2.x,newcharge3.x,newcharge4.x,newcharge5.x,newcharge6.x,newcharge7.x,newcharge8.x,
newcharge1.y,newcharge2.y,newcharge3.y,newcharge4.y,newcharge5.y,newcharge6.y,newcharge7.y,newcharge8.y,
newcharge1.z,newcharge2.z,newcharge3.z,newcharge4.z,newcharge5.z,newcharge6.z,newcharge7.z,newcharge8.z);
double Oxxx = CalculateOxyz(newcharge1.q,newcharge2.q,newcharge3.q,newcharge4.q,newcharge5.q,newcharge6.q,
newcharge7.q,newcharge8.q,
newcharge1.x,newcharge2.x,newcharge3.x,newcharge4.x,newcharge5.x,newcharge6.x,newcharge7.x,newcharge8.x,
newcharge1.x,newcharge2.x,newcharge3.x,newcharge4.x,newcharge5.x,newcharge6.x,newcharge7.x,newcharge8.x,
newcharge1.x,newcharge2.x,newcharge3.x,newcharge4.x,newcharge5.x,newcharge6.x,newcharge7.x,newcharge8.x);
double Oxxy = CalculateOxyz(newcharge1.q,newcharge2.q,newcharge3.q,newcharge4.q,newcharge5.q,newcharge6.q,
newcharge7.q,newcharge8.q,
newcharge1.x,newcharge2.x,newcharge3.x,newcharge4.x,newcharge5.x,newcharge6.x,newcharge7.x,newcharge8.x,
newcharge1.y,newcharge2.y,newcharge3.y,newcharge4.y,newcharge5.y,newcharge6.y,newcharge7.y,newcharge8.y,
newcharge1.x,newcharge2.x,newcharge3.x,newcharge4.x,newcharge5.x,newcharge6.x,newcharge7.x,newcharge8.x);
double Oxxz = CalculateOxyz(newcharge1.q,newcharge2.q,newcharge3.q,newcharge4.q,newcharge5.q,newcharge6.q,
newcharge7.q,newcharge8.q,
newcharge1.x,newcharge2.x,newcharge3.x,newcharge4.x,newcharge5.x,newcharge6.x,newcharge7.x,newcharge8.x,
newcharge1.x,newcharge2.x,newcharge3.x,newcharge4.x,newcharge5.x,newcharge6.x,newcharge7.x,newcharge8.x,
newcharge1.z,newcharge2.z,newcharge3.z,newcharge4.z,newcharge5.z,newcharge6.z,newcharge7.z,newcharge8.z);
double Oxyy = CalculateOxyz(newcharge1.q,newcharge2.q,newcharge3.q,newcharge4.q,newcharge5.q,newcharge6.q,
newcharge7.q,newcharge8.q,
newcharge1.x,newcharge2.x,newcharge3.x,newcharge4.x,newcharge5.x,newcharge6.x,newcharge7.x,newcharge8.x,
newcharge1.y,newcharge2.y,newcharge3.y,newcharge4.y,newcharge5.y,newcharge6.y,newcharge7.y,newcharge8.y,
newcharge1.y,newcharge2.y,newcharge3.y,newcharge4.y,newcharge5.y,newcharge6.y,newcharge7.y,newcharge8.y);
double Oxzz = CalculateOxyz(newcharge1.q,newcharge2.q,newcharge3.q,newcharge4.q,newcharge5.q,newcharge6.q,
newcharge7.q,newcharge8.q,
newcharge1.x,newcharge2.x,newcharge3.x,newcharge4.x,newcharge5.x,newcharge6.x,newcharge7.x,newcharge8.x,
newcharge1.z,newcharge2.z,newcharge3.z,newcharge4.z,newcharge5.z,newcharge6.z,newcharge7.z,newcharge8.z,
newcharge1.z,newcharge2.z,newcharge3.z,newcharge4.z,newcharge5.z,newcharge6.z,newcharge7.z,newcharge8.z);
double Oyyy = CalculateOxyz(newcharge1.q,newcharge2.q,newcharge3.q,newcharge4.q,newcharge5.q,newcharge6.q,
newcharge7.q,newcharge8.q,
newcharge1.y,newcharge2.y,newcharge3.y,newcharge4.y,newcharge5.y,newcharge6.y,newcharge7.y,newcharge8.y,
newcharge1.y,newcharge2.y,newcharge3.y,newcharge4.y,newcharge5.y,newcharge6.y,newcharge7.y,newcharge8.y,
newcharge1.y,newcharge2.y,newcharge3.y,newcharge4.y,newcharge5.y,newcharge6.y,newcharge7.y,newcharge8.y);
double Oyyz = CalculateOxyz(newcharge1.q,newcharge2.q,newcharge3.q,newcharge4.q,newcharge5.q,newcharge6.q,
newcharge7.q,newcharge8.q,
newcharge1.y,newcharge2.y,newcharge3.y,newcharge4.y,newcharge5.y,newcharge6.y,newcharge7.y,newcharge8.y,
newcharge1.y,newcharge2.y,newcharge3.y,newcharge4.y,newcharge5.y,newcharge6.y,newcharge7.y,newcharge8.y,
newcharge1.z,newcharge2.z,newcharge3.z,newcharge4.z,newcharge5.z,newcharge6.z,newcharge7.z,newcharge8.z);
double Oyzz = CalculateOxyz(newcharge1.q,newcharge2.q,newcharge3.q,newcharge4.q,newcharge5.q,newcharge6.q,
newcharge7.q,newcharge8.q,
newcharge1.z,newcharge2.z,newcharge3.z,newcharge4.z,newcharge5.z,newcharge6.z,newcharge7.z,newcharge8.z,
newcharge1.y,newcharge2.y,newcharge3.y,newcharge4.y,newcharge5.y,newcharge6.y,newcharge7.y,newcharge8.y,
newcharge1.z,newcharge2.z,newcharge3.z,newcharge4.z,newcharge5.z,newcharge6.z,newcharge7.z,newcharge8.z);
double Ozzz = CalculateOxyz(newcharge1.q,newcharge2.q,newcharge3.q,newcharge4.q,newcharge5.q,newcharge6.q,
newcharge7.q,newcharge8.q,
newcharge1.z,newcharge2.z,newcharge3.z,newcharge4.z,newcharge5.z,newcharge6.z,newcharge7.z,newcharge8.z,
newcharge1.z,newcharge2.z,newcharge3.z,newcharge4.z,newcharge5.z,newcharge6.z,newcharge7.z,newcharge8.z,
newcharge1.z,newcharge2.z,newcharge3.z,newcharge4.z,newcharge5.z,newcharge6.z,newcharge7.z,newcharge8.z);
double Variance = CalculateVariance(Q, Px, Py, Pz, Qxx, Qyy, Qxy, Qxz, Qyz, Oxyz, Oxxx,
Oxxy, Oxxz, Oxyy, Oxzz, Oyyy, Oyyz, Oyzz, Ozzz);
if(Variance < MinimumVariance)
{ MinimumVariance = Variance;
MinimumCharge1.q = newcharge1.q;
MinimumCharge1.x = newcharge1.x;
MinimumCharge1.y = newcharge1.y;
MinimumCharge1.z = newcharge1.z;
MinimumCharge2.q = newcharge2.q;
MinimumCharge2.x = newcharge2.x;
MinimumCharge2.y = newcharge2.y;
MinimumCharge2.z = newcharge2.z;
MinimumCharge3.q = newcharge3.q;
MinimumCharge3.x = newcharge3.x;
MinimumCharge3.y = newcharge3.y;
MinimumCharge3.z = newcharge3.z;
MinimumCharge4.q = newcharge4.q;
MinimumCharge4.x = newcharge4.x;
MinimumCharge4.y = newcharge4.y;
MinimumCharge4.z = newcharge4.z;
MinimumCharge5.q = newcharge5.q;
MinimumCharge5.x = newcharge5.x;
MinimumCharge5.y = newcharge5.y;
MinimumCharge5.z = newcharge5.z;
MinimumCharge6.q = newcharge6.q;
MinimumCharge6.x = newcharge6.x;
MinimumCharge6.y = newcharge6.y;
MinimumCharge6.z = newcharge6.z;
MinimumCharge7.q = newcharge7.q;
MinimumCharge7.x = newcharge7.x;
MinimumCharge7.y = newcharge7.y;
MinimumCharge7.z = newcharge7.z;
MinimumCharge8.q = newcharge8.q;
MinimumCharge8.x = newcharge8.x;
MinimumCharge8.y = newcharge8.y;
MinimumCharge8.z = newcharge8.z;
cout << "Loop Number: " << loop << endl;
cout << "Variance: " << MinimumVariance << endl;
cout << "q1: " << MinimumCharge1.q << endl;
cout << "x1: " << MinimumCharge1.x << endl;
cout << "y1: " << MinimumCharge1.y << endl;
cout << "z1: " << MinimumCharge1.z << endl;
cout << "q2: " << MinimumCharge2.q << endl;
cout << "x2: " << MinimumCharge2.x << endl;
cout << "y2: " << MinimumCharge2.y << endl;
cout << "z2: " << MinimumCharge2.z << endl;
cout << "q3: " << MinimumCharge3.q << endl;
cout << "x3: " << MinimumCharge3.x << endl;
cout << "y3: " << MinimumCharge3.y << endl;
cout << "z3: " << MinimumCharge3.z << endl;
cout << "q4: " << MinimumCharge4.q << endl;
cout << "x4: " << MinimumCharge4.x << endl;
cout << "y4: " << MinimumCharge4.y << endl;
cout << "z4: " << MinimumCharge4.z << endl;
cout << "q5: " << MinimumCharge5.q << endl;
cout << "x5: " << MinimumCharge5.x << endl;
cout << "y5: " << MinimumCharge5.y << endl;
cout << "z5: " << MinimumCharge5.z << endl;
cout << "q6: " << MinimumCharge6.q << endl;
cout << "x6: " << MinimumCharge6.x << endl;
cout << "y6: " << MinimumCharge6.y << endl;
cout << "z6: " << MinimumCharge6.z << endl;
cout << "q7: " << MinimumCharge7.q << endl;
cout << "x7: " << MinimumCharge7.x << endl;
cout << "y7: " << MinimumCharge7.y << endl;
cout << "z7: " << MinimumCharge7.z << endl;
cout << "q8: " << MinimumCharge8.q << endl;
cout << "x8: " << MinimumCharge8.x << endl;
cout << "y8: " << MinimumCharge8.y << endl;
cout << "z8: " << MinimumCharge8.z << endl;
cout << "Q: " << Q << endl;
cout << "Px: " << Px << endl;
cout << "Py: " << Py << endl;
cout << "Pz: " << Pz << endl;
cout << "Qxx: " << Qxx << endl;
cout << "Qxy: " << Qxy << endl;
cout << "Qxz: " << Qxz << endl;
cout << "Qyy: " << Qyy << endl;
cout << "Qyz: " << Qyz << endl;
cout << "Oxxx: " << Oxxx << endl;
cout << "Oxxy: " << Oxxy << endl;
cout << "Oxxz: " << Oxxz << endl;
cout << "Oxyy: " << Oxyy << endl;
cout << "Oxyz: " << Oxyz << endl;
cout << "Oxzz: " << Oxzz << endl;
cout << "Oyyy: " << Oyyy << endl;
cout << "Oyyz: " << Oyyz << endl;
cout << "Oyzz: " << Oyzz << endl;
cout << "Ozzz: " << Ozzz << endl;
}
double Rand1 = fRandomNumber_ZeroToOne;
double p = exp((OldVariance-Variance)/(kT*MinimumVariance));
if(Rand1 < p)
{
OldVariance = Variance;
charge1.q = newcharge1.q;
charge1.x = newcharge1.x;
charge1.y = newcharge1.y;
charge1.z = newcharge1.z;
charge2.q = newcharge2.q;
charge2.x = newcharge2.x;
charge2.y = newcharge2.y;
charge2.z = newcharge2.z;
charge3.q = newcharge3.q;
charge3.x = newcharge3.x;
charge3.y = newcharge3.y;
charge3.z = newcharge3.z;
charge4.q = newcharge4.q;
charge4.x = newcharge4.x;
charge4.y = newcharge4.y;
charge4.z = newcharge4.z;
charge5.q = newcharge5.q;
charge5.x = newcharge5.x;
charge5.y = newcharge5.y;
charge5.z = newcharge5.z;
charge6.q = newcharge6.q;
charge6.x = newcharge6.x;
charge6.y = newcharge6.y;
charge6.z = newcharge6.z;
charge7.q = newcharge7.q;
charge7.x = newcharge7.x;
charge7.y = newcharge7.y;
charge7.z = newcharge7.z;
charge8.q = newcharge8.q;
charge8.x = newcharge8.x;
charge8.y = newcharge8.y;
charge8.z = newcharge8.z;
}
}
double Q = CalculateCharge(MinimumCharge1.q,MinimumCharge2.q,MinimumCharge3.q,MinimumCharge4.q,MinimumCharge5.q,MinimumCharge6.q,
MinimumCharge7.q,MinimumCharge8.q);
double Px = CalculateDipole(MinimumCharge1.q,MinimumCharge2.q,MinimumCharge3.q,MinimumCharge4.q,MinimumCharge5.q,MinimumCharge6.q,
MinimumCharge7.q,MinimumCharge8.q,MinimumCharge1.x,MinimumCharge2.x,MinimumCharge3.x,MinimumCharge4.x,MinimumCharge5.x,MinimumCharge6.x
,MinimumCharge7.x,MinimumCharge8.x);
double Py = CalculateDipole(MinimumCharge1.q,MinimumCharge2.q,MinimumCharge3.q,MinimumCharge4.q,MinimumCharge5.q,MinimumCharge6.q,
MinimumCharge7.q,MinimumCharge8.q,
MinimumCharge1.y,MinimumCharge2.y,MinimumCharge3.y,MinimumCharge4.y,MinimumCharge5.y,MinimumCharge6.y,MinimumCharge7.y,MinimumCharge8.y);
double Pz = CalculateDipole(MinimumCharge1.q,MinimumCharge2.q,MinimumCharge3.q,MinimumCharge4.q,MinimumCharge5.q,MinimumCharge6.q,
MinimumCharge7.q,MinimumCharge8.q,
MinimumCharge1.z,MinimumCharge2.z,MinimumCharge3.z,MinimumCharge4.z,MinimumCharge5.z,MinimumCharge6.z,MinimumCharge7.z,MinimumCharge8.z);
double Qxx = CalculateQxx(MinimumCharge1.q,MinimumCharge2.q,MinimumCharge3.q,MinimumCharge4.q,MinimumCharge5.q,MinimumCharge6.q,
MinimumCharge7.q,MinimumCharge8.q,
MinimumCharge1.x,MinimumCharge2.x,MinimumCharge3.x,MinimumCharge4.x,MinimumCharge5.x,MinimumCharge6.x,MinimumCharge7.x,MinimumCharge8.x,
MinimumCharge1.y,MinimumCharge2.y,MinimumCharge3.y,MinimumCharge4.y,MinimumCharge5.y,MinimumCharge6.y,MinimumCharge7.y,MinimumCharge8.y,
MinimumCharge1.z,MinimumCharge2.z,MinimumCharge3.z,MinimumCharge4.z,MinimumCharge5.z,MinimumCharge6.z,MinimumCharge7.z,MinimumCharge8.z);
double Qyy = CalculateQyy(MinimumCharge1.q,MinimumCharge2.q,MinimumCharge3.q,MinimumCharge4.q,MinimumCharge5.q,MinimumCharge6.q,
MinimumCharge7.q,MinimumCharge8.q,
MinimumCharge1.x,MinimumCharge2.x,MinimumCharge3.x,MinimumCharge4.x,MinimumCharge5.x,MinimumCharge6.x,MinimumCharge7.x,MinimumCharge8.x,
MinimumCharge1.y,MinimumCharge2.y,MinimumCharge3.y,MinimumCharge4.y,MinimumCharge5.y,MinimumCharge6.y,MinimumCharge7.y,MinimumCharge8.y,
MinimumCharge1.z,MinimumCharge2.z,MinimumCharge3.z,MinimumCharge4.z,MinimumCharge5.z,MinimumCharge6.z,MinimumCharge7.z,MinimumCharge8.z);
double Qxy = CalculateQxy(MinimumCharge1.q,MinimumCharge2.q,MinimumCharge3.q,MinimumCharge4.q,MinimumCharge5.q,MinimumCharge6.q,
MinimumCharge7.q,MinimumCharge8.q,
MinimumCharge1.x,MinimumCharge2.x,MinimumCharge3.x,MinimumCharge4.x,MinimumCharge5.x,MinimumCharge6.x,MinimumCharge7.x,MinimumCharge8.x,
MinimumCharge1.y,MinimumCharge2.y,MinimumCharge3.y,MinimumCharge4.y,MinimumCharge5.y,MinimumCharge6.y,MinimumCharge7.y,MinimumCharge8.y);
double Qxz = CalculateQxy(MinimumCharge1.q,MinimumCharge2.q,MinimumCharge3.q,MinimumCharge4.q,MinimumCharge5.q,MinimumCharge6.q,
MinimumCharge7.q,MinimumCharge8.q,
MinimumCharge1.x,MinimumCharge2.x,MinimumCharge3.x,MinimumCharge4.x,MinimumCharge5.x,MinimumCharge6.x,MinimumCharge7.x,MinimumCharge8.x,
MinimumCharge1.z,MinimumCharge2.z,MinimumCharge3.z,MinimumCharge4.z,MinimumCharge5.z,MinimumCharge6.z,MinimumCharge7.z,MinimumCharge8.z);
double Qyz = CalculateQxy(MinimumCharge1.q,MinimumCharge2.q,MinimumCharge3.q,MinimumCharge4.q,MinimumCharge5.q,MinimumCharge6.q,
MinimumCharge7.q,MinimumCharge8.q,
MinimumCharge1.y,MinimumCharge2.y,MinimumCharge3.y,MinimumCharge4.y,MinimumCharge5.y,MinimumCharge6.y,MinimumCharge7.y,MinimumCharge8.y,
MinimumCharge1.z,MinimumCharge2.z,MinimumCharge3.z,MinimumCharge4.z,MinimumCharge5.z,MinimumCharge6.z,MinimumCharge7.z,MinimumCharge8.z);
double Oxyz = CalculateOxyz(MinimumCharge1.q,MinimumCharge2.q,MinimumCharge3.q,MinimumCharge4.q,MinimumCharge5.q,MinimumCharge6.q,
MinimumCharge7.q,MinimumCharge8.q,
MinimumCharge1.x,MinimumCharge2.x,MinimumCharge3.x,MinimumCharge4.x,MinimumCharge5.x,MinimumCharge6.x,MinimumCharge7.x,MinimumCharge8.x,
MinimumCharge1.y,MinimumCharge2.y,MinimumCharge3.y,MinimumCharge4.y,MinimumCharge5.y,MinimumCharge6.y,MinimumCharge7.y,MinimumCharge8.y,
MinimumCharge1.z,MinimumCharge2.z,MinimumCharge3.z,MinimumCharge4.z,MinimumCharge5.z,MinimumCharge6.z,MinimumCharge7.z,MinimumCharge8.z);
double Oxxx = CalculateOxyz(MinimumCharge1.q,MinimumCharge2.q,MinimumCharge3.q,MinimumCharge4.q,MinimumCharge5.q,MinimumCharge6.q,
MinimumCharge7.q,MinimumCharge8.q,
MinimumCharge1.x,MinimumCharge2.x,MinimumCharge3.x,MinimumCharge4.x,MinimumCharge5.x,MinimumCharge6.x,MinimumCharge7.x,MinimumCharge8.x,
MinimumCharge1.x,MinimumCharge2.x,MinimumCharge3.x,MinimumCharge4.x,MinimumCharge5.x,MinimumCharge6.x,MinimumCharge7.x,MinimumCharge8.x,
MinimumCharge1.x,MinimumCharge2.x,MinimumCharge3.x,MinimumCharge4.x,MinimumCharge5.x,MinimumCharge6.x,MinimumCharge7.x,MinimumCharge8.x);
double Oxxy = CalculateOxyz(MinimumCharge1.q,MinimumCharge2.q,MinimumCharge3.q,MinimumCharge4.q,MinimumCharge5.q,MinimumCharge6.q,
MinimumCharge7.q,MinimumCharge8.q,
MinimumCharge1.x,MinimumCharge2.x,MinimumCharge3.x,MinimumCharge4.x,MinimumCharge5.x,MinimumCharge6.x,MinimumCharge7.x,MinimumCharge8.x,
MinimumCharge1.y,MinimumCharge2.y,MinimumCharge3.y,MinimumCharge4.y,MinimumCharge5.y,MinimumCharge6.y,MinimumCharge7.y,MinimumCharge8.y,
MinimumCharge1.x,MinimumCharge2.x,MinimumCharge3.x,MinimumCharge4.x,MinimumCharge5.x,MinimumCharge6.x,MinimumCharge7.x,MinimumCharge8.x);
double Oxxz = CalculateOxyz(MinimumCharge1.q,MinimumCharge2.q,MinimumCharge3.q,MinimumCharge4.q,MinimumCharge5.q,MinimumCharge6.q,
MinimumCharge7.q,MinimumCharge8.q,
MinimumCharge1.x,MinimumCharge2.x,MinimumCharge3.x,MinimumCharge4.x,MinimumCharge5.x,MinimumCharge6.x,MinimumCharge7.x,MinimumCharge8.x,
MinimumCharge1.x,MinimumCharge2.x,MinimumCharge3.x,MinimumCharge4.x,MinimumCharge5.x,MinimumCharge6.x,MinimumCharge7.x,MinimumCharge8.x,
MinimumCharge1.z,MinimumCharge2.z,MinimumCharge3.z,MinimumCharge4.z,MinimumCharge5.z,MinimumCharge6.z,MinimumCharge7.z,MinimumCharge8.z);
double Oxyy = CalculateOxyz(MinimumCharge1.q,MinimumCharge2.q,MinimumCharge3.q,MinimumCharge4.q,MinimumCharge5.q,MinimumCharge6.q,
MinimumCharge7.q,MinimumCharge8.q,
MinimumCharge1.x,MinimumCharge2.x,MinimumCharge3.x,MinimumCharge4.x,MinimumCharge5.x,MinimumCharge6.x,MinimumCharge7.x,MinimumCharge8.x,
MinimumCharge1.y,MinimumCharge2.y,MinimumCharge3.y,MinimumCharge4.y,MinimumCharge5.y,MinimumCharge6.y,MinimumCharge7.y,MinimumCharge8.y,
MinimumCharge1.y,MinimumCharge2.y,MinimumCharge3.y,MinimumCharge4.y,MinimumCharge5.y,MinimumCharge6.y,MinimumCharge7.y,MinimumCharge8.y);
double Oxzz = CalculateOxyz(MinimumCharge1.q,MinimumCharge2.q,MinimumCharge3.q,MinimumCharge4.q,MinimumCharge5.q,MinimumCharge6.q,
MinimumCharge7.q,MinimumCharge8.q,
MinimumCharge1.x,MinimumCharge2.x,MinimumCharge3.x,MinimumCharge4.x,MinimumCharge5.x,MinimumCharge6.x,MinimumCharge7.x,MinimumCharge8.x,
MinimumCharge1.z,MinimumCharge2.z,MinimumCharge3.z,MinimumCharge4.z,MinimumCharge5.z,MinimumCharge6.z,MinimumCharge7.z,MinimumCharge8.z,
MinimumCharge1.z,MinimumCharge2.z,MinimumCharge3.z,MinimumCharge4.z,MinimumCharge5.z,MinimumCharge6.z,MinimumCharge7.z,MinimumCharge8.z);
double Oyyy = CalculateOxyz(MinimumCharge1.q,MinimumCharge2.q,MinimumCharge3.q,MinimumCharge4.q,MinimumCharge5.q,MinimumCharge6.q,
MinimumCharge7.q,MinimumCharge8.q,
MinimumCharge1.y,MinimumCharge2.y,MinimumCharge3.y,MinimumCharge4.y,MinimumCharge5.y,MinimumCharge6.y,MinimumCharge7.y,MinimumCharge8.y,
MinimumCharge1.y,MinimumCharge2.y,MinimumCharge3.y,MinimumCharge4.y,MinimumCharge5.y,MinimumCharge6.y,MinimumCharge7.y,MinimumCharge8.y,
MinimumCharge1.y,MinimumCharge2.y,MinimumCharge3.y,MinimumCharge4.y,MinimumCharge5.y,MinimumCharge6.y,MinimumCharge7.y,MinimumCharge8.y);
double Oyyz = CalculateOxyz(MinimumCharge1.q,MinimumCharge2.q,MinimumCharge3.q,MinimumCharge4.q,MinimumCharge5.q,MinimumCharge6.q,
MinimumCharge7.q,MinimumCharge8.q,
MinimumCharge1.y,MinimumCharge2.y,MinimumCharge3.y,MinimumCharge4.y,MinimumCharge5.y,MinimumCharge6.y,MinimumCharge7.y,MinimumCharge8.y,
MinimumCharge1.y,MinimumCharge2.y,MinimumCharge3.y,MinimumCharge4.y,MinimumCharge5.y,MinimumCharge6.y,MinimumCharge7.y,MinimumCharge8.y,
MinimumCharge1.z,MinimumCharge2.z,MinimumCharge3.z,MinimumCharge4.z,MinimumCharge5.z,MinimumCharge6.z,MinimumCharge7.z,MinimumCharge8.z);
double Oyzz = CalculateOxyz(MinimumCharge1.q,MinimumCharge2.q,MinimumCharge3.q,MinimumCharge4.q,MinimumCharge5.q,MinimumCharge6.q,
MinimumCharge7.q,MinimumCharge8.q,
MinimumCharge1.z,MinimumCharge2.z,MinimumCharge3.z,MinimumCharge4.z,MinimumCharge5.z,MinimumCharge6.z,MinimumCharge7.z,MinimumCharge8.z,
MinimumCharge1.y,MinimumCharge2.y,MinimumCharge3.y,MinimumCharge4.y,MinimumCharge5.y,MinimumCharge6.y,MinimumCharge7.y,MinimumCharge8.y,
MinimumCharge1.z,MinimumCharge2.z,MinimumCharge3.z,MinimumCharge4.z,MinimumCharge5.z,MinimumCharge6.z,MinimumCharge7.z,MinimumCharge8.z);
double Ozzz = CalculateOxyz(MinimumCharge1.q,MinimumCharge2.q,MinimumCharge3.q,MinimumCharge4.q,MinimumCharge5.q,MinimumCharge6.q,
MinimumCharge7.q,MinimumCharge8.q,
MinimumCharge1.z,MinimumCharge2.z,MinimumCharge3.z,MinimumCharge4.z,MinimumCharge5.z,MinimumCharge6.z,MinimumCharge7.z,MinimumCharge8.z,
MinimumCharge1.z,MinimumCharge2.z,MinimumCharge3.z,MinimumCharge4.z,MinimumCharge5.z,MinimumCharge6.z,MinimumCharge7.z,MinimumCharge8.z,
MinimumCharge1.z,MinimumCharge2.z,MinimumCharge3.z,MinimumCharge4.z,MinimumCharge5.z,MinimumCharge6.z,MinimumCharge7.z,MinimumCharge8.z);
cout << "Q: " << Q << endl;
cout << "Px: " << Px << endl;
cout << "Py: " << Py << endl;
cout << "Pz: " << Pz << endl;
cout << "Qxx: " << Qxx << endl;
cout << "Qxy: " << Qxy << endl;
cout << "Qxz: " << Qxz << endl;
cout << "Qyy: " << Qyy << endl;
cout << "Qyz: " << Qyz << endl;
cout << "Oxxx: " << Oxxx << endl;
cout << "Oxxy: " << Oxxy << endl;
cout << "Oxxz: " << Oxxz << endl;
cout << "Oxyy: " << Oxyy << endl;
cout << "Oxyz: " << Oxyz << endl;
cout << "Oxzz: " << Oxzz << endl;
cout << "Oyyy: " << Oyyy << endl;
cout << "Oyyz: " << Oyyz << endl;
cout << "Oyzz: " << Oyzz << endl;
cout << "Ozzz: " << Ozzz << endl;
}
};
MonteCarlo myProgram;
void main()
{
myProgram.chooseParameter();
}