You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In light of the fact that a scripting language like ChaiScript could easily be embedded in Spirit, it may make sense to transform the current input file into an input script and C API into a scripting API.
In this context, note also #105, #421 and ChaiScript/ChaiScript#552.
Unfortunately, ChaiScript does not support nested namespaces, so that we cannot structure things like a Python module.
If callback functions are registered through a script, e.g. for time-dependent magnetic field, this may have significant performance-implications and the best way to do this should definitely be researched beforehand.
Input file replacement
Everything that can currently be set via the input file could instead be set by a corresponding function call in a script.
This could allow for great flexibility and easy creation of complex systems. One could even insert pre-calculation steps, such as creating a suitable initial path for a GNEB calculation or converging a system for which one wants to visualise eigenmodes.
Additionally, the Desktop GUI could provide a script input window, with which any repetitive task could be automated directly in the GUI, avoiding the detour to Python. Using the CLI-version of Spirit, no additional installation would be necessary to script a calculation (though Python is of course more powerful)
API replacement
The C API could probably be entirely replaced by very few functions, accepting strings as input. This API could still be used to wrap functionality of the scripting API, if necessary (though even in JS it would be easier to only wrap one C function which is passed a corresponding script string).
Examples (assuming ChaiScript as scripting language)
Using mathematical functions
(the scripting environment can be configured to automatically include basic math functions)
var t = sin( 3.14 );
Using physical constants
(unfortunately, ChaiScript does not have nested namespaces with which to represent the multiple unit systems)
puts( "mu_B = " );
print( constants.mu_B );
General Settings and Log
log.set_level( log.warning );
log.send( log.warning, "I want this message to appear in the log" );
Geometry
(could now be generated from arbitrary, scripted positions)
// Add some atoms to the basis cell, there is always 1 atom at (0,0,0)
var factor = 1.0/3.0 * sqrt( 2.0 );
geometry.add_atom( factor, 2*factor, 0.0 );
geometry.add_atom( 2*factor, factor, 0.0 );
geometry.set_n_cells( 100, 100, 1 );
Heisenberg Hamiltonian
(could now include time- and space-dependent field, and space-dependent parameters)
// Set a time-dependent external magnetic field
hamiltonian_heisenberg.set_dynamic_field(fun(x, y, z, t) {
returnsin(t);
});
// Add some Exchange pairs
hamiltonian_heisenberg.add_exchange_pair( {0, 0, 1, 0, 0}, 3.0 );
hamiltonian_heisenberg.add_exchange_pair( {0, 0, 0, 1, 0}, 3.0 );
// Add some DMI pairs
hamiltonian_heisenberg.add_dmi_pair( {0, 0, 1, 0, 0}, 1.5, {1.0, 0.0, 0.0} );
hamiltonian_heisenberg.add_dmi_pair( {0, 0, 0, 1, 0}, 1.5, {0.0, 1.0, 0.0} );
Gaussian Hamiltonian
Method Output
Method Parameters
(could now include better time- and space-dependent temperature and spin current)
Pinning
Disorder and Defects
(could now include defect clusters)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In light of the fact that a scripting language like ChaiScript could easily be embedded in Spirit, it may make sense to transform the current input file into an input script and C API into a scripting API.
In this context, note also #105, #421 and ChaiScript/ChaiScript#552.
Unfortunately, ChaiScript does not support nested namespaces, so that we cannot structure things like a Python module.
If callback functions are registered through a script, e.g. for time-dependent magnetic field, this may have significant performance-implications and the best way to do this should definitely be researched beforehand.
Input file replacement
Everything that can currently be set via the input file could instead be set by a corresponding function call in a script.
This could allow for great flexibility and easy creation of complex systems. One could even insert pre-calculation steps, such as creating a suitable initial path for a GNEB calculation or converging a system for which one wants to visualise eigenmodes.
Additionally, the Desktop GUI could provide a script input window, with which any repetitive task could be automated directly in the GUI, avoiding the detour to Python. Using the CLI-version of Spirit, no additional installation would be necessary to script a calculation (though Python is of course more powerful)
API replacement
The C API could probably be entirely replaced by very few functions, accepting strings as input. This API could still be used to wrap functionality of the scripting API, if necessary (though even in JS it would be easier to only wrap one C function which is passed a corresponding script string).
Examples (assuming ChaiScript as scripting language)
Using mathematical functions
(the scripting environment can be configured to automatically include basic math functions)
var t = sin( 3.14 );
Using physical constants
(unfortunately, ChaiScript does not have nested namespaces with which to represent the multiple unit systems)
General Settings and Log
log.set_level( log.warning ); log.send( log.warning, "I want this message to appear in the log" );
Geometry
(could now be generated from arbitrary, scripted positions)
Heisenberg Hamiltonian
(could now include time- and space-dependent field, and space-dependent parameters)
Gaussian Hamiltonian
Method Output
Method Parameters
(could now include better time- and space-dependent temperature and spin current)
Pinning
Disorder and Defects
(could now include defect clusters)
Beta Was this translation helpful? Give feedback.
All reactions