This thread is locked.Only browsing is available.
Top Page > Browsing
The meaning of Rn in HS.out
Date: 2021/05/17 03:13
Name: Mao   <>

Dear OpenMX users,

I was trying to obtain the Hamiltonian and overlap matrices from HS.out file:


Kohn-Sham Hamiltonian spin=0
global index=1 local index=0 (global=1, Rn=0)
-0.7756858 -0.0000098 -0.0000170 0.0129204
-0.0000098 -0.5499314 -0.0000408 0.0000002
-0.0000170 -0.0000408 -0.5499785 0.0000003
0.0129204 0.0000002 0.0000003 -0.3109040
global index=1 local index=1 (global=1, Rn=203)


I use s1p1 orbitals for the calculation, therefore each pair corresponds to a 4 * 4 matrix.

My question is, how can I get the real-space distance of each atom pair?

As written in 'analysis_example.c", the global index denotes the atom number in the unit cell, and Rn denotes the cell index.
I was confused by the value of Rn, since a vector for the cell index is expected, i.e., Rn = (-1, 2, 0) as in the *.HWR file.

It seems like the cell index vector (l, m, n) are given by atv_ijk[Rn]. However, I couldn't find the "atv_ijk[Rn]" data in the output files.

Any comments will be appreciated!
Page: [1]

Re: The meaning of Rn in HS.out ( No.1 )
Date: 2021/05/17 14:51
Name: Naoya Yamaguchi


>My question is, how can I get the real-space distance of each atom pair?
For example, you can get the distance between atom i and atom j (here, j is a neighboring atom index for atom i) from

#include "read_scfout.h"
#include <math.h>
int main(void){
for (int i=1; i<=atomnum; i++){
for (int j=0; j<=FNAN[i]; j++){
double ix=Gxyz[i][1];
double iy=Gxyz[i][2];
double iz=Gxyz[i][3];
int globalJ=natn[i][j];
int Rn=ncn[i][j];
double jx=atv[Rn][1]+Gxyz[globalJ][1];
double jy=atv[Rn][2]+Gxyz[globalJ][2];
double jz=atv[Rn][3]+Gxyz[globalJ][3];
double jix=jx-ix;
double jiy=jy-iy;
double jiz=jz-iz;
printf("Distance (i = %d, j = %d): %f", i, j, sqrt(jix*jix+jiy*jiy+jiz*jiz));
return 0;

Also, you can refer to "read_scfout.h" or "read_scfout.c" to get information of variables.

Naoya Yamaguchi
Re: The meaning of Rn in HS.out ( No.2 )
Date: 2021/05/17 17:14
Name: Mao  <>

Hi Naoya Yamaguchi,

Thank you so much! I modified "analysis_example.c" following your suggestion and now it works.

Best regards,

Page: [1]