Running the program

Running with default configurations can be achieved by running the below in a terminal:

mango

This will run the program with the default values shown in the input file. See further examples in Examples. If not specified, the positions of the molecules will be the stable Leonard Jones configuration downloaded from http://doye.chem.ox.ac.uk/jon/structures/LJ/

Other commandline functions include:

MPI calculation command:

mango_mpi

Running the mango test suite:

mango_test

Restart and input file regenerators:

mango_inputregen
mango_restartregen

The rest have their own help with -h:

mango_plotsuscep
mango_strings
mango_vars
mango_vis

Jupyter Notebook or Module use

There are currently two functions designed for use as a module import or as part of a jupyter notebook and they are:

mango.run()
mango.help()

Run takes a dictionary as input with the keys and values the same as the input file. To run a simple simulation a python script would be;

import mango
mango.run({'SusceptibilityCalc': True, 'Iterations': 100000,
         'Repetitions': 1, 'NumberParticles': 5,
         'PositionFile': './Position_file'})

Help prints the help shown below.

Running with an Input or Restarting

To use an input file:

-I Inputfile

To restart a run, specify the restart file as shown:

-R Run1restart

Saving Mechanism

Saving happens in two stages when running the main calculation as shown below. This reduces the amount of I/O to disk.

There are a two commands to deal with the saving. These are SkipSave (–skip) and SaveChunk (–savechunk). SkipSave deals with the number of iterations that are saved to memory and SaveChunk is the number of saved iterations to be collected before writing to disk.

_images/SavingMechanism.svg

Errors

Errors are split into 2 categories, warning and critical. The program will still run under warnings but it will kill itself under critical errors.

Warning messages will be written like so:

Warning: maximum number of iterations exceeded! [MD step 1] x10

The above message tells us that the error has happened 10 times on the first MD step.

Internal Help

To print the help from the commandline use the command mango -h, to print the input file help from the commandline use mango -ifh or call mango.help() from an interactive prompt. For the full input file see Full Input File. The commandline help is shown below.

___  ___  ___   _   _  _____  _____ 
|  \/  | / _ \ | \ | ||  __ \|  _  |
| .  . |/ /_\ \|  \| || |  \/| | | |
| |\/| ||  _  || . ` || | __ | | | |
| |  | || | | || |\  || |_\ \\ \_/ /
\_|  |_/\_| |_/\_| \_/ \____/ \___/ 
Version: 0.8.0-g_616c94e

usage: mango [-h] [-I INPUTFILE] [-R RESTART] [-P LOCATION] [-nu NU] [-f H_0]
             [-e ETA] [-Mdens MDENS] [-dn DENS [DENS ...]]
             [-rad RADIUS [RADIUS ...]] [-T TEMP] [--no-noise]
             [-bx BOXSIZE [BOXSIZE ...]] [--epsilon EPSILON] [-n NMAX]
             [--no-labview] [--no-mag] [-np NO_MOLECULES] [--opt] [--no-pbc]
             [--potential POTENTIAL] [-st STATS] [-sk SKIP]
             [--suscep [{mag,vel,angular,inertia,rotation,} [{mag,vel,angular,inertia,rotation,} ...]]]
             [--op_thermal] [-dt DT] [--align] [--bl BLOCK [BLOCK ...]]
             [--cfile {xyz,energy,momenta,lf} [{xyz,energy,momenta,lf} ...]]
             [-eq EQ] [--column COLUMN [COLUMN ...]] [--run RUN] [--kinetic]
             [--lengthcheck] [--showg] [--saveg] [--ufile UFILE] [--logs LOGS]
             [--no-parallel] [-sv SAVECHUNK] [--save_type {hdf5,pkl,txt}]
             [--scfiter SCFITER] [--walltime WALLTIME] [-v] [--neel] [-k KEFF]
             [--tauN_0 TAUN_0] [--temp0 TEMP0]

Mango: magnetic nanoparticle simulator CLI Help

optional arguments:
  -h, --help            show this help message and exit
  -I INPUTFILE          Input file location
  -R RESTART            Restart file location
  -P LOCATION           Positions file location
  -nu NU                External Field Frequency
                        (default: 1.00e-06[Hz])
  -f, --field H_0       External Field Strength
                        (default: 167.0[1e-6 Gauss])
  -e, --eta ETA         Solvent Viscosity
                        (default: 0.01002 [g/(cm *s)])
  -Mdens MDENS          Magnetic Density of particles
                        (default 85 [emu/g])
  -dn, --dens [DENS ...]
                        Density of each particle
                        (default: 6.99[g /cm^3])
  -rad, --radius [RADIUS ...]
                        Radius of each particle
                        (default: 5.0[1e-6cm])
  -T, --temp TEMP       Temperature
                        (default: 298.0[K])
  --no-noise            Background Noise switch
                        (default: True)
  -bx, --boxsize [BOXSIZE ...]
                        Periodic boundary box size
                        (default: max of (1.1 * Number of Molecules * Radius) or 50[1e-6cm])
  --epsilon EPSILON     Set depth of Potential Well
                        (default: Scales wrt Ar (isothermal compresibility))
  -n, --nmax NMAX       Number of Iterations
                        (default: 400.0)
  --no-labview          Remove initial cluster momentum
                        (default: True)
  --no-mag              Magnetisation calculation switch
                        (default: True)
  -np, --no_particles NO_MOLECULES
                        Number of Particles
                        (default: 5)
  --opt                 Auto-minimise energy of the system
                        (default: False)
  --no-pbc              Periodic Boundary Conditions
                        (default: True)
  --potential POTENTIAL
                        Change potential used
  -st, --stats STATS    Number of statistical repetitions
                        (default: 10)
  -sk, --skip SKIP      Save every # iterations
                        (default: 1)
  --suscep [{mag,vel,angular,inertia,rotation,} ...]
                        Zero field Calculation
                        (default: False)
  --op_thermal          Add thermal noise to the momentum after the optimisation
                        (default: False)
  -dt DT                Timestep
                        (default: 20[ps])
  --align               Align with Kabsch algorithm
                        (default: False)
  --bl [BLOCK ...]      Block averaging bins
                        (default: [5, 10, 20, 50, 100])
  --cfile [{xyz,energy,momenta,lf} ...]
                        Create output files
                        (default: False)
  -eq EQ                Strip fraction of trajectory for equilibration
                        (default: 0.1)
  --column [COLUMN ...]
                        Plot simple datasets
  --run RUN             Select run number
                        (default: False)
  --kinetic             Calculate kinetic temperature
                        (default: False)
  --lengthcheck         Calculate average particle separation
                        (default: False)
  --showg               Show graphs during run
                        (default: False)
  --saveg               Save graphs
                        WARNING: slow for large datasets
                        (default: False)
  --ufile UFILE         Post process from a specific file
  --logs LOGS           Log save directory
                        (default:./Mango_0.8.0-g_616c94e_Logs)
  --no-parallel         Parallel Computation
                        (default: True)
  -sv, --savechunk SAVECHUNK
                        Save to file every # iterations
                        (default: Smallest of 1e+04 and Nmax)
  --save_type {hdf5,pkl,txt}
                        Save filetype (hdf5, pkl, txt)
                        (default: hdf5)
  --scfiter SCFITER     Magnetic self consistancy loop before warning
                        (default: 20)
  --walltime WALLTIME   Run time
                        (default: 1e+07[s])
  -v, --verbosity       Verbosity level
                        (default: 2, Max implemented: 5)
  --neel                Enable Neel relaxations
                        (default: False)
  -k, --keff KEFF       Set anisotropic factor
                        (default: 2.25e-08[erg*cm3])
  --tauN_0 TAUN_0       Zero value for τn
                        (default: 1.70e+00[1.e-12 s])
  --temp0 TEMP0         Neel zero temperature
                        (default: 2.62e+02[K])