Vinamax

A macrospin simulation tool for nanoparticles

View project onGitHub

API

Back to main

Syntax

Vinamax uses the go syntax. The program is built in such a way, that the "inputfiles" are actually the main function of a go-program. This means that apart from the functions defined in the rest of the package (e.g. Addsingleparticle) all other go functionalities are available.

This includes mathematical functions like math.Sin(), which can be useful in defining time-dependent external fields (Example 4).

What also can be useful is the functionality of defining your own variables:


	a:=1.e-5
        Run(a)
also taken from Example 4. This can of course also be used in a loop.

Godoc

The full overview of all possible functions can be found on Godoc.

Inputfiles

The inputfiles are the main functions of a go program, and should be written as such. The best way to get started is to copy one of the inputfiles from the examples page.

In the following, an overview is given of what functions MUST be called in order to make the inputfile run properly. Not doing so will result in an error message.

Variables that must get a value:


	Dt	// The timestep (in s)
	Alpha	// The damping constant
	Temp	// The temperature (in K)

Functions that must be called:

You have to define the size of the simulation


	World(x,y,z,r float64)	

//This geometry may not be empty so you have to add particles to it.
//There are 2 possibilities:
	//OR you add single particles at specified locations:
	Addsingleparticle(x,y,z float64)
	//OR you specify a cube and add uniformly distributed particles to it 
        a_cube := Cube{S:5e-7} 		//here with a side of 500 nm
        a_cube.Addparticles(100)	//In this case 100 particles
Once the particles are defined, you have to define their properties:


//Anisotropy
//IF the anisotropy constant Ku1 is defined !=0 J/m^3
//than you have to specify the anisotropy axis:
	//OR a fixed axis
	Anisotropy_axis(x,y,z float64)
	//OR a random uniform distribution of axes
	Anisotropy_random()

//Saturation magnetisation
Msat(x float64) 	//in A/m

//The size of the particles
	//OR can be fixed
	Particle_radius(x float64) //in m
	//OR can be lognormally distributed
	Lognormal_diameter(mean, stdev float64) //in m

//Also the initial magnetisation of the particles has to be specified:
	//OR a fixed direction
	M_uniform(x,y,z float64)
	//OR a random uniform distribution
	M_random()
When simulating at nonzero temperature, you also have to set the randomseed


Setrandomseed(a float64)
When the "Output" function is not called, no outputtable will be made, and when it is called it will save the average magnetisation components at the specified interval. However, when the "Tableadd" function is called, you also HAVE to specify the outputinterval.


Output(interval float64)	//in s
When using the Fast Multipole method to calculate the magnetostatic interaction (FMM= true), than you have to call Maketree() after the particles are completely defined. It is always the safest to do this as the last function before Run().


Maketree()
Finally, it is obliged to actually run the simulation.


Run(time float64)		//in s