-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsketch.js
More file actions
41 lines (32 loc) · 819 Bytes
/
sketch.js
File metadata and controls
41 lines (32 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* Ising simulation example of a temperature sweep on a 100x100 spin lattice */
// Display options:
const CANVAS_WIDTH = 900;
const CANVAS_HEIGHT = 600;
const FRAME_RATE = 20;
// Simulation parameters:
var isingSettings = {
width: 100,
height: 100,
mcStepsPerFrame: 10000,
averagingFrames: 20,
randomizeLattice: true,
temperature: 4,
magneticField: 0,
loopMode: 'TSWEEP',
loopIncrement: -0.05,
loopTargetValue: 1,
imageFile: null,
dataFile: 'simulationData'
}
var ferromagnet;
// Create canvas and Ising-simulation object:
function setup() {
frameRate(FRAME_RATE);
createCanvas(CANVAS_WIDTH, CANVAS_HEIGHT);
background(0);
ferromagnet = new Ising(isingSettings);
}
// Draw loop:
function draw() {
ferromagnet.simulationStep();
}