bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def parprint(*args, **kwargs): """MPI save print - prints only from master. Tries to adopt python 3 behaviour. """ if rank > 0: return defaults = { 'end' : '\n', 'file' : sys.stdout } for key in defaults: if not key in kwargs: kwargs[key] = defaults[key] for arg in args[:-1]: print >> kwargs['file'], arg, if len(args...
def parprint(*args, **kwargs): """MPI-safe print - prints only from master. Tries to adopt python 3 behaviour. """ if rank > 0: return defaults = { 'end' : '\n', 'file' : sys.stdout } for key in defaults: if not key in kwargs: kwargs[key] = defaults[key] for arg in args[:-1]: print >> kwargs['file'], arg, if len(args...
448,000
def parprint(*args, **kwargs): """MPI save print - prints only from master. Tries to adopt python 3 behaviour. """ if rank > 0: return defaults = { 'end' : '\n', 'file' : sys.stdout } for key in defaults: if not key in kwargs: kwargs[key] = defaults[key] for arg in args[:-1]: print >> kwargs['file'], arg, if len(args...
def parprint(*args, **kwargs): """MPI save print - prints only from master. Tries to adopt python 3 behaviour. """ if rank > 0: return defaults = {'end': '\n', 'file': sys.stdout } for key in defaults: if not key in kwargs: kwargs[key] = defaults[key] for arg in args[:-1]: print >> kwargs['file'], arg, if len(args): ...
448,001
def __init__(self, nc='out.nc', outnc=None, debug=logging.WARN, stay_alive=False, **kwargs): ''' Initialize the Jacapo calculator
def __init__(self, nc='out.nc', outnc=None, debug=logging.WARN, stay_alive=False, **kwargs): ''' Initialize the Jacapo calculator
448,002
def set_nc(self, nc='out.nc'): ''' set filename for the netcdf and text output for this calculation
def set_nc(self, nc='out.nc'): ''' set filename for the netcdf and text output for this calculation
448,003
def set_electronic_minimization(self, method, diagsperband=None): '''set the eigensolver method
def set_electronic_minimization(self, method='eigsolve', diagsperband=2): '''set the eigensolver method
448,004
def get_dipole_moment(self): ''' return dipole moment of unit cell
def get_dipole_moment(self,atoms=None): ''' return dipole moment of unit cell
448,005
def get_dipole_moment(self): ''' return dipole moment of unit cell
def get_dipole_moment(self): ''' return dipole moment of unit cell
448,006
def set_attributes(self, *args): self.param = {} self.param["xc"] = self.xc.get_active_text() self.param["prec"] = self.prec.get_active_text() self.param["kpts"] = (int(self.kpts[0].value), int(self.kpts[1].value), int(self.kpts[2].value)) self.param["encut"] = self.encut.value self.param["ediff"] = self.ediff.value se...
def set_attributes(self, *args): self.param = {} self.param["xc"] = self.xc.get_active_text() self.param["prec"] = self.prec.get_active_text() self.param["kpts"] = (int(self.kpts[0].value), int(self.kpts[1].value), int(self.kpts[2].value)) self.param["encut"] = self.encut.value self.param["ediff"] = self.ediff.value se...
448,007
def run(self): """Run the vibration calculations.
def run(self): """Run the vibration calculations.
448,008
def run(self): """Run the vibration calculations.
def run(self): """Run the vibration calculations.
448,009
def run(self): """Run the vibration calculations.
def run(self): """Run the vibration calculations.
448,010
def kpts_changed(calc, x): ''' check if kpt grid has changed. we have to take care to generate teh right k-points from x if needed. if a user provides (4,4,4) we need to generate the MP grid, etc... Since i changed the MP code in set_kpts, there is some incompatibility with old jacapo calculations and their MP grids....
def kpts_changed(calc, x): ''' check if kpt grid has changed. we have to take care to generate teh right k-points from x if needed. if a user provides (4,4,4) we need to generate the MP grid, etc... Since i changed the MP code in set_kpts, there is some incompatibility with old jacapo calculations and their MP grids....
448,011
def rotate_vectors(v1i, v2i, angle): """Rotate vectors *v1i* and *v2i* by *angle*""" cAng = cos(angle) sAng = sin(angle) v1o = v1i * cAng + v2i * sAng v2o = v2i * cAng - v1i * sAng # Ensure the length of the input and output vectors is equal return normalize(v1o) * norm(v1i), normalize(v2o) * norm(v2i)
def rotate_vectors(v1i, v2i, angle): """Rotate vectors *v1i* and *v2i* by *angle*""" cAng = cos(angle) sAng = sin(angle) v1o = v1i * cAng + v2i * sAng v2o = v2i * cAng - v1i * sAng # Ensure the length of the input and output vectors is equal return normalize(v1o) * norm(v1i), normalize(v2o) * norm(v2i)
448,012
def rotate_vectors(v1i, v2i, angle): """Rotate vectors *v1i* and *v2i* by *angle*""" cAng = cos(angle) sAng = sin(angle) v1o = v1i * cAng + v2i * sAng v2o = v2i * cAng - v1i * sAng # Ensure the length of the input and output vectors is equal return normalize(v1o) * norm(v1i), normalize(v2o) * norm(v2i)
def rotate_vectors(v1i, v2i, angle): """Rotate vectors *v1i* and *v2i* by *angle*""" cAng = cos(angle) sAng = sin(angle) v1o = v1i * cAng + v2i * sAng v2o = v2i * cAng - v1i * sAng # Ensure the length of the input and output vectors is equal return normalize(v1o) * norm(v1i), normalize(v2o) * norm(v2i)
448,013
def rotate_vectors(v1i, v2i, angle): """Rotate vectors *v1i* and *v2i* by *angle*""" cAng = cos(angle) sAng = sin(angle) v1o = v1i * cAng + v2i * sAng v2o = v2i * cAng - v1i * sAng # Ensure the length of the input and output vectors is equal return normalize(v1o) * norm(v1i), normalize(v2o) * norm(v2i)
def rotate_vectors(v1i, v2i, angle): """Rotate vectors *v1i* and *v2i* by *angle*""" cAng = cos(angle) sAng = sin(angle) v1o = v1i * cAng + v2i * sAng v2o = v2i * cAng - v1i * sAng # Ensure the length of the input and output vectors is equal return normalize(v1o) * norm(v1i), normalize(v2o) * norm(v2i)
448,014
def rotate_vectors(v1i, v2i, angle): """Rotate vectors *v1i* and *v2i* by *angle*""" cAng = cos(angle) sAng = sin(angle) v1o = v1i * cAng + v2i * sAng v2o = v2i * cAng - v1i * sAng # Ensure the length of the input and output vectors is equal return normalize(v1o) * norm(v1i), normalize(v2o) * norm(v2i)
def rotate_vectors(v1i, v2i, angle): """Rotate vectors *v1i* and *v2i* by *angle*""" cAng = cos(angle) sAng = sin(angle) v1o = v1i * cAng + v2i * sAng v2o = v2i * cAng - v1i * sAng # Ensure the length of the input and output vectors is equal return normalize(v1o) * norm(v1i), normalize(v2o) * norm(v2i)
448,015
def reset_all_counters(self): """Reset all counters.""" for key in self.counters.keys(): self.counters[key] = 0
def reset_all_counters(self): """Reset all counters.""" for key in self.counters.keys(): self.counters[key] = 0
448,016
def reset_all_counters(self): """Reset all counters.""" for key in self.counters.keys(): self.counters[key] = 0
def reset_all_counters(self): """Reset all counters.""" for key in self.counters.keys(): self.counters[key] = 0
448,017
def log(self, parameter=None): """Log the parameters of the eigenmode search.""" if self.logfile is not None: if parameter is not None: l = 'DIM:CONTROL: Updated Parameter: %s = %s\n' % (parameter, str(self.get_parameter(parameter))) else: l = 'MINMODE:METHOD: Dimer\n' l += 'DIM:CONTROL: Search Parameters:\n' l += 'DIM...
def log(self, parameter=None): """Log the parameters of the eigenmode search.""" if self.logfile is not None: if parameter is not None: l = 'DIM:CONTROL: Updated Parameter: %s = %s\n' % (parameter, str(self.get_parameter(parameter))) else: l = 'MINMODE:METHOD: Dimer\n' l += 'DIM:CONTROL: Search Parameters:\n' l += 'DIM...
448,018
def log(self, parameter=None): """Log the parameters of the eigenmode search.""" if self.logfile is not None: if parameter is not None: l = 'DIM:CONTROL: Updated Parameter: %s = %s\n' % (parameter, str(self.get_parameter(parameter))) else: l = 'MINMODE:METHOD: Dimer\n' l += 'DIM:CONTROL: Search Parameters:\n' l += 'DIM...
def log(self, parameter=None): """Log the parameters of the eigenmode search.""" if self.logfile is not None: if parameter is not None: l = 'DIM:CONTROL: Updated Parameter: %s = %s\n' % (parameter, str(self.get_parameter(parameter))) else: l = 'MINMODE:METHOD: Dimer\n' l += 'DIM:CONTROL: Search Parameters:\n' l += 'DIM...
448,019
def log(self, parameter=None): """Log the parameters of the eigenmode search.""" if self.logfile is not None: if parameter is not None: l = 'DIM:CONTROL: Updated Parameter: %s = %s\n' % (parameter, str(self.get_parameter(parameter))) else: l = 'MINMODE:METHOD: Dimer\n' l += 'DIM:CONTROL: Search Parameters:\n' l += 'DIM...
def log(self, parameter=None): """Log the parameters of the eigenmode search.""" if self.logfile is not None: if parameter is not None: l = 'DIM:CONTROL: Updated Parameter: %s = %s\n' % (parameter, str(self.get_parameter(parameter))) else: l = 'MINMODE:METHOD: Dimer\n' l += 'DIM:CONTROL: Search Parameters:\n' l += 'DIM...
448,020
def log(self, parameter=None): """Log the parameters of the eigenmode search.""" if self.logfile is not None: if parameter is not None: l = 'DIM:CONTROL: Updated Parameter: %s = %s\n' % (parameter, str(self.get_parameter(parameter))) else: l = 'MINMODE:METHOD: Dimer\n' l += 'DIM:CONTROL: Search Parameters:\n' l += 'DIM...
def log(self, parameter=None): """Log the parameters of the eigenmode search.""" if self.logfile is not None: if parameter is not None: l = 'DIM:CONTROL: Updated Parameter: %s = %s\n' % (parameter, str(self.get_parameter(parameter))) else: l = 'MINMODE:METHOD: Dimer\n' l += 'DIM:CONTROL: Search Parameters:\n' l += 'DIM...
448,021
def _set_frame_number(self, frame=None): '''set framenumber in the netcdf file
def _set_frame_number(self, frame=None): '''set framenumber in the netcdf file
448,022
def _set_frame_number(self, frame=None): '''set framenumber in the netcdf file
def _set_frame_number(self, frame=None): '''set framenumber in the netcdf file
448,023
def restart_load(self): """Method which is called upon restart.""" # Try to read sorting file if os.path.isfile('ase-sort.dat'): self.sort = [] self.resort = [] file = open('ase-sort.dat', 'r') lines = file.readlines() file.close() for line in lines: data = line.split() self.sort.append(int(data[0])) self.resort.appen...
def restart_load(self): """Method which is called upon restart.""" # Try to read sorting file if os.path.isfile('ase-sort.dat'): self.sort = [] self.resort = [] file = open('ase-sort.dat', 'r') lines = file.readlines() file.close() for line in lines: data = line.split() self.sort.append(int(data[0])) self.resort.appen...
448,024
def convert(self): lines = open(self.xdatcar).readlines()
def convert(self): lines = open(self.xdatcar).readlines()
448,025
def set_nbands(self, nbands=None): '''Set the number of bands. a few unoccupied bands are recommended.
def set_nbands(self, nbands=None): '''Set the number of bands. a few unoccupied bands are recommended.
448,026
def set_kpts(self, kpts): ''' set the kpt grid.
def set_kpts(self, kpts): ''' set the kpt grid.
448,027
def atoms_are_equal(self,atoms): ''' comparison of atoms to self.atoms using tolerances to account for float/double differences and float math. ''' TOL = 1.0e-6 #angstroms
def atoms_are_equal(self,atoms): ''' comparison of atoms to self.atoms using tolerances to account for float/double differences and float math. ''' TOL = 1.0e-6 #angstroms
448,028
def set_nc(self,nc='out.nc'): ''' set filename for the netcdf and text output for this calculation
def set_nc(self,nc='out.nc'): ''' set filename for the netcdf and text output for this calculation
448,029
def get_symmetry(self): '''return the type of symmetry used''' nc = netCDF(self.nc,'r') if 'UseSymmetry' in nc.variables: sym = string.join(nc.variables['UseSymmetry'][:],'').strip() else: sym = None nc.close() return sym
def get_symmetry(self): '''return the type of symmetry used''' nc = netCDF(self.nc,'r') if 'UseSymmetry' in nc.variables: sym = string.join(nc.variables['UseSymmetry'][:],'').strip() else: sym = None nc.close() return sym
448,030
def set_fftgrid(self,soft=None,hard=None): ''' sets the dimensions of the FFT grid to be used
def set_fftgrid(self,soft=None,hard=None): ''' sets the dimensions of the FFT grid to be used
448,031
def set_fftgrid(self,soft=None,hard=None): ''' sets the dimensions of the FFT grid to be used
def set_fftgrid(self,soft=None,hard=None): ''' sets the dimensions of the FFT grid to be used
448,032
def get_external_dipole(self): var = 'ExternalDipolePotential' nc = netCDF(self.get_nc(),'r') if var in nc.variables: v = nc.variables[var] value = v.getValue() if hasattr(v,'DipoleLayerPosition'): position = v.DipoleLayerPosition else: position = None else: value,position = None,None nc.close() return {'value':value,'...
def get_external_dipole(self): var = 'ExternalDipolePotential' nc = netCDF(self.get_nc(),'r') if var in nc.variables: v = nc.variables[var] value = v.getValue() if hasattr(v,'DipoleLayerPosition'): position = v.DipoleLayerPosition else: position = None else: value,position = None,None nc.close() return {'value':value,'...
448,033
def delete_ncattdimvar(self,ncf,ncattrs=[],ncdims=[],ncvars=[]): ''' helper function to delete attributes, dimensions and variables in a netcdffile
def delete_ncattdimvar(self,ncf,ncattrs=[],ncdims=[],ncvars=[]): ''' helper function to delete attributes, dimensions and variables in a netcdffile
448,034
def valid_kpts(self, x): if isinstance(x,str): return x in ['cc-6-1x1', 'cc-12-2x3', 'cc-18-sq3xsq3', 'cc-18-1x1', 'cc-54-sq3xsq3', 'cc-54-1x1', 'cc-162-1x1'] x = np.array(x) #empty arg is no good if x.shape == (): return False #monkhorst-pack elif x.shape == (3,) and ((x.dtype == 'int32') or (x.dtype == 'int64')): ret...
def valid_kpts(self, x): if isinstance(x,str): return x in ['cc-6-1x1', 'cc-12-2x3', 'cc-18-sq3xsq3', 'cc-18-1x1', 'cc-54-sq3xsq3', 'cc-54-1x1', 'cc-162-1x1'] x = np.array(x) #empty arg is no good if x.shape == (): return False #monkhorst-pack elif x.shape == (3,) and ((x.dtype == 'int32') or (x.dtype == 'int64')): ret...
448,035
def electronic_minimization_changed(self, x): print 'checking if em changed' myx = self.get_electronic_minimization() print myx print x return False
def electronic_minimization_changed(self, x): myx = self.get_electronic_minimization() print myx print x return False
448,036
def electronic_minimization_changed(self, x): print 'checking if em changed' myx = self.get_electronic_minimization() print myx print x return False
def electronic_minimization_changed(self, x): print 'checking if em changed' myx = self.get_electronic_minimization() for key in myx: if myx[key] != x[key]: print key, myx[key],' changed to ',x[key] return True return False
448,037
def symmetry_changed(self,x): if x != self.get_symmetry: return True else: return False
def symmetry_changed(self,x): if x != self.get_symmetry(): return True else: return False
448,038
def save(self, action): chooser = gtk.FileChooserDialog( _('Save ...'), None, gtk.FILE_CHOOSER_ACTION_SAVE, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE, gtk.RESPONSE_OK))
def save(self, action): chooser = gtk.FileChooserDialog( _('Save ...'), None, gtk.FILE_CHOOSER_ACTION_SAVE, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE, gtk.RESPONSE_OK))
448,039
def valid_int(x): return isinstance(x, int)
def valid_int(x): if (isinstance(x, int) or isinstance(x,np.int32)): return True
448,040
def valid_int_or_float(x): return (isinstance(x, int) or isinstance(x, float))
def valid_int_or_float(x): return ((isinstance(x, int) or isinstance(x,np.int32)) or isinstance(x, float))
448,041
def valid_kpts(x): if isinstance(x, str): return x in ['cc-6-1x1', 'cc-12-2x3', 'cc-18-sq3xsq3', 'cc-18-1x1', 'cc-54-sq3xsq3', 'cc-54-1x1', 'cc-162-1x1'] x = np.array(x) #empty arg is no good if x.shape == (): return False #monkhorst-pack elif x.shape == (3,) and ((x.dtype == 'int32') or (x.dtype == 'int64')): return T...
def valid_kpts(x): if isinstance(x, str): return x in ['cc6_1x1', 'cc12_2x3', 'cc18_sq3xsq3', 'cc18_1x1', 'cc54_sq3xsq3', 'cc54_1x1', 'cc162_sq3xsq3', 'cc162_1x1'] x = np.array(x) #empty arg is no good if x.shape == (): return False #monkhorst-pack elif x.shape == (3,) and ((x.dtype == 'int32') or (x.dtype == 'int64'))...
448,042
def summary(self, method='standard', direction='central'): hnu = self.get_energies(method, direction) s = 0.01 * units._e / units._c / units._hplanck parprint('-------------------------------------') parprint(' Mode Frequency Intensity') parprint(' # meV cm^-1 (D/Å)^2 amu^-1') parprint('------------...
def summary(self, method='standard', direction='central'): hnu = self.get_energies(method, direction) s = 0.01 * units._e / units._c / units._hplanck parprint('-------------------------------------') parprint(' Mode Frequency Intensity') parprint(' # meV cm^-1 (D/Å)^2 amu^-1') parprint('------------...
448,043
def build(): p = OptionParser(usage='%prog [options] [ads@]surf [output file]', version='%prog 0.1', description='Example ads/surf: CO@2x2Ru0001') p.add_option('-l', '--layers', type='int', default=4, help='Number of layers.') p.add_option('-v', '--vacuum', type='float', default=5.0, help='Vacuum.') p.add_option('-x',...
def build(): p = OptionParser(usage='%prog [options] [ads@]surf [output file]', version='%prog 0.1', description='Example ads/surf: CO@2x2Ru0001') p.add_option('-l', '--layers', type='int', default=4, help='Number of layers.') p.add_option('-v', '--vacuum', type='float', default=5.0, help='Vacuum.') p.add_option('-x',...
448,044
def build(): p = OptionParser(usage='%prog [options] [ads@]surf [output file]', version='%prog 0.1', description='Example ads/surf: CO@2x2Ru0001') p.add_option('-l', '--layers', type='int', default=4, help='Number of layers.') p.add_option('-v', '--vacuum', type='float', default=5.0, help='Vacuum.') p.add_option('-x',...
def build(): p = OptionParser(usage='%prog [options] [ads@]surf [output file]', version='%prog 0.1', description='Example ads/surf: CO@2x2Ru0001') p.add_option('-l', '--layers', type='int', default=4, help='Number of layers.') p.add_option('-v', '--vacuum', type='float', default=5.0, help='Vacuum.') p.add_option('-x',...
448,045
def build(): p = OptionParser(usage='%prog [options] [ads@]surf [output file]', version='%prog 0.1', description='Example ads/surf: CO@2x2Ru0001') p.add_option('-l', '--layers', type='int', default=4, help='Number of layers.') p.add_option('-v', '--vacuum', type='float', default=5.0, help='Vacuum.') p.add_option('-x',...
def build(): p = OptionParser(usage='%prog [options] [ads@]surf [output file]', version='%prog 0.1', description='Example ads/surf: CO@2x2Ru0001') p.add_option('-l', '--layers', type='int', default=4, help='Number of layers.') p.add_option('-v', '--vacuum', type='float', default=5.0, help='Vacuum.') p.add_option('-x',...
448,046
def build(): p = OptionParser(usage='%prog [options] [ads@]surf [output file]', version='%prog 0.1', description='Example ads/surf: CO@2x2Ru0001') p.add_option('-l', '--layers', type='int', default=4, help='Number of layers.') p.add_option('-v', '--vacuum', type='float', default=5.0, help='Vacuum.') p.add_option('-x',...
def build(): p = OptionParser(usage='%prog [options] [ads@]surf [output file]', version='%prog 0.1', description='Example ads/surf: CO@2x2Ru0001') p.add_option('-l', '--layers', type='int', default=4, help='Number of layers.') p.add_option('-v', '--vacuum', type='float', default=5.0, help='Vacuum.') p.add_option('-x',...
448,047
def scroll(self, window, event): from copy import copy CTRL = event.state == gtk.gdk.CONTROL_MASK SHIFT = event.state == gtk.gdk.SHIFT_MASK dxdydz = {gtk.keysyms.KP_Add: ('zoom', 1.2, 0), gtk.keysyms.KP_Subtract: ('zoom', 1 / 1.2), gtk.keysyms.Up: ( 0, -1 + CTRL, +CTRL), gtk.keysyms.Down: ( 0, +1 - CTRL, -CTRL), gt...
def scroll(self, window, event): from copy import copy CTRL = event.state == gtk.gdk.CONTROL_MASK SHIFT = event.state == gtk.gdk.SHIFT_MASK dxdydz = {gtk.keysyms.KP_Add: ('zoom', 1.2, 0), gtk.keysyms.KP_Subtract: ('zoom', 1 / 1.2), gtk.keysyms.Up: ( 0, -1 + CTRL, +CTRL), gtk.keysyms.Down: ( 0, +1 - CTRL, -CTRL), gt...
448,048
def __imul__(self, m): if len(self._constraints) > 0: raise RuntimeError('Remove constraint before modifying atoms.') if isinstance(m, int): m = (m, m, m) M = np.product(m) n = len(self) for name, a in self.arrays.items(): self.arrays[name] = np.tile(a, (M,) + (1,) * (len(a.shape) - 1))
def __imul__(self, m): if len(self._constraints) > 0: from ase.constraints import FixAtoms fixed_only = True fixed_atoms = [False for a in self] have_constraints = True for con in self.constraints: if isinstance(con, FixAtoms): for i in con.index: fixed_atoms[i] = True else: fixed_only = False if not fixed_only: raise ...
448,049
def get_spectrum(self, start=800, end=4000, npts=None, width=4, type='Gaussian', method='standard', direction='central'): """Get infrared spectrum.
def get_spectrum(self, start=800, end=4000, npts=None, width=4, type='Gaussian', method='standard', direction='central'): """Get infrared spectrum.
448,050
def save(self, action): chooser = gtk.FileChooserDialog( _('Save ...'), None, gtk.FILE_CHOOSER_ACTION_SAVE, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE, gtk.RESPONSE_OK))
def save(self, action): chooser = gtk.FileChooserDialog( _('Save ...'), None, gtk.FILE_CHOOSER_ACTION_SAVE, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE, gtk.RESPONSE_OK))
448,051
def ados_changed(self,x): ados = self.get_ados()
def ados_changed(self,x): ados = self.get_ados()
448,052
def ados_changed(self,x): ados = self.get_ados()
def ados_changed(self,x): ados = self.get_ados()
448,053
def ados_changed(self,x): ados = self.get_ados()
defelif ados is not None and x is None: return True ados_changed(self,x):elif ados is not None and x is None: return True adoselif ados is not None and x is None: return True =elif ados is not None and x is None: return True self.get_ados()
448,054
def kpts_changed(calc, x): ''' check if kpt grid has changed. we have to take care to generate teh right k-points from x if needed. if a user provides (4,4,4) we need to generate the MP grid, etc... Since i changed the MP code in set_kpts, there is some incompatibility with old jacapo calculations and their MP grids....
def kpts_changed(calc, x): ''' check if kpt grid has changed. we have to take care to generate teh right k-points from x if needed. if a user provides (4,4,4) we need to generate the MP grid, etc... Since i changed the MP code in set_kpts, there is some incompatibility with old jacapo calculations and their MP grids....
448,055
def kpts_changed(calc, x): ''' check if kpt grid has changed. we have to take care to generate teh right k-points from x if needed. if a user provides (4,4,4) we need to generate the MP grid, etc... Since i changed the MP code in set_kpts, there is some incompatibility with old jacapo calculations and their MP grids....
def kpts_changed(calc, x): ''' check if kpt grid has changed. we have to take care to generate teh right k-points from x if needed. if a user provides (4,4,4) we need to generate the MP grid, etc... Since i changed the MP code in set_kpts, there is some incompatibility with old jacapo calculations and their MP grids....
448,056
def read_ldau(self): ldau_luj = None ldauprint = None ldau = None ldautype = None atomtypes = [] # read ldau parameters from outcar for line in open('OUTCAR'): if line.find('TITEL') != -1: # What atoms are present atomtypes.append(line.split()[3].split('_')[0].split('.')[0]) if line.find('LDAUTYPE') != -1: # Is this...
def read_ldau(self): ldau_luj = None ldauprint = None ldau = None ldautype = None atomtypes = [] # read ldau parameters from outcar for line in open('OUTCAR'): if line.find('TITEL') != -1: # What atoms are present atomtypes.append(line.split()[3].split('_')[0].split('.')[0]) if line.find('LDAUTYPE') != -1: # Is this...
448,057
def __init__(self, gui): Simulation.__init__(self, gui) self.set_title("Homogeneous scaling") vbox = gtk.VBox() self.packtext(vbox, "XXXX Bla bla bla.") self.packimageselection(vbox) pack(vbox, gtk.Label(""))
def __init__(self, gui): Simulation.__init__(self, gui) self.set_title("Homogeneous scaling") vbox = gtk.VBox() self.packtext(vbox, "XXXX Bla bla bla.") self.packimageselection(vbox) pack(vbox, gtk.Label(""))
448,058
def choose_possible_deformations(self): """Turn on sensible radio buttons.
def choose_possible_deformations(self, first=False): """Turn on sensible radio buttons.
448,059
def get_deformation_axes(self): """Return which axes the user wants to deform along.""" for but, deform in self.deformtable: if but.get_active() and but.get_sensitive(): return np.array(deform) # No deformation chosen! oops("No deformation chosen: Please choose a deformation mode.") return False
def get_deformation_axes(self): """Return which axes the user wants to deform along.""" for but, deform in self.deformtable: if but.get_active(): return np.array(deform) # No deformation chosen! oops("No deformation chosen: Please choose a deformation mode.") return False
448,060
def __init__(self, gui): Simulation.__init__(self, gui) self.set_title("Homogeneous scaling") vbox = gtk.VBox() self.packtext(vbox, "XXXX Bla bla bla.") self.packimageselection(vbox, txt1="", txt2="") self.start_radio_nth.set_active(True) pack(vbox, gtk.Label(""))
def __init__(self, gui): Simulation.__init__(self, gui) self.set_title("Homogeneous scaling") vbox = gtk.VBox() self.packtext(vbox, scaling_txt) self.packimageselection(vbox, txt1="", txt2="") self.start_radio_nth.set_active(True) pack(vbox, gtk.Label(""))
448,061
framedef = gtk.Frame("Deformation:")
framedef = gtk.Frame("Deformation:")
448,062
def step(self,f): atoms = self.atoms if self.v is None: self.v = np.zeros((len(atoms), 3)) else: vf = np.vdot(f, self.v) if vf > 0.0: self.v = (1.0 - self.a) * self.v + self.a * f / np.sqrt( np.vdot(f, f)) * np.sqrt(np.vdot(self.v, self.v)) if self.Nsteps > self.Nmin: self.dt = min(self.dt * self.finc, self.dtmax) self...
def step(self,f): atoms = self.atoms if self.v is None: self.v = np.zeros((len(atoms), 3)) else: vf = np.vdot(f, self.v) if vf > 0.0: self.v = (1.0 - self.a) * self.v + self.a * f / np.sqrt( np.vdot(f, f)) * np.sqrt(np.vdot(self.v, self.v)) if self.Nsteps > self.Nmin: self.dt = min(self.dt * self.finc, self.dtmax) self...
448,063
def step(self,f): atoms = self.atoms if self.v is None: self.v = np.zeros((len(atoms), 3)) else: vf = np.vdot(f, self.v) if vf > 0.0: self.v = (1.0 - self.a) * self.v + self.a * f / np.sqrt( np.vdot(f, f)) * np.sqrt(np.vdot(self.v, self.v)) if self.Nsteps > self.Nmin: self.dt = min(self.dt * self.finc, self.dtmax) self...
def step(self,f): atoms = self.atoms if self.v is None: self.v = np.zeros((len(atoms), 3)) else: vf = np.vdot(f, self.v) if vf > 0.0: self.v = (1.0 - self.a) * self.v + self.a * f / np.sqrt( np.vdot(f, f)) * np.sqrt(np.vdot(self.v, self.v)) if self.Nsteps > self.Nmin: self.dt = min(self.dt * self.finc, self.dtmax) self...
448,064
def set_frame(self, frame=None, focus=False, init=False): if frame is None: frame = self.frame
def set_frame(self, frame=None, focus=False, init=False): if frame is None: frame = self.frame
448,065
def __repr__(self): return 'FixedMode(%d, %s)' % (ints2string(self.index), self.mode.tolist())
def __repr__(self): return 'FixedMode(%d, %s)' % (ints2string(self.index), self.mode.tolist())
448,066
def build(): p = OptionParser(usage='%prog [options] [ads@]surf [output file]', version='%prog 0.1', description='Example ads/surf: CO@2x2Ru0001') p.add_option('-l', '--layers', type='int', default=4, help='Number of layers.') p.add_option('-v', '--vacuum', type='float', default=5.0, help='Vacuum.') p.add_option('-x',...
def build(): p = OptionParser(usage='%prog [options] [ads@]surf [output file]', version='%prog 0.1', description='Example ads/surf: CO@2x2Ru0001') p.add_option('-l', '--layers', type='int', default=4, help='Number of layers.') p.add_option('-v', '--vacuum', type='float', default=5.0, help='Vacuum.') p.add_option('-x',...
448,067
def read(ncfile): '''return atoms and calculator from ncfile >>> atoms, calc = read('co.nc') ''' calc = Jacapo(ncfile) atoms = calc.get_atoms() #this returns a copy return (atoms, calc)
def read(ncfile): '''return atoms and calculator from ncfile >>> atoms, calc = read('co.nc') ''' calc = Jacapo(ncfile) atoms = calc.get_atoms() #this returns a copy return (atoms, calc)
448,068
def __init__(self, nc='out.nc', outnc=None, debug=logging.WARN, stay_alive=False, **kwargs): ''' Initialize the Jacapo calculator
def __init__(self, nc='out.nc', outnc=None, debug=logging.WARN, stay_alive=False, **kwargs): ''' Initialize the Jacapo calculator
448,069
def __init__(self, nc='out.nc', outnc=None, debug=logging.WARN, stay_alive=False, **kwargs): ''' Initialize the Jacapo calculator
def __init__(self, nc='out.nc', outnc=None, debug=logging.WARN, stay_alive=False, **kwargs): ''' Initialize the Jacapo calculator
448,070
def initnc(self, ncfile=None): '''create an ncfile with minimal dimensions in it
def initnc(self, ncfile=None): '''create an ncfile with minimal dimensions in it
448,071
def __str__(self): ''' pretty-print the calculator and atoms.
def __str__(self): ''' pretty-print the calculator and atoms.
448,072
def _set_frame_number(self, frame=None): 'set framenumber in the netcdf file' if frame is None: nc = netCDF(self.nc, 'r') if 'TotalEnergy' in nc.variables: frame = nc.variables['TotalEnergy'].shape[0] # make sure the last energy is reasonable. Sometime # the field is empty if the calculation ran out of # walltime for ...
def _set_frame_number(self, frame=None): '''set framenumber in the netcdf file this is equal to the number of ionic steps dimension''' if frame is None: nc = netCDF(self.nc, 'r') if 'TotalEnergy' in nc.variables: frame = nc.variables['TotalEnergy'].shape[0] # make sure the last energy is reasonable. Sometime # the fi...
448,073
def _set_frame_number(self, frame=None): 'set framenumber in the netcdf file' if frame is None: nc = netCDF(self.nc, 'r') if 'TotalEnergy' in nc.variables: frame = nc.variables['TotalEnergy'].shape[0] # make sure the last energy is reasonable. Sometime # the field is empty if the calculation ran out of # walltime for ...
def _set_frame_number(self, frame=None): 'set framenumber in the netcdf file' if frame is None: nc = netCDF(self.nc, 'r') if 'TotalEnergy' in nc.variables: frame = nc.variables['TotalEnergy'].shape[0] # make sure the last energy is reasonable. Sometime # the field is empty if the calculation ran out of # walltime for ...
448,074
def _set_frame_number(self, frame=None): 'set framenumber in the netcdf file' if frame is None: nc = netCDF(self.nc, 'r') if 'TotalEnergy' in nc.variables: frame = nc.variables['TotalEnergy'].shape[0] # make sure the last energy is reasonable. Sometime # the field is empty if the calculation ran out of # walltime for ...
def _set_frame_number(self, frame=None): 'set framenumber in the netcdf file' if frame is None: nc = netCDF(self.nc, 'r') if 'TotalEnergy' in nc.variables: frame = nc.variables['TotalEnergy'].shape[0] # make sure the last energy is reasonable. Sometime # the field is empty if the calculation ran out of # walltime for ...
448,075
def cut(atoms, a=(1,0,0), b=(0,1,0), c=(0,0,1), origo=(0,0,0), nlayers=None, extend=1.0, tolerance=0.001): """Cuts out a cell defined by *a*, *b*, *c* and *origo* from a sufficiently repeated copy of *atoms*. Typically, this function is used to create slabs of different sizes and orientations. The vectors *a*, *b* and...
def>>> cut(atoms,>>> a=(1,0,0),>>> b=(0,1,0),>>> c=(0,0,1),>>> origo=(0,0,0),>>> nlayers=None,>>> extend=1.0,>>> tolerance=0.001):>>> """Cuts>>> out>>> a>>> cell>>> defined>>> by>>> *a*,>>> *b*,>>> *c*>>> and>>> *origo*>>> from>>> a>>> sufficiently>>> repeated>>> copy>>> of>>> *atoms*.>>> >>> Typically,>>> this>>> func...
448,076
def cut(atoms, a=(1,0,0), b=(0,1,0), c=(0,0,1), origo=(0,0,0), nlayers=None, extend=1.0, tolerance=0.001): """Cuts out a cell defined by *a*, *b*, *c* and *origo* from a sufficiently repeated copy of *atoms*. Typically, this function is used to create slabs of different sizes and orientations. The vectors *a*, *b* and...
def>>> cut(atoms,>>> a=(1,0,0),>>> b=(0,1,0),>>> c=(0,0,1),>>> origo=(0,0,0),>>> nlayers=None,>>> extend=1.0,>>> tolerance=0.001):>>> """Cuts>>> out>>> a>>> cell>>> defined>>> by>>> *a*,>>> *b*,>>> *c*>>> and>>> *origo*>>> from>>> a>>> sufficiently>>> repeated>>> copy>>> of>>> *atoms*.>>> >>> Typically,>>> this>>> func...
448,077
def cut(atoms, a=(1,0,0), b=(0,1,0), c=(0,0,1), origo=(0,0,0), nlayers=None, extend=1.0, tolerance=0.001): """Cuts out a cell defined by *a*, *b*, *c* and *origo* from a sufficiently repeated copy of *atoms*. Typically, this function is used to create slabs of different sizes and orientations. The vectors *a*, *b* and...
def>>> cut(atoms,>>> a=(1,0,0),>>> b=(0,1,0),>>> c=(0,0,1),>>> origo=(0,0,0),>>> nlayers=None,>>> extend=1.0,>>> tolerance=0.001):>>> """Cuts>>> out>>> a>>> cell>>> defined>>> by>>> *a*,>>> *b*,>>> *c*>>> and>>> *origo*>>> from>>> a>>> sufficiently>>> repeated>>> copy>>> of>>> *atoms*.>>> >>> Typically,>>> this>>> func...
448,078
def cut(atoms, a=(1,0,0), b=(0,1,0), c=(0,0,1), origo=(0,0,0), nlayers=None, extend=1.0, tolerance=0.001): """Cuts out a cell defined by *a*, *b*, *c* and *origo* from a sufficiently repeated copy of *atoms*. Typically, this function is used to create slabs of different sizes and orientations. The vectors *a*, *b* and...
def>>> cut(atoms,>>> a=(1,0,0),>>> b=(0,1,0),>>> c=(0,0,1),>>> origo=(0,0,0),>>> nlayers=None,>>> extend=1.0,>>> tolerance=0.001):>>> """Cuts>>> out>>> a>>> cell>>> defined>>> by>>> *a*,>>> *b*,>>> *c*>>> and>>> *origo*>>> from>>> a>>> sufficiently>>> repeated>>> copy>>> of>>> *atoms*.>>> >>> Typically,>>> this>>> func...
448,079
def stack(atoms1, atoms2, axis=2, cell=None, fix=0.5, maxstrain=0.5, distance=None): """Return a new Atoms instance with *atoms2* added to atoms1 along the given axis. Periodicity in all directions is ensured. The size of the final cell is determined by *cell*, except that the length alongh *axis* will be the sum of *...
def>>> stack(atoms1,>>> atoms2,>>> axis=2,>>> cell=None,>>> fix=0.5,>>> maxstrain=0.5,>>> distance=None):>>> """Return>>> a>>> new>>> Atoms>>> instance>>> with>>> *atoms2*>>> added>>> to>>> atoms1>>> along>>> the>>> given>>> axis.>>> Periodicity>>> in>>> all>>> directions>>> is>>> ensured.>>> >>> The>>> size>>> of>>> t...
448,080
def stack(atoms1, atoms2, axis=2, cell=None, fix=0.5, maxstrain=0.5, distance=None): """Return a new Atoms instance with *atoms2* added to atoms1 along the given axis. Periodicity in all directions is ensured. The size of the final cell is determined by *cell*, except that the length alongh *axis* will be the sum of *...
def>>> stack(atoms1,>>> atoms2,>>> axis=2,>>> cell=None,>>> fix=0.5,>>> maxstrain=0.5,>>> distance=None):>>> """Return>>> a>>> new>>> Atoms>>> instance>>> with>>> *atoms2*>>> added>>> to>>> atoms1>>> along>>> the>>> given>>> axis.>>> Periodicity>>> in>>> all>>> directions>>> is>>> ensured.>>> >>> The>>> size>>> of>>> t...
448,081
def stack(atoms1, atoms2, axis=2, cell=None, fix=0.5, maxstrain=0.5, distance=None): """Return a new Atoms instance with *atoms2* added to atoms1 along the given axis. Periodicity in all directions is ensured. The size of the final cell is determined by *cell*, except that the length alongh *axis* will be the sum of *...
def>>> stack(atoms1,>>> atoms2,>>> axis=2,>>> cell=None,>>> fix=0.5,>>> maxstrain=0.5,>>> distance=None):>>> """Return>>> a>>> new>>> Atoms>>> instance>>> with>>> *atoms2*>>> added>>> to>>> atoms1>>> along>>> the>>> given>>> axis.>>> Periodicity>>> in>>> all>>> directions>>> is>>> ensured.>>> >>> The>>> size>>> of>>> t...
448,082
def stack(atoms1, atoms2, axis=2, cell=None, fix=0.5, maxstrain=0.5, distance=None): """Return a new Atoms instance with *atoms2* added to atoms1 along the given axis. Periodicity in all directions is ensured. The size of the final cell is determined by *cell*, except that the length alongh *axis* will be the sum of *...
def>>> stack(atoms1,>>> atoms2,>>> axis=2,>>> cell=None,>>> fix=0.5,>>> maxstrain=0.5,>>> distance=None):>>> """Return>>> a>>> new>>> Atoms>>> instance>>> with>>> *atoms2*>>> added>>> to>>> atoms1>>> along>>> the>>> given>>> axis.>>> Periodicity>>> in>>> all>>> directions>>> is>>> ensured.>>> >>> The>>> size>>> of>>> t...
448,083
def read_aims_output(filename, index = -1): """ Import FHI-aims output files with all data available, i.e. relaxations, MD information, force information etc etc etc. """ from ase import Atoms, Atom from ase.calculators.singlepoint import SinglePointCalculator from ase.units import Ang, fs molecular_dynamics = False f...
def read_aims_output(filename, index = -1): """ Import FHI-aims output files with all data available, i.e. relaxations, MD information, force information etc etc etc. """ from ase import Atoms, Atom from ase.calculators.singlepoint import SinglePointCalculator from ase.units import Ang, fs molecular_dynamics = False f...
448,084
def __init__(self, stpmin=1e-8, xtol=1e-14):
def __init__(self, stpmin=1e-8, xtol=1e-14):
448,085
def __init__(self, stpmin=1e-8, xtol=1e-14):
def __init__(self, stpmin=1e-8, xtol=1e-14):
448,086
def _line_search(self, func, myfprime, xk, pk, gfk, old_fval, old_old_fval, maxstep=.2, c1=.23, c2=0.46, xtrapl=1.1, xtrapu=4., stpmax=50., args=()):
def _line_search(self, func, myfprime, xk, pk, gfk, old_fval, old_old_fval, maxstep=.2, c1=.23, c2=0.46, xtrapl=1.1, xtrapu=4., stpmax=50., args=()):
448,087
def _line_search(self, func, myfprime, xk, pk, gfk, old_fval, old_old_fval, maxstep=.2, c1=.23, c2=0.46, xtrapl=1.1, xtrapu=4., stpmax=50., args=()):
def _line_search(self, func, myfprime, xk, pk, gfk, old_fval, old_old_fval, maxstep=.2, c1=.23, c2=0.46, xtrapl=1.1, xtrapu=4., stpmax=50., args=()):
448,088
def _line_search(self, func, myfprime, xk, pk, gfk, old_fval, old_old_fval, maxstep=.2, c1=.23, c2=0.46, xtrapl=1.1, xtrapu=4., stpmax=50., args=()):
def _line_search(self, func, myfprime, xk, pk, gfk, old_fval, old_old_fval, maxstep=.2, c1=.23, c2=0.46, xtrapl=1.1, xtrapu=4., stpmax=50., args=()):
448,089
def step(self, stp, f, g, c1, c2, xtol, isave, dsave): if self.task[:5] == 'START':
def step(self, stp, f, g, c1, c2, xtol, isave, dsave): if self.task[:5] == 'START':
448,090
def step(self, stp, f, g, c1, c2, xtol, isave, dsave): if self.task[:5] == 'START':
def step(self, stp, f, g, c1, c2, xtol, isave, dsave): if self.task[:5] == 'START':
448,091
def step(self, stp, f, g, c1, c2, xtol, isave, dsave): if self.task[:5] == 'START':
def step(self, stp, f, g, c1, c2, xtol, isave, dsave): if self.task[:5] == 'START':
448,092
def step(self, stp, f, g, c1, c2, xtol, isave, dsave): if self.task[:5] == 'START':
def step(self, stp, f, g, c1, c2, xtol, isave, dsave): if self.task[:5] == 'START':
448,093
def step(self, stp, f, g, c1, c2, xtol, isave, dsave): if self.task[:5] == 'START':
def step(self, stp, f, g, c1, c2, xtol, isave, dsave): if self.task[:5] == 'START':
448,094
def step(self, stp, f, g, c1, c2, xtol, isave, dsave): if self.task[:5] == 'START':
def step(self, stp, f, g, c1, c2, xtol, isave, dsave): if self.task[:5] == 'START':
448,095
def get_mass(self): return self._get('mass')
def get_mass(self): return self._get('mass')
448,096
def set_mass(self, mass): self._set('mass', mass)
def set_mass(self, mass): self._set('mass', mass)
448,097
def open(self, button=None, filenames=None): if filenames == None: chooser = gtk.FileChooserDialog( _('Open ...'), None, gtk.FILE_CHOOSER_ACTION_OPEN, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK)) ok = chooser.run() if ok == gtk.RESPONSE_OK: filenames = [chooser.get_filename()] chooser.destr...
def open(self, button=None, filenames=None): if filenames == None: chooser = gtk.FileChooserDialog( _('Open ...'), None, gtk.FILE_CHOOSER_ACTION_OPEN, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK)) ok = chooser.run() == gtk.RESPONSE_OK if ok: filenames = [chooser.get_filename()] chooser.destr...
448,098
def read_aims_output(filename, index = -1): """ Import FHI-aims output files with all data available, i.e. relaxations, MD information, force information etc etc etc. """ from ase import Atoms, Atom from ase.calculators.singlepoint import SinglePointCalculator molecular_dynamics = False fd = open(filename, 'r') cell =...
def read_aims_output(filename, index = -1): """ Import FHI-aims output files with all data available, i.e. relaxations, MD information, force information etc etc etc. """ from ase import Atoms, Atom from ase.calculators.singlepoint import SinglePointCalculator molecular_dynamics = False fd = open(filename, 'r') cell =...
448,099