public ParticleEnsemble(int nparticles, double MinRad, double MaxRad, List<string> FFtype, int Height, int Width, double scaleFactor) { int i; // set the maximum number of particles to 1000 m_MaxNumberOfParticles = 1000; Particles = new ParticleCollection(this, m_MaxNumberOfParticles); // value of the boltzmann constant - we dont really care about units now... kb = 8.314; // value of the berendsen coupling constant - set this to be controlled by the artist... m_BerendsenThermostatCoupling = 1.0; m_EquilibriumTemperature = 20000; BerendsenThermostat = true; // BerendsenThermostat=false; EnsembleReinitializationFlag = false; NumberOfParticlesChangedFlag = false; NumberOfParticlesIsGreaterFlag = false; m_RadiiScaleFactor = 1.0; InitialKE = 0.0; m_GradientScaleFactor = scaleFactor; step = 0; //NumberOfParticles = nparticles; m_BoxHeight = Height; m_BoxWidth = Width; m_MaxForceThreshold = 1.0e6; m_InitialMaxForceThreshold = m_MaxForceThreshold; // allocate maximum space for and initialize the velocity autocorrelation & FFT vectors m_FFTenabled = true; m_FFTofCorrelationFunction = new List<double>(new double[MAX_CORR_FTN_SIZE]); m_VelocityAutoCorrelationFunction = new double[MAX_CORR_FTN_SIZE]; for (int ii = 0; ii < MAX_CORR_FTN_SIZE; ++ii) { m_VelocityAutoCorrelationFunction[ii] = 0.0; m_FFTofCorrelationFunction[ii] = 0.0; } for (int ii = 0; ii < FFTmatrixForMovingAverage.Count(); ++ii) { FFTmatrixForMovingAverage[ii]= new List<double>(new double[m_NumberOfFFTAverages]); for(int kk=0; kk < m_NumberOfFFTAverages; ++kk){ FFTmatrixForMovingAverage[ii][kk] = 0.0; } } InitialMinVel = 100.0; InitialMaxVel = 200.0; for (int ii = 0; ii < m_MaxNumberOfParticles; ++ii) { InitializeOneNewParticle(); } for (int ii = nparticles; ii < m_MaxNumberOfParticles; ++ii) { Particles.Pop(); } if (!EliminateParticleOverlap(Height, Width)) { // adjust particle positions to eliminate overlap do { // if there's too many particles to fit in the simulation box //NumberOfParticles -= 1; Particles.Pop(); // decrement the particles till it's ok EliminateParticleOverlap(Height, Width); } while (!EliminateParticleOverlap(Height, Width)); } // create matrix to distanceMatrix & distanceMatrixLastTime distanceMatrix = new DPMatrix(0.0, MaxNumberOfParticles, MaxNumberOfParticles); distanceMatrixLastTime = new DPMatrix(0.0, MaxNumberOfParticles, MaxNumberOfParticles); distanceMatrixLastLastTime = new DPMatrix(0.0, MaxNumberOfParticles, MaxNumberOfParticles); // update the particlesWithinRange matrix particlesWithinRange = new BoolMatrix(false, MaxNumberOfParticles, MaxNumberOfParticles); // update the interparticle separation matrix UpdateInterParticleSeparations(); m_PotentialEnergy = 0.0; // push back forceField objects onto pForceFieldVector - at present, we only have LJ forces, but this can be // easily expanded for (i = 0; i < FFtype.Count; ++i) { if (FFtype[i] == "SoftSpheres") { ForceFields.Add(new SoftSpheres(this)); } } }