NetLogo banner

NetLogo Publications
Contact Us

Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Farsi / Persian


NetLogo User Community Models

(back to the NetLogo User Community Models)

[no screen shot for this model]

If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".

Try It in NetLogo Web


This is a modified version of the original NetLogo Ising model was implemented to support the following publication Katarzyna Sznajd-Weron, Arkadiusz Jedrzejewski, Barbara Kaminska (2023), "Towards understanding of the social hysteresis---insights from agent-based modeling", submitted to Perspectives on Psychological Science.

The original implementation can be found in the Models Library:
* Wilensky, U. (2003). NetLogo Ising model. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

The modification is to include the external field. To boil down the model to the original implementation by Wilensky, U. (2003). keep field = 0. Since this version was prepared for psycho-social applications, we will mainly use social science terminology here. For those interested in physics, we recommend the description in Wilensky, U. (2003). NetLogo Ising model.

The Ising model was originally proposed in 1920 by Wilhelm Lenz to understand the order-disorder phase transition between ferromagnetic and paramagnetic states. It was then solved in one dimension by his graduate student Ernst Ising, hence the name. More information can be found at

The model can also be treated as a simple agent-based model of opinion/belief/attitude dynamics and will be described as such below.


Each cell on the grid is occupied by exactly one agent, described by a single variable representing the agent's opinion, belief, etc. The opinion is binary, i.e. the agent can be in one of two states +1 (yes, agree, adopted, etc.) or -1 (no, disagree, not adopted etc.). In our implementation +1 is green and -1 is red.

Agents interact with each other and with the external field. Interaction between agents is limited to nearest neighbors, i.e. each agent interacts only with 4 other agents placed in adjacent cells. All mutual interactions are of the conformist type, i.e. the agent wants to be in the same state as its nearest neighbors. The more neighbors are in the same state, the stronger the social influence. This means that if, for example, three of the four neighbors are in the +1 state, they will affect the middle agent less than if all four are in the +1 state.

In addition to its neighbors, each agent is influenced by an external field. The external field is described by a continuous variable that takes both positive and negative values. If the field is positive, then the agent will try to adopt a +1 state by interacting with the field. If the field is negative, the agent will try to adopt a -1 state. The larger the absolute value of the field, the stronger its influence.

Of course, it can happen that the influence of the environment causes the agent to take the +1 state and the field to take the opposite state. The competition between these two sources of influence can lead to so-called hysteresis, i.e. the dependence of the state of a system on its history. In addition to interactions with neighbors and the field, there is also randomness associated with the temperature of the system. From a social point of view, temperature can be seen as describing the degree of independence of the agents (resistance to social influence and the field). When the temperature is high, the agents adopt a random state, independent of neighbors and a field. The competition between interactions and temperature leads to the order-disorder phase transition.

The exact definition of the model requires the introduction of the so-called Hamiltonian and the Metropolis algorithm, but here we give only a qualitative, intuitive description. However, the detailed algorithm can be seen in the code of this implementation.


Choose a field with the "field" slider and a temperature with the "temperature" slider, then press SETUP to set up the grid and give each spin a random initial state. You can control the initial fraction of agents in state +1 by using the PROBABILITY-OF-SPIN-UP slider. If you want all agents to be +1, set that slider to 100%. If you want all agents to be -1, set it at 0%, and so on. Then press GO to watch the model run.

You can move the TEMPERATURE slider as the model runs if you want.

The magnetization of the system is the average (mean) of all the spins, so from the social point of view it represents some agregated behavioral variable, such an average opinion, etc.


1) In the default settings for the model probability-of-spin-up = 0%, temperature = 1.3 and field = 0.5. With these settings, you should see the formation of small clusters in the direction of the field, which then grow until the whole system is aligned with the field.

2) Now keep temperature = 1.3 and field = 0.5 but change the initial state of the system by setting probability-of-spin-up = 50%. What do you observe?

Please cite the NetLogo software as:

Katarzyna Sznajd-Weron, Arkadiusz Jedrzejewski, Barbara Kaminska (2023), "Towards understanding of the social hysteresis---insights from agent-based modeling". The citation will be updated when the paper is published.

(back to the NetLogo User Community Models)