Skip to content
Snippets Groups Projects
Commit bcf88914 authored by Kai Sellschopp's avatar Kai Sellschopp
Browse files

added more fancy progress bars

parent e8308b88
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@ from ase import Atoms
from .adAtom import AdAtom
from .boundaryCondition import *
from .reduction import *
from .output import printProgressBar
class CodeRed:
......@@ -123,6 +124,7 @@ class CodeRed:
# create some informative output
print("Creating positions for ad-atom with index {:d}, species: {:s}, label: {:s}".format(self.current_index, adatom.species, adatom.label))
printProgressBar(0, 1, prefix=' Progress: ')
# make sure it has a mesh
if (adatom.mesh==[] or len(adatom.mesh)==0):
......@@ -153,6 +155,14 @@ class CodeRed:
# check boundary conditions
numCom = len(self.combinations)
# create progress bar output
printProgressBar(0.1, 1, prefix=' Progress: ')
n_dc = len(adatom.get_distance_conditions())
n_ac = len(adatom.get_angle_conditions())
counter_max = n_dc+n_ac
counter = 0
# check distance conditions
for dc in adatom.get_distance_conditions():
......@@ -164,7 +174,11 @@ class CodeRed:
# stop if there are no combinations left
if len(self.combinations)==0:
printProgressBar(1, 1, prefix=' Progress: ', suffix=' No combinations left!')
return
else:
counter+=1
printProgressBar(0.1+0.9*counter/counter_max, 1, prefix=' Progress: ')
# check angle conditions
for ac in adatom.get_angle_conditions():
......@@ -174,7 +188,11 @@ class CodeRed:
ac_met = ac.check_condition(ac_positions[0], ac_positions[1], ac_positions[2])
# stop if there are no combinations left
if len(self.combinations)==0:
printProgressBar(1, 1, prefix=' Progress: ', suffix=' No combinations left!')
return
else:
counter+=1
printProgressBar(0.1+0.9*counter/counter_max, 1, prefix=' Progress: ')
#TODO: include dihedral conditions
......
......@@ -55,6 +55,8 @@ def gridCoarseGraining(structures, ngrains_x=1, ngrains_y=1, ngrains_z=1):
grid_zmin = np.amin([grid_zmin, np.amin(positions[:,2])])
grid_zmax = np.amax([grid_zmax, np.amax(positions[:,2])])
printProgressBar(i+1, 2*n_struct, prefix=' Progress: ')
# create coarse graining grid
gx, gwx = np.linspace(grid_xmin, grid_xmax, ngrains_x+1, endpoint=True, retstep=True)
gy, gwy = np.linspace(grid_ymin, grid_ymax, ngrains_y+1, endpoint=True, retstep=True)
......@@ -84,5 +86,8 @@ def gridCoarseGraining(structures, ngrains_x=1, ngrains_y=1, ngrains_z=1):
# add to the list of (unique) coarse grained structures
structures_cg.append(struct_cg)
# progress bar output
printProgressBar(n_struct+i+1, 2*n_struct, prefix=' Progress: ')
# return non-equivalent structures (original and cg positions) and the decision array
return np.array(structures)[np.logical_not(equiv)], structures_cg, np.logical_not(equiv)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment