10.12.2012 Views

Κεφάλαιο 1 - Nemertes

Κεφάλαιο 1 - Nemertes

Κεφάλαιο 1 - Nemertes

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ΑΝΑΠΤΥΞΗ ΚΩ∆ΙΚΑ ΜΟΡΙΑΚΗΣ ∆ΥΝΑΜΙΚΗΣ<br />

}<br />

System.out.println("PARTICLES : " + particles);<br />

calculateBoundaries();<br />

return particles;<br />

}<br />

else if(method.equals("BCC"))<br />

{<br />

int particles = 0;<br />

for (int i = 0; i < numberOfzEdgeParticles; i++)<br />

{<br />

particles += numberOfxEdgeParticles * numberOfyEdgeParticles;<br />

particles += (numberOfxEdgeParticles - 1) * (numberOfyEdgeParticles - 1);<br />

}<br />

System.out.println("PARTICLES : " + particles);<br />

calculateBoundaries();<br />

return particles;<br />

}<br />

else<br />

{<br />

throw new IllegalArgumentException("Suppported methods are either BCC or<br />

FCC.");<br />

}<br />

}<br />

Εδώ υπολογίζεται ο αριθµός των σωµατιδίων, ανάλογα µε το είδος της κρυσταλλικής δοµής<br />

public void createBCCGraph(Particles theParticles)<br />

{<br />

for (int i = 0; i < numberOfzEdgeParticles; i++)<br />

{<br />

double xCount = numberOfxEdgeParticles;<br />

double yCount = numberOfyEdgeParticles;<br />

double zIndex = zSpacing * i;<br />

double xCoef = (xCount - 1) / 2;<br />

double yCoef = (yCount - 1) / 2;<br />

//4 particles layer<br />

for (double x = 0; x < xCount; x++)<br />

{<br />

for (double y = 0; y < yCount; y++)<br />

{<br />

Particle p = new Particle((Integer) theParticles.getNextUserDataForParticle(),<br />

(x - xCoef) * xSpacing, (y - yCoef) * ySpacing, zIndex);<br />

p.setMass(m);<br />

theParticles.addParticle(p);<br />

}<br />

}<br />

//1 centered particle layer<br />

zIndex = zSpacing * i + zSpacing / 2;<br />

for (int x = 0; x < xCount - 1; x++)<br />

240

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!