Skip to content

Commit 1846cd8

Browse files
committed
const thresholds, rename spherical harmonic to real
1 parent 23c4881 commit 1846cd8

File tree

8 files changed

+33
-33
lines changed

8 files changed

+33
-33
lines changed

bindings/python/libmsym.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class _RealSphericalHarmonic(Structure):
101101
("m", c_int)]
102102

103103
class _BasisFunctionUnion(Union):
104-
_fields_ = [("_sh", _RealSphericalHarmonic)]
104+
_fields_ = [("_rsh", _RealSphericalHarmonic)]
105105

106106
class BasisFunction(Structure):
107107
_fields_ = [("_id", c_void_p),
@@ -130,31 +130,31 @@ class RealSphericalHarmonic(BasisFunction):
130130
def __init__(self, element=None, n=0, l=0, m=0, name=""):
131131
super().__init__(element=element)
132132
self._type = 0
133-
self._f._sh.n = n
134-
self._f._sh.l = l
135-
self._f._sh.m = m
133+
self._f._rsh.n = n
134+
self._f._rsh.l = l
135+
self._f._rsh.m = m
136136
self.name = name
137137

138138
@property
139139
def n(self):
140-
return self._f._sh.n
140+
return self._f._rsh.n
141141
@n.setter
142142
def n(self, n):
143-
self._f._sh.n = n
143+
self._f._rsh.n = n
144144

145145
@property
146146
def l(self):
147-
return self._f._sh.l
147+
return self._f._rsh.l
148148
@l.setter
149149
def l(self, n):
150-
self._f._sh.n = l
150+
self._f._rsh.n = l
151151

152152
@property
153153
def m(self):
154-
return self._f._sh.m
154+
return self._f._rsh.m
155155
@m.setter
156156
def m(self, n):
157-
self._f._sh.n = m
157+
self._f._rsh.n = m
158158

159159
class SALC(Structure):
160160
_fields_ = [("_d", c_int),

examples/example.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ int example(const char* in_file, msym_thresholds_t *thresholds){
190190
msym_salc_t *salc = &msrs[i].salc[j];
191191
msym_basis_function_t *bf = salc->f[0];
192192
if(bf->type == MSYM_BASIS_TYPE_REAL_SPHERICAL_HARMONIC) type = "real spherical harmonic ";
193-
printf("\tSALC %d was constructed from %d %sbasis functions on %s with quantum numbers n=%d and l=%d\n",j,salc->fl,type,bf->element->name,bf->f.sh.n,bf->f.sh.l);
193+
printf("\tSALC %d was constructed from %d %sbasis functions on %s with quantum numbers n=%d and l=%d\n",j,salc->fl,type,bf->element->name,bf->f.rsh.n,bf->f.rsh.l);
194194
}
195195
}
196196

examples/tex_character_table.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ int main(int argc, const char * argv[]) {
5151
int i = m+l;
5252
basis[i].type = MSYM_BASIS_TYPE_REAL_SPHERICAL_HARMONIC;
5353
basis[i].element = &element;
54-
basis[i].f.sh.n = l+1;
55-
basis[i].f.sh.l = l;
56-
basis[i].f.sh.m = m;
54+
basis[i].f.rsh.n = l+1;
55+
basis[i].f.rsh.l = l;
56+
basis[i].f.rsh.m = m;
5757
}
5858
if(MSYM_SUCCESS != (ret = msymSetBasisFunctions(ctx, 2*l+1, basis))) {
5959
free(basis);

src/basis_function.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ msym_error_t basisFunctionFromQuantumNumbers(int n, int l, int m, msym_basis_fun
1818

1919
if(l > n || abs(m) > l) goto err;
2020

21-
bf->f.sh.n = n;
22-
bf->f.sh.l = l;
23-
bf->f.sh.m = m;
21+
bf->f.rsh.n = n;
22+
bf->f.rsh.l = l;
23+
bf->f.rsh.m = m;
2424

2525
memset(bf->name,0,sizeof(bf->name));
2626

src/context.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ msym_error_t msymSetThresholds(msym_context ctx, const msym_thresholds_t *thresh
115115
return ret;
116116
}
117117

118-
msym_error_t msymGetThresholds(msym_context ctx, msym_thresholds_t **thresholds){
118+
msym_error_t msymGetThresholds(msym_context ctx, const msym_thresholds_t **thresholds){
119119
msym_error_t ret = MSYM_SUCCESS;
120120
if(ctx == NULL) {ret = MSYM_INVALID_CONTEXT;goto err;}
121121
if(ctx->thresholds == NULL) ret = MSYM_INVALID_THRESHOLD;
@@ -201,7 +201,7 @@ msym_error_t msymSetBasisFunctions(msym_context ctx, int length, msym_basis_func
201201
goto err;
202202
}
203203

204-
msym_spherical_harmonic_t *sh = &bf->f.sh;
204+
msym_real_spherical_harmonic_t *sh = &bf->f.rsh;
205205

206206
if(sh->n <= 0){
207207
if(MSYM_SUCCESS != (ret = basisFunctionFromName(bf->name,bf))) goto err;
@@ -596,7 +596,7 @@ msym_error_t ctxReduceLinearPointGroup(msym_context ctx){
596596
if(ctx->pg == NULL) {ret = MSYM_INVALID_POINT_GROUP; goto err;}
597597
if(isLinearPointGroup(ctx->pg) && NULL != ctx->basis && 0 != ctx->basisl){
598598
int lmax = 0;
599-
for(int i = 0;i < ctx->basisl;i++) lmax = lmax > ctx->basis[i].f.sh.l ? lmax : ctx->basis[i].f.sh.l;
599+
for(int i = 0;i < ctx->basisl;i++) lmax = lmax > ctx->basis[i].f.rsh.l ? lmax : ctx->basis[i].f.rsh.l;
600600
if(MSYM_SUCCESS != (ret = reduceLinearPointGroup(ctx->pg, 2*lmax, ctx->thresholds))) goto err;
601601
ctxDestroySubgroups(ctx);
602602
}

src/msym.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ extern "C" {
107107
int length; // Number of elements
108108
} msym_equivalence_set_t ;
109109

110-
typedef struct _msym_spherical_harmonic {
110+
typedef struct _msym_real_spherical_harmonic {
111111
int n; // Principal
112112
int l; // Azimuthal
113113
int m; // Liniear combination of magnetic quantum number (e.g. 2pz = 0, 2px = 1, 2py = -1)
114-
} msym_spherical_harmonic_t;
114+
} msym_real_spherical_harmonic_t;
115115

116116
typedef struct _msym_basis_function {
117117
void *id; // custom identifier
@@ -121,15 +121,15 @@ extern "C" {
121121
} type;
122122
msym_element_t *element;
123123
union {
124-
msym_spherical_harmonic_t sh; // Atomic orbital basis
124+
msym_real_spherical_harmonic_t rsh; // Atomic orbital basis
125125
} f;
126126
char name[8];
127127

128128
} msym_basis_function_t;
129129

130130
typedef struct _msym_partner_function {
131-
int i;
132-
int d;
131+
int i; // index of partner 0
132+
int d; // component (dimension)
133133
} msym_partner_function_t;
134134

135135
typedef struct _msym_salc {
@@ -165,7 +165,7 @@ extern "C" {
165165

166166
const msym_thresholds_t *msymGetDefaultThresholds();
167167
msym_error_t msymSetThresholds(msym_context ctx, const msym_thresholds_t *thresholds);
168-
msym_error_t msymGetThresholds(msym_context ctx, msym_thresholds_t **thresholds);
168+
msym_error_t msymGetThresholds(msym_context ctx, const msym_thresholds_t **thresholds);
169169
msym_error_t msymSetElements(msym_context ctx, int length, msym_element_t *elements);
170170
msym_error_t msymGetElements(msym_context ctx, int *length, msym_element_t **elements);
171171
msym_error_t msymSetBasisFunctions(msym_context ctx, int length, msym_basis_function_t *basis);

src/subspace.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ msym_error_t generateSubrepresentationSpaces(msym_point_group_t *pg, int sgl, co
233233
enum _msym_basis_type ftype = basis[0].type;
234234
for(int i = 0;i < basisl;i++){
235235
if(basis[i].type != ftype) {nmax = -1; break;}
236-
lmax = basis[i].f.sh.l > lmax ? basis[i].f.sh.l : lmax;
237-
nmax = basis[i].f.sh.n > nmax ? basis[i].f.sh.n : nmax;
236+
lmax = basis[i].f.rsh.l > lmax ? basis[i].f.rsh.l : lmax;
237+
nmax = basis[i].f.rsh.n > nmax ? basis[i].f.rsh.n : nmax;
238238
}
239239

240240
if(lmax < 0 || nmax < 1){
@@ -294,7 +294,7 @@ msym_error_t generateSubrepresentationSpaces(msym_point_group_t *pg, int sgl, co
294294

295295
/* determine number of l-type basis functions in each ES */
296296
for(int o = 0;o < basisl;o++){
297-
les[esmap[basis[o].element - elements] - es][basis[o].f.sh.l] += basis[o].f.sh.m == 0;
297+
les[esmap[basis[o].element - elements] - es][basis[o].f.rsh.l] += basis[o].f.rsh.m == 0;
298298
}
299299

300300
if(MSYM_SUCCESS != (ret = generateRepresentations(pg->order+1, pg->order, pg->sops, lmax, lts))) goto err;
@@ -318,8 +318,8 @@ msym_error_t generateSubrepresentationSpaces(msym_point_group_t *pg, int sgl, co
318318
msymSetErrorDetails("Basis function does not map to any equivalence set");
319319
goto err;
320320
}
321-
if(bf->f.sh.n > esnmax[e - es]) esnmax[e - es] = bf->f.sh.n;
322-
esbfmap[e - es][esi][bf->f.sh.n][bf->f.sh.l][bf->f.sh.m+bf->f.sh.l] = bf;
321+
if(bf->f.rsh.n > esnmax[e - es]) esnmax[e - es] = bf->f.rsh.n;
322+
esbfmap[e - es][esi][bf->f.rsh.n][bf->f.rsh.l][bf->f.rsh.m+bf->f.rsh.l] = bf;
323323
}
324324

325325
int srsbfi = 0;
@@ -358,7 +358,7 @@ msym_error_t generateSubrepresentationSpaces(msym_point_group_t *pg, int sgl, co
358358
/* calculate span of irreducible representations for basis functions and permutations */
359359
for(int s = 0; s < pg->order;s++){
360360
for(int l = 0; l <= lmax;l++){
361-
dbf.f.sh.l = l; //TODO: function type based
361+
dbf.f.rsh.l = l; //TODO: function type based
362362
double c = symmetryOperationCharacter(&pg->sops[s], &dbf);
363363
for(int k = 0;k < ct->d;k++){
364364
bspan[l][k] += c*ctable[k][pg->sops[s].cla];

src/symop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ double symmetryOperationCharacter(msym_symmetry_operation_t *sop, msym_basis_fun
9595
double c = 0.0;
9696
switch (f->type) {
9797
case MSYM_BASIS_TYPE_REAL_SPHERICAL_HARMONIC:
98-
c = symmetryOperationYCharacter(sop,f->f.sh.l);
98+
c = symmetryOperationYCharacter(sop,f->f.rsh.l);
9999
break;
100100
case MSYM_BASIS_TYPE_CARTESIAN :
101101
c = symmetryOperationCartesianCharacter(sop);

0 commit comments

Comments
 (0)