Commit 0f2f320c authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Ensure that random generation parameters are optional

parent a6d77523
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -371,9 +371,11 @@ def load_model(model_file):
            if (len_vec_x == 0):
                # Generate random cluster
                rnd_seed = int(model['system_settings']['rnd_seed'])
                try:
                    max_rad = float(model['particle_settings']['max_rad'])
                # random_aggregate() checks internally whether application is INCLUSION
                #random_aggregate(sconf, gconf, rnd_seed, max_rad)
                except KeyError:
                    print("ERROR: random model generation requires specification of particle_settings:max_rad.")
                    return (None, None)
                rnd_engine = "COMPACT"
                try:
                    rnd_engine = model['system_settings']['rnd_engine']
@@ -386,6 +388,7 @@ def load_model(model_file):
                        print("ERROR: compact random generator works only when all sphere types have the same radius.")
                        return (None, None)
                elif (rnd_engine == "LOOSE"):
                    # random_aggregate() checks internally whether application is INCLUSION
                    check = random_aggregate(sconf, gconf, rnd_seed, max_rad)
                else:
                    print("ERROR: unrecognized random generator engine.")