-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'spin-torque' into dipole
- Loading branch information
Showing
20 changed files
with
1,734 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
//----------------------------------------------------------------------------- | ||
// | ||
// This header file is part of the VAMPIRE open source package under the | ||
// GNU GPL (version 2) licence (see licence file for details). | ||
// | ||
// (c) R F L Evans 2014. All rights reserved. | ||
// | ||
//----------------------------------------------------------------------------- | ||
// | ||
// Spin torque calculation is done in 'stacks'. Each stack represents a | ||
// number of microcells perpendicular to the current direction | ||
// | ||
// --------------------------- | ||
// | | | | | | | | | | | | | | | ||
// | | | | | | | | | | | | | | | ||
// | | | | | | | | | | | | | | | ||
// --------------------------- | ||
// | | | | | | | | | | | | | | | ||
// e- -> | | | | | | | | | | | | | | | ||
// | | | | | | | | | | | | | | | ||
// --------------------------- | ||
// | | | | | | | | | | | | | | | ||
// | | | | | | | | | | | | | | | ||
// | | | | | | | | | | | | | | | ||
// --------------------------- | ||
// ^ | ||
// | | ||
// Starting parameters (stack[0]) | ||
// | ||
// Spin accumulation is calculated along each stack (in parallel). The | ||
// microcells in each stack are atomically thin, and definable in size. | ||
// The code is written so that the current direction within the sample can | ||
// be chosen to be either in the x,y or z direction, and the atoms are | ||
// assigned to cells accordingly. | ||
// | ||
// The first cell in the stack contains no atoms, and is given initial | ||
// values for the spin transport parameters. | ||
// | ||
// | ||
// System headers | ||
#include <string> | ||
#include <vector> | ||
|
||
// Program headers | ||
|
||
#ifndef SPINTORQUE_H_ | ||
#define SPINTORQUE_H_ | ||
|
||
//----------------------------------------------------------------------------- | ||
// Namespace for variables and functions to calculate spin torque | ||
//----------------------------------------------------------------------------- | ||
namespace st{ | ||
|
||
//----------------------------------------------------------------------------- | ||
// Variables used for the spin torque calculation | ||
//----------------------------------------------------------------------------- | ||
|
||
//----------------------------------------------------------------------------- | ||
// Function to initialise spin torque calculation | ||
//----------------------------------------------------------------------------- | ||
void initialise(const double system_dimensions_x, | ||
const double system_dimensions_y, | ||
const double system_dimensions_z, | ||
const std::vector<double>& atom_coords_x, | ||
const std::vector<double>& atom_coords_y, | ||
const std::vector<double>& atom_coords_z, | ||
const std::vector<int>& atom_type_array, | ||
const int num_local_atoms); | ||
|
||
//----------------------------------------------------------------------------- | ||
// Function to copy spin torque fields to external field array | ||
//----------------------------------------------------------------------------- | ||
void get_spin_torque_fields(std::vector<double>& x_total_external_field_array, | ||
std::vector<double>& y_total_external_field_array, | ||
std::vector<double>& z_total_external_field_array, | ||
const int start_index, | ||
const int end_index); | ||
|
||
//----------------------------------------------------------------------------- | ||
// Function for updating spin torque fields | ||
//----------------------------------------------------------------------------- | ||
void update_spin_torque_fields(const std::vector<double>& x_spin_array, | ||
const std::vector<double>& y_spin_array, | ||
const std::vector<double>& z_spin_array, | ||
const std::vector<int>& atom_type_array, | ||
const std::vector<double>& mu_s_array); | ||
|
||
//----------------------------------------------------------------------------- | ||
// Function for matching spin torque material parameters | ||
//----------------------------------------------------------------------------- | ||
bool match_material(std::string const word, std::string const value, std::string const unit, int const line, int const super_index); | ||
bool match_input_parameter(std::string const key, std::string const word, std::string const value, std::string const unit, int const line); | ||
|
||
|
||
} // end of st namespace | ||
|
||
#endif // SPINTORQUE_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,18 +6,18 @@ | |
// | ||
// Email:[email protected] | ||
// | ||
// This program is free software; you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation; either version 2 of the License, or | ||
// This program is free software; you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation; either version 2 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, but | ||
// WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
// This program is distributed in the hope that it will be useful, but | ||
// WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
// General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program; if not, write to the Free Software Foundation, | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program; if not, write to the Free Software Foundation, | ||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | ||
// | ||
// ---------------------------------------------------------------------------- | ||
|
@@ -29,7 +29,7 @@ | |
/// @details The LLG integrator... | ||
/// | ||
/// @section notes Implementation Notes | ||
/// This is a list of other notes, not related to functionality but rather to implementation. | ||
/// This is a list of other notes, not related to functionality but rather to implementation. | ||
/// Also include references, formulae and other notes here. | ||
/// | ||
/// @section License | ||
|
@@ -62,33 +62,33 @@ int calculate_spin_fields(const int,const int); | |
int calculate_external_fields(const int,const int); | ||
|
||
namespace LLG_arrays{ | ||
|
||
// Local arrays for LLG integration | ||
std::vector <double> x_euler_array; | ||
std::vector <double> y_euler_array; | ||
std::vector <double> y_euler_array; | ||
std::vector <double> z_euler_array; | ||
|
||
std::vector <double> x_heun_array; | ||
std::vector <double> y_heun_array; | ||
std::vector <double> x_heun_array; | ||
std::vector <double> y_heun_array; | ||
std::vector <double> z_heun_array; | ||
|
||
std::vector <double> x_spin_storage_array; | ||
std::vector <double> y_spin_storage_array; | ||
std::vector <double> x_spin_storage_array; | ||
std::vector <double> y_spin_storage_array; | ||
std::vector <double> z_spin_storage_array; | ||
|
||
std::vector <double> x_initial_spin_array; | ||
std::vector <double> y_initial_spin_array; | ||
std::vector <double> x_initial_spin_array; | ||
std::vector <double> y_initial_spin_array; | ||
std::vector <double> z_initial_spin_array; | ||
|
||
bool LLG_set=false; ///< Flag to define state of LLG arrays (initialised/uninitialised) | ||
|
||
} | ||
|
||
namespace sim{ | ||
|
||
/// @brief LLG Initialisation function | ||
/// | ||
/// @details Resizes arrays used for Heun integration | ||
/// @details Resizes arrays used for Heun integration | ||
/// | ||
/// @section License | ||
/// Use of this code, either in source or compiled form, is subject to license from the authors. | ||
|
@@ -100,14 +100,14 @@ namespace sim{ | |
/// @date 07/02/2011 | ||
/// | ||
/// @return EXIT_SUCCESS | ||
/// | ||
/// | ||
/// @internal | ||
/// Created: 07/02/2011 | ||
/// Revision: --- | ||
///===================================================================================== | ||
/// | ||
int LLGinit(){ | ||
|
||
// check calling of routine if error checking is activated | ||
if(err::check==true){std::cout << "sim::LLG_init has been called" << std::endl;} | ||
|
||
|
@@ -139,7 +139,7 @@ int LLGinit(){ | |
/// @callgraph | ||
/// @callergraph | ||
/// | ||
/// @details Integrates the system using the LLG and Heun solver | ||
/// @details Integrates the system using the LLG and Heun solver | ||
/// | ||
/// @section License | ||
/// Use of this code, either in source or compiled form, is subject to license from the authors. | ||
|
@@ -151,7 +151,7 @@ int LLGinit(){ | |
/// @date 07/02/2011 | ||
/// | ||
/// @return EXIT_SUCCESS | ||
/// | ||
/// | ||
/// @internal | ||
/// Created: 05/02/2011 | ||
/// Revision: --- | ||
|
@@ -166,14 +166,14 @@ int LLG_Heun(){ | |
|
||
// Check for initialisation of LLG integration arrays | ||
if(LLG_set==false) sim::LLGinit(); | ||
|
||
// Local variables for system integration | ||
const int num_atoms=atoms::num_atoms; | ||
double xyz[3]; // Local Delta Spin Components | ||
double S_new[3]; // New Local Spin Moment | ||
double mod_S; // magnitude of spin moment | ||
double mod_S; // magnitude of spin moment | ||
|
||
// Store initial spin positions | ||
// Store initial spin positions | ||
for(int atom=0;atom<num_atoms;atom++){ | ||
x_initial_spin_array[atom] = atoms::x_spin_array[atom]; | ||
y_initial_spin_array[atom] = atoms::y_spin_array[atom]; | ||
|
@@ -183,7 +183,7 @@ int LLG_Heun(){ | |
// Calculate fields | ||
calculate_spin_fields(0,num_atoms); | ||
calculate_external_fields(0,num_atoms); | ||
|
||
// Calculate Euler Step | ||
for(int atom=0;atom<num_atoms;atom++){ | ||
|
||
|
@@ -211,30 +211,30 @@ int LLG_Heun(){ | |
S_new[0]=S[0]+xyz[0]*mp::dt; | ||
S_new[1]=S[1]+xyz[1]*mp::dt; | ||
S_new[2]=S[2]+xyz[2]*mp::dt; | ||
|
||
// Normalise Spin Length | ||
mod_S = 1.0/sqrt(S_new[0]*S_new[0] + S_new[1]*S_new[1] + S_new[2]*S_new[2]); | ||
|
||
S_new[0]=S_new[0]*mod_S; | ||
S_new[1]=S_new[1]*mod_S; | ||
S_new[2]=S_new[2]*mod_S; | ||
|
||
//Writing of Spin Values to Storage Array | ||
x_spin_storage_array[atom]=S_new[0]; | ||
y_spin_storage_array[atom]=S_new[1]; | ||
z_spin_storage_array[atom]=S_new[2]; | ||
z_spin_storage_array[atom]=S_new[2]; | ||
} | ||
|
||
// Copy new spins to spin array | ||
for(int atom=0;atom<num_atoms;atom++){ | ||
atoms::x_spin_array[atom]=x_spin_storage_array[atom]; | ||
atoms::y_spin_array[atom]=y_spin_storage_array[atom]; | ||
atoms::z_spin_array[atom]=z_spin_storage_array[atom]; | ||
} | ||
|
||
// Recalculate spin dependent fields | ||
calculate_spin_fields(0,num_atoms); | ||
|
||
// Calculate Heun Gradients | ||
for(int atom=0;atom<num_atoms;atom++){ | ||
|
||
|
@@ -264,10 +264,10 @@ int LLG_Heun(){ | |
S_new[0]=x_initial_spin_array[atom]+mp::half_dt*(x_euler_array[atom]+x_heun_array[atom]); | ||
S_new[1]=y_initial_spin_array[atom]+mp::half_dt*(y_euler_array[atom]+y_heun_array[atom]); | ||
S_new[2]=z_initial_spin_array[atom]+mp::half_dt*(z_euler_array[atom]+z_heun_array[atom]); | ||
|
||
// Normalise Spin Length | ||
mod_S = 1.0/sqrt(S_new[0]*S_new[0] + S_new[1]*S_new[1] + S_new[2]*S_new[2]); | ||
|
||
S_new[0]=S_new[0]*mod_S; | ||
S_new[1]=S_new[1]*mod_S; | ||
S_new[2]=S_new[2]*mod_S; | ||
|
@@ -286,7 +286,7 @@ int LLG_Heun(){ | |
/// @callgraph | ||
/// @callergraph | ||
/// | ||
/// @details Integrates the system using the LLG and Heun solver | ||
/// @details Integrates the system using the LLG and Heun solver | ||
/// | ||
/// @section License | ||
/// Use of this code, either in source or compiled form, is subject to license from the authors. | ||
|
@@ -298,15 +298,15 @@ int LLG_Heun(){ | |
/// @date 05/02/2011 | ||
/// | ||
/// @return EXIT_SUCCESS | ||
/// | ||
/// | ||
/// @internal | ||
/// Created: 05/02/2011 | ||
/// Revision: --- | ||
///===================================================================================== | ||
/// | ||
int LLG_Heun_cuda(){ | ||
|
||
|
||
return EXIT_SUCCESS; | ||
} | ||
|
||
|
Oops, something went wrong.