Skip to content

Commit

Permalink
Update python and character table
Browse files Browse the repository at this point in the history
  • Loading branch information
mcodev31 committed Nov 26, 2015
1 parent 9b8777c commit 5b7aa16
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions bindings/python/libmsym.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,12 +600,13 @@ def symmetrize_wavefunctions(self,m):
raise ImportError("numpy is not available.")
csize = len(self._basis_functions)
(d1,d2) = m.shape
if not (d1 == csize and d2 == csize and m.dtype == np.float64):
raise ValueError("Must provide a " + str(csize) + "x" + str(csize) + " numpy.float64 array")
if not (d1 == csize and d2 == csize):
raise ValueError("Must provide a " + str(csize) + "x" + str(csize))
wf = np.ascontiguousarray(m, dtype=np.float64)
partner_functions = (PartnerFunction*csize)()
species = np.zeros((csize),dtype=np.int32)
self._assert_success(_lib.msymSymmetrizeWavefunctions(self._ctx,csize,m,species,partner_functions))
return (m, species, partner_functions[0:csize])
self._assert_success(_lib.msymSymmetrizeWavefunctions(self._ctx,csize,wf,species,partner_functions))
return (wf, species, partner_functions[0:csize])

def generate_elements(self, elements):
if not self._ctx:
Expand All @@ -625,10 +626,11 @@ def generate_elements(self, elements):
def symmetry_species_components(self, wf):

wf_size = len(wf)
if not (wf_size == len(self.basis_functions) and wf.dtype == np.float64):
raise ValueError("Must provide a numpy.float64 array of length " + str(len(self.basis_functions)))
if not wf_size == len(self.basis_functions):
raise ValueError("Must provide an array of length " + str(len(self.basis_functions)))
species_size = self.character_table._d
species = np.zeros((species_size),dtype=np.float64)
wf = np.ascontiguousarray(wf, dtype=np.float64)
self._assert_success(_lib.msymSymmetrySpeciesComponents(self._ctx, wf_size, wf, species_size, species))
return species

Expand Down
2 changes: 1 addition & 1 deletion examples/tex_character_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int main(int argc, const char * argv[]) {
if(MSYM_SUCCESS != (ret = msymGetPointGroupType(ctx, &pg_type, &pg_n))) goto err;
if(argc >= 4){
l = argv[3][0] - '0';
if(l <= 0 || l > 9) l = -1;
if(l < 0 || l > 9) l = -1;
}

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

0 comments on commit 5b7aa16

Please sign in to comment.