Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update doxygen comments #43

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,10 @@ dkms.conf
# Machine-specific Configuration File
make.sys

.idea/
.vscode/
cmake-build-debug/
.DS_Store

# Build Output
build/
60 changes: 58 additions & 2 deletions src/ChainLattice.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,36 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/**
@brief Setup a Hamiltonian for the Hubbard model on a Chain lattice
@author Mitsuaki Kawamura (The University of Tokyo)

@details This function sets up the Hamiltonian for a 1D chain lattice model.
It handles three different model types:
- Spin model
- Hubbard model
- Kondo model

The function performs the following steps:
1. Computes super-cell shape and sites
2. Validates and stores Hamiltonian parameters
3. Sets local spin flags and number of sites
4. Allocates memory for interactions
5. Sets up transfers and interactions between sites

@param[in,out] StdI Pointer to structure containing model parameters and lattice information

@note The function supports:
- Nearest neighbor interactions (J0, t0, V0)
- Second nearest neighbor interactions (J0', t0', V0')
- Third nearest neighbor interactions (J0'', t0'', V0'')
- Local terms (magnetic field h, anisotropy Gamma)
- On-site Coulomb interaction U (for Hubbard model)
- Kondo coupling J (for Kondo model)

@note The lattice geometry is written to lattice.gp file for visualization

@warning For Kondo model, the number of sites is doubled to account for localized spins
*/
void StdFace_Chain(
struct StdIntList *StdI//!<[inout]
struct StdIntList *StdI //!<[inout] Structure containing model parameters and lattice information
)
{
FILE *fp = NULL;
Expand Down Expand Up @@ -238,11 +265,29 @@ void StdFace_Chain(
#endif
StdFace_PrintGeometry(StdI);
}/*void StdFace_Chain*/

#if defined(_HPhi)
/**
@brief Setup a Hamiltonian for the generalized Heisenberg model on a Chain lattice
@author Mitsuaki Kawamura (The University of Tokyo)

@details This function sets up a specialized Hamiltonian for the Heisenberg model on a chain lattice
using the HPhi boost mode. It handles:
- Magnetic field terms
- Nearest and next-nearest neighbor interactions
- Specialized 6-spin interactions

The function performs:
1. Sets up unit cell and lattice parameters
2. Writes magnetic field configuration
3. Writes interaction parameters
4. Sets up topology and pivot sites
5. Configures 6-spin interaction lists

@param[in,out] StdI Pointer to structure containing model parameters

@warning
- S2 must be 1 in Boost mode
- L must be divisible by 8
*/
void StdFace_Chain_Boost(struct StdIntList *StdI)
{
Expand Down Expand Up @@ -327,6 +372,17 @@ void StdFace_Chain_Boost(struct StdIntList *StdI)
}
}

/*
* Initialize the list_6spin_pair array which defines the spin interactions
* For each pivot point:
* - First 6 rows (indices 0-5) specify which spins are involved in each interaction
* - Last row (index 6) specifies the type of interaction (1 or 2)
* - Each column represents one interaction, with 8 total interactions per pivot
*
* The interactions are arranged in groups:
* - Interactions 0-3: Type 1 interactions between adjacent spins
* - Interactions 4-7: Type 2 interactions between next-nearest neighbors
*/
for (ipivot = 0; ipivot < StdI->num_pivot; ipivot++) {
StdI->list_6spin_pair[ipivot][0][0] = 0;
StdI->list_6spin_pair[ipivot][1][0] = 1;
Expand Down
77 changes: 58 additions & 19 deletions src/FCOrtho.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <string.h>

/**
@brief Setup a Hamiltonian for the Face-Centered Orthorhombic lattice
@author Mitsuaki Kawamura (The University of Tokyo)
*/
* @brief Setup a Hamiltonian for the Face-Centered Orthorhombic lattice
* @author Mitsuaki Kawamura (The University of Tokyo)
*
* This function sets up the Hamiltonian for a face-centered orthorhombic lattice.
* The lattice has three primitive vectors:
* - W vector: (0, L/2, H/2)
* - L vector: (W/2, 0, H/2)
* - H vector: (W/2, L/2, 0)
* where W, L, H are the lengths in each direction.
*
* The function handles three models:
* - Spin model: Heisenberg interactions between localized spins
* - Hubbard model: Hopping and Coulomb interactions between itinerant electrons
* - Kondo model: Coupling between localized spins and itinerant electrons
*
* @param StdI [inout] Structure containing model parameters and lattice information
* Modified to store the complete Hamiltonian definition
*/
void StdFace_FCOrtho(
struct StdIntList *StdI//!<[inout]
)
Expand All @@ -40,9 +55,14 @@ void StdFace_FCOrtho(
double complex Cphase;
double dR[3];

/**@brief
(1) Compute the shape of the super-cell and sites in the super-cell
*/
/**
* @brief Step 1: Compute the shape of the super-cell and sites in the super-cell
*
* - Opens XSF file for visualization
* - Sets number of sites per unit cell (1 for FCO)
* - Defines lattice parameters and primitive vectors
* - Initializes site positions
*/
fp = fopen("lattice.xsf", "w");
/**/
StdI->NsiteUC = 1;
Expand All @@ -69,9 +89,14 @@ void StdFace_FCOrtho(
/**/
StdFace_InitSite(StdI, fp, 3);
StdI->tau[0][0] = 0.0; StdI->tau[0][1] = 0.0; ; StdI->tau[0][2] = 0.0;
/**@brief
(2) check & store parameters of Hamiltonian
*/
/**
* @brief Step 2: Check and store Hamiltonian parameters
*
* Handles different parameters depending on model type:
* - Spin model: J (exchange), D (anisotropy), magnetic field
* - Hubbard model: t (hopping), U (on-site), V (inter-site)
* - Kondo model: Combination of spin and Hubbard parameters
*/
fprintf(stdout, "\n @ Hamiltonian \n\n");
StdFace_NotUsed_d("K", StdI->K);
StdFace_PrintVal_d("h", &StdI->h, 0.0);
Expand Down Expand Up @@ -143,10 +168,13 @@ void StdFace_FCOrtho(

}/*if (model != "spin")*/
fprintf(stdout, "\n @ Numerical conditions\n\n");
/**@brief
(3) Set local spin flag (StdIntList::locspinflag) and
the number of sites (StdIntList::nsite)
*/
/**
* @brief Step 3: Set local spin flags and number of sites
*
* - Calculates total number of sites
* - Allocates and initializes local spin flags array
* - Handles different site counts for Kondo model
*/
StdI->nsite = StdI->NsiteUC * StdI->NCell;
if (strcmp(StdI->model, "kondo") == 0 ) StdI->nsite *= 2;
StdI->locspinflag = (int *)malloc(sizeof(int) * StdI->nsite);
Expand All @@ -160,9 +188,14 @@ void StdFace_FCOrtho(
StdI->locspinflag[iL] = StdI->S2;
StdI->locspinflag[iL + StdI->nsite / 2] = 0;
}
/**@brief
(4) Compute the upper limit of the number of Transfer & Interaction and malloc them.
*/
/**
* @brief Step 4: Calculate memory requirements and allocate arrays
*
* Computes upper bounds for:
* - Number of transfer terms (hopping/field terms)
* - Number of interaction terms (exchange/Coulomb terms)
* Different calculations done for each model type
*/
if (strcmp(StdI->model, "spin") == 0 ) {
ntransMax = StdI->nsite * (StdI->S2 + 1/*h*/ + 2 * StdI->S2/*Gamma*/);
nintrMax = StdI->NCell * (StdI->NsiteUC/*D*/ + 6/*J*/ + 3/*J'*/ + 0/*J''*/)
Expand All @@ -179,9 +212,15 @@ void StdFace_FCOrtho(
}
/**/
StdFace_MallocInteractions(StdI, ntransMax, nintrMax);
/**@brief
(5) Set Transfer & Interaction
*/
/**
* @brief Step 5: Set up all interactions in the Hamiltonian
*
* Loops over all unit cells and sets up:
* - Local terms (on-site U, magnetic field)
* - Nearest neighbor terms along W, L, H directions
* - Second nearest neighbor terms
* Different terms added depending on model type
*/
for (kCell = 0; kCell < StdI->NCell; kCell++){
/**/
iW = StdI->Cell[kCell][0];
Expand Down
121 changes: 83 additions & 38 deletions src/HoneycombLattice.c
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
/*
HPhi-mVMC-StdFace - Common input generator
Copyright (C) 2015 The University of Tokyo

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 3 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 General Public License for more details.
/**
* @file HoneycombLattice.c
* @brief Implementation of the honeycomb lattice model
* @copyright Copyright (C) 2015 The University of Tokyo
*
* 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 3 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**@file
@brief Standard mode for the honeycomb lattice
*/
/**
* @brief Standard mode for the honeycomb lattice
* @details This file implements the honeycomb lattice model with various interactions:
* - Hubbard model
* - Heisenberg model
* - Kondo lattice model
* The lattice has 2 sites per unit cell and supports:
* - Nearest neighbor hopping/exchange
* - Next nearest neighbor hopping/exchange
* - Third nearest neighbor hopping/exchange
* - On-site Coulomb interaction
* - Magnetic field
*/
#include "StdFace_vals.h"
#include "StdFace_ModelUtil.h"
#include <stdlib.h>
Expand All @@ -27,9 +39,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <string.h>

/**
@brief Setup a Hamiltonian for the Hubbard model on a Honeycomb lattice
@author Mitsuaki Kawamura (The University of Tokyo)
*/
* @brief Setup a Hamiltonian for the Hubbard/Heisenberg/Kondo model on a Honeycomb lattice
* @details This function:
* 1. Computes the shape of the super-cell and sites in the super-cell
* 2. Checks & stores parameters of the Hamiltonian
* 3. Sets local spin flags and number of sites
* 4. Computes upper limits for transfers and interactions
* 5. Sets up transfers and interactions between sites
*
* @param[in,out] StdI Pointer to structure containing model parameters
* @author Mitsuaki Kawamura (The University of Tokyo)
*/
void StdFace_Honeycomb(struct StdIntList *StdI)
{
int isite, jsite, kCell, ntransMax, nintrMax;
Expand All @@ -38,9 +58,13 @@ void StdFace_Honeycomb(struct StdIntList *StdI)
double complex Cphase;
double dR[3];

/**@brief
(1) Compute the shape of the super-cell and sites in the super-cell
*/
/**
* @brief (1) Compute the shape of the super-cell and sites in the super-cell
* @details Sets up:
* - Lattice vectors
* - Unit cell with 2 sites
* - Site positions within unit cell
*/
#ifdef _HWAVE
if (StdI->lattice_gp == 1)
#endif
Expand All @@ -64,9 +88,16 @@ void StdFace_Honeycomb(struct StdIntList *StdI)
StdFace_InitSite(StdI, fp, 2);
StdI->tau[0][0] = 0.0; StdI->tau[0][1] = 0.0; StdI->tau[0][2] = 0.0;
StdI->tau[1][0] = 1.0 / 3.0; StdI->tau[1][1] = 1.0 / 3.0; StdI->tau[1][2] = 0.0;
/**@brief
(2) check & store parameters of Hamiltonian
*/

/**
* @brief (2) Check & store parameters of Hamiltonian
* @details Handles parameters for:
* - Magnetic field
* - Exchange couplings (spin model)
* - Hopping terms (Hubbard model)
* - On-site Coulomb U
* - Inter-site Coulomb V
*/
fprintf(stdout, "\n @ Hamiltonian \n\n");
StdFace_NotUsed_d("K", StdI->K);
StdFace_PrintVal_d("h", &StdI->h, 0.0);
Expand Down Expand Up @@ -145,10 +176,13 @@ void StdFace_Honeycomb(struct StdIntList *StdI)

}/*if (model != "spin")*/
fprintf(stdout, "\n @ Numerical conditions\n\n");
/**@brief
(3) Set local spin flag (StdIntList::locspinflag) and
the number of sites (StdIntList::nsite)
*/

/**
* @brief (3) Set local spin flag and number of sites
* @details Sets:
* - Total number of sites
* - Local spin flags for each site
*/
StdI->nsite = StdI->NsiteUC * StdI->NCell;
if (strcmp(StdI->model, "kondo") == 0 ) StdI->nsite *= 2;
StdI->locspinflag = (int *)malloc(sizeof(int) * StdI->nsite);
Expand All @@ -162,9 +196,14 @@ void StdFace_Honeycomb(struct StdIntList *StdI)
StdI->locspinflag[iL] = StdI->S2;
StdI->locspinflag[iL + StdI->nsite / 2] = 0;
}
/**@brief
(4) Compute the upper limit of the number of Transfer & Interaction and malloc them.
*/

/**
* @brief (4) Compute upper limit of Transfer & Interaction and malloc them
* @details Calculates maximum number of:
* - Transfers (hopping/exchange)
* - Interactions (Coulomb/exchange)
* And allocates memory accordingly
*/
if (strcmp(StdI->model, "spin") == 0 ) {
ntransMax = StdI->nsite * (StdI->S2 + 1/*h*/ + 2 * StdI->S2/*Gamma*/);
nintrMax = StdI->NCell * (StdI->NsiteUC/*D*/ + 3/*J*/ + 6/*J'*/ + 3/*J''*/)
Expand All @@ -182,9 +221,15 @@ void StdFace_Honeycomb(struct StdIntList *StdI)
}
/**/
StdFace_MallocInteractions(StdI, ntransMax, nintrMax);
/**@brief
(5) Set Transfer & Interaction
*/

/**
* @brief (5) Set Transfer & Interaction
* @details For each unit cell:
* - Sets local terms (chemical potential, magnetic field)
* - Sets nearest neighbor terms
* - Sets next-nearest neighbor terms
* - Sets third-nearest neighbor terms
*/
for (kCell = 0; kCell < StdI->NCell; kCell++) {
/**/
iW = StdI->Cell[kCell][0];
Expand Down
Loading