Skip to content

Commit 5b7aa16

Browse files
committed
Update python and character table
1 parent 9b8777c commit 5b7aa16

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

bindings/python/libmsym.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -600,12 +600,13 @@ def symmetrize_wavefunctions(self,m):
600600
raise ImportError("numpy is not available.")
601601
csize = len(self._basis_functions)
602602
(d1,d2) = m.shape
603-
if not (d1 == csize and d2 == csize and m.dtype == np.float64):
604-
raise ValueError("Must provide a " + str(csize) + "x" + str(csize) + " numpy.float64 array")
603+
if not (d1 == csize and d2 == csize):
604+
raise ValueError("Must provide a " + str(csize) + "x" + str(csize))
605+
wf = np.ascontiguousarray(m, dtype=np.float64)
605606
partner_functions = (PartnerFunction*csize)()
606607
species = np.zeros((csize),dtype=np.int32)
607-
self._assert_success(_lib.msymSymmetrizeWavefunctions(self._ctx,csize,m,species,partner_functions))
608-
return (m, species, partner_functions[0:csize])
608+
self._assert_success(_lib.msymSymmetrizeWavefunctions(self._ctx,csize,wf,species,partner_functions))
609+
return (wf, species, partner_functions[0:csize])
609610

610611
def generate_elements(self, elements):
611612
if not self._ctx:
@@ -625,10 +626,11 @@ def generate_elements(self, elements):
625626
def symmetry_species_components(self, wf):
626627

627628
wf_size = len(wf)
628-
if not (wf_size == len(self.basis_functions) and wf.dtype == np.float64):
629-
raise ValueError("Must provide a numpy.float64 array of length " + str(len(self.basis_functions)))
629+
if not wf_size == len(self.basis_functions):
630+
raise ValueError("Must provide an array of length " + str(len(self.basis_functions)))
630631
species_size = self.character_table._d
631632
species = np.zeros((species_size),dtype=np.float64)
633+
wf = np.ascontiguousarray(wf, dtype=np.float64)
632634
self._assert_success(_lib.msymSymmetrySpeciesComponents(self._ctx, wf_size, wf, species_size, species))
633635
return species
634636

examples/tex_character_table.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int main(int argc, const char * argv[]) {
4141
if(MSYM_SUCCESS != (ret = msymGetPointGroupType(ctx, &pg_type, &pg_n))) goto err;
4242
if(argc >= 4){
4343
l = argv[3][0] - '0';
44-
if(l <= 0 || l > 9) l = -1;
44+
if(l < 0 || l > 9) l = -1;
4545
}
4646

4747
if(pg_n == 0 && (pg_type == MSYM_POINT_GROUP_TYPE_Cnv || pg_type == MSYM_POINT_GROUP_TYPE_Dnh) && l >= 0){

0 commit comments

Comments
 (0)