bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def set(self, **kwargs): '''set a parameter
def set(self, **kwargs): '''set a parameter
447,900
def set(self, **kwargs): '''set a parameter
def set(self, **kwargs): '''set a parameter
447,901
def set(self, **kwargs): '''set a parameter
defset(self,**kwargs):'''setaparameter
447,902
def set(self, **kwargs): '''set a parameter
def set(self, **kwargs): '''set a parameter
447,903
def write_input(self): '''write out input parameters as needed
def write_input(self): '''write out input parameters as needed
447,904
def update_input_parameters(self): '''read in all the input parameters from the netcdfile''' for key in self.valid_input: getf = 'self.get_%s()' % key if self.debug > 0: print 'getting ', key self.pars[key] = eval(getf) self.pars_uptodate[key] = True return self.pars
def update_input_parameters(self): '''read in all the input parameters from the netcdfile''' for key in self.valid_input: getf = 'self.get_%s()' % key log.debug('getting key: %s' % key) self.pars[key] = eval(getf) self.pars_uptodate[key] = True return self.pars
447,905
def initnc(self, ncfile): 'create an ncfile with minimal dimensions in it' if self.debug > 0: print 'initializing ', ncfile
def initnc(self, ncfile): 'create an ncfile with minimal dimensions in it' if self.debug > 0: print 'initializing ', ncfile
447,906
def _set_frame_number(self, frame=None): 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 example. Empty values get returned as ...
def _set_frame_number(self, frame=None): 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 example. Empty values get returned as ...
447,907
def _set_frame_number(self, frame=None): 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 example. Empty values get returned as ...
def _set_frame_number(self, frame=None): 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 example. Empty values get returned as ...
447,908
def _increment_frame(self): if self.debug > 1: print 'incrementing frame' self._frame += 1
def _increment_frame(self): log.debug('incrementing frame') self._frame += 1
447,909
def set_kpts(self, kpts): ''' set the kpt grid.
def set_kpts(self, kpts): ''' set the kpt grid.
447,910
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
447,911
def set_atoms(self, atoms): '''attach an atoms to the calculator and update the ncfile
def set_atoms(self, atoms): '''attach an atoms to the calculator and update the ncfile
447,912
def set_atoms(self, atoms): '''attach an atoms to the calculator and update the ncfile
def set_atoms(self, atoms): '''attach an atoms to the calculator and update the ncfile
447,913
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
447,914
def get_potential_energy(self,atoms=None,force_consistent=False): ''' return the potential energy. ''' if self.calculation_required(atoms): if self.debug > 0: print 'calculation required for energy' self.calculate() else: if self.debug > 0: print 'no calculation required for energy' nc = netCDF(self.get_nc(),'r') try:...
def get_potential_energy(self,atoms=None,force_consistent=False): ''' return the potential energy. ''' if self.calculation_required(atoms): log.debug('calculation required for energy') self.calculate() else: if self.debug > 0: print 'no calculation required for energy' nc = netCDF(self.get_nc(),'r') try: if force_cons...
447,915
def get_potential_energy(self,atoms=None,force_consistent=False): ''' return the potential energy. ''' if self.calculation_required(atoms): if self.debug > 0: print 'calculation required for energy' self.calculate() else: if self.debug > 0: print 'no calculation required for energy' nc = netCDF(self.get_nc(),'r') try:...
def get_potential_energy(self,atoms=None,force_consistent=False): ''' return the potential energy. ''' if self.calculation_required(atoms): if self.debug > 0: print 'calculation required for energy' self.calculate() else: log.debug('no calculation required for energy') nc = netCDF(self.get_nc(),'r') try: if force_cons...
447,916
def get_potential_energy(self,atoms=None,force_consistent=False): ''' return the potential energy. ''' if self.calculation_required(atoms): if self.debug > 0: print 'calculation required for energy' self.calculate() else: if self.debug > 0: print 'no calculation required for energy' nc = netCDF(self.get_nc(),'r') try:...
def get_potential_energy(self,atoms=None,force_consistent=False): ''' return the potential energy. ''' if self.calculation_required(atoms): if self.debug > 0: print 'calculation required for energy' self.calculate() else: if self.debug > 0: print 'no calculation required for energy' nc = netCDF(self.get_nc(),'r') try:...
447,917
def get_forces(self, atoms=None): """Calculate atomic forces""" if atoms is None: atoms = self.atoms if self.calculation_required(atoms): if self.debug > 0: print 'calculation required for forces' self.calculate() nc = netCDF(self.get_nc(),'r') forces = nc.variables['DynamicAtomForces'][-1] nc.close() return forces
def get_forces(self, atoms=None): """Calculate atomic forces""" if atoms is None: atoms = self.atoms if self.calculation_required(atoms): self.calculate() nc = netCDF(self.get_nc(),'r') forces = nc.variables['DynamicAtomForces'][-1] nc.close() return forces
447,918
def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed.
def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed.
447,919
def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed.
def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed.
447,920
def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed.
def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed.
447,921
def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed.
def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed.
447,922
def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed.
def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed.
447,923
def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed.
def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed.
447,924
def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed.
def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed.
447,925
def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed.
def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed.
447,926
def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed.
def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed.
447,927
def calculate(self): '''run a calculation.
def calculate(self): '''run a calculation.
447,928
def calculate(self): '''run a calculation.
def calculate(self): '''run a calculation.
447,929
def execute_external_dynamics(self, nc=None, txt=None, stoppfile='stop', stopprogram=None): ''' Implementation of the stay alive functionality with socket communication between dacapo and python. Known limitations: It is not possible to start 2 independent Dacapo calculators from the same python process, since the pyt...
def execute_external_dynamics(self, nc=None, txt=None, stoppfile='stop', stopprogram=None): ''' Implementation of the stay alive functionality with socket communication between dacapo and python. Known limitations: It is not possible to start 2 independent Dacapo calculators from the same python process, since the pyt...
447,930
def execute_external_dynamics(self, nc=None, txt=None, stoppfile='stop', stopprogram=None): ''' Implementation of the stay alive functionality with socket communication between dacapo and python. Known limitations: It is not possible to start 2 independent Dacapo calculators from the same python process, since the pyt...
def execute_external_dynamics(self, nc=None, txt=None, stoppfile='stop', stopprogram=None): ''' Implementation of the stay alive functionality with socket communication between dacapo and python. Known limitations: It is not possible to start 2 independent Dacapo calculators from the same python process, since the pyt...
447,931
def write_nc(self,nc=None,atoms=None): ''' write out a netcdffile. This does not change the ncfile attached to the calculator!
def write_nc(self,nc=None,atoms=None): ''' write out a netcdffile. This does not change the ncfile attached to the calculator!
447,932
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
447,933
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
447,934
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
447,935
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
447,936
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
447,937
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
447,938
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
447,939
def restart(self): ''' Restart the calculator by deleting nc dimensions that will be rewritten on the next calculation. This is sometimes required when certain dimensions change related to unitcell size changes planewave/densitywave cutoffs and kpt changes. These can cause fortran netcdf errors if the data does not mat...
def restart(self): ''' Restart the calculator by deleting nc dimensions that will be rewritten on the next calculation. This is sometimes required when certain dimensions change related to unitcell size changes planewave/densitywave cutoffs and kpt changes. These can cause fortran netcdf errors if the data does not mat...
447,940
def _set_external_dipole(self,x): if x is not None: self.set_external_dipole(**x)
def _set_external_dipole(self,x): if x is not None and isinstance(x,dict): self.set_external_dipole(**x)
447,941
def set_external_dipole(self, value, position=None): ''' Externally imposed dipole potential. This option overwrites DipoleCorrection if set.
def set_external_dipole(self, value, position=None): ''' Externally imposed dipole potential. This option overwrites DipoleCorrection if set.
447,942
def read_aims(filename): """Import FHI-aims geometry type files. Reads unitcell, atom positions and constraints from a geometry.in file. """ from ase import Atoms from ase.constraints import FixAtoms, FixCartesian import numpy as np atoms = Atoms() fd = open(filename, 'r') lines = fd.readlines() fd.close() positions...
def read_aims(filename): """Import FHI-aims geometry type files. Reads unitcell, atom positions and constraints from a geometry.in file. """ from ase import Atoms from ase.constraints import FixAtoms, FixCartesian import numpy as np atoms = Atoms() fd = open(filename, 'r') lines = fd.readlines() fd.close() positions...
447,943
def __init__(self, spacegroup, setting=1, datafile=None): """Returns a new Spacegroup instance.
def __init__(self, spacegroup, setting=1, datafile=None): """Returns a new Spacegroup instance.
447,944
def _skip_to_blank(f, spacegroup): """Read lines from f until a blank line is encountered.""" while True: line = f.readline() if not line: raise SpacegroupNotFoundError( 'invalid spacegroup: %s, not found in data base'%spacegroup) if not line.strip(): break
def _skip_to_blank(f, spacegroup, setting): """Read lines from f until a blank line is encountered.""" while True: line = f.readline() if not line: raise SpacegroupNotFoundError( 'invalid spacegroup: %s, not found in data base'%spacegroup) if not line.strip(): break
447,945
def _skip_to_blank(f, spacegroup): """Read lines from f until a blank line is encountered.""" while True: line = f.readline() if not line: raise SpacegroupNotFoundError( 'invalid spacegroup: %s, not found in data base'%spacegroup) if not line.strip(): break
def _skip_to_blank(f, spacegroup): """Read lines from f until a blank line is encountered.""" while True: line = f.readline() if not line: raise SpacegroupNotFoundError( 'invalid spacegroup %s, setting %i not found in data base' % ( spacegroup, setting ) ) if not line.strip(): break
447,946
def _skip_to_nonblank(f, spacegroup): """Read lines from f until a nonblank line not starting with a hash (#) is encountered and returns the line.""" while True: line = f.readline() if not line: raise SpacegroupNotFoundError( 'invalid spacegroup %s, not found in data base'%spacegroup) line.strip() if line and not line....
def _skip_to_nonblank(f, spacegroup, setting): """Read lines from f until a nonblank line not starting with a hash (#) is encountered and returns the line.""" while True: line = f.readline() if not line: raise SpacegroupNotFoundError( 'invalid spacegroup %s, not found in data base'%spacegroup) line.strip() if line and ...
447,947
def _skip_to_nonblank(f, spacegroup): """Read lines from f until a nonblank line not starting with a hash (#) is encountered and returns the line.""" while True: line = f.readline() if not line: raise SpacegroupNotFoundError( 'invalid spacegroup %s, not found in data base'%spacegroup) line.strip() if line and not line....
def _skip_to_nonblank(f, spacegroup): """Read lines from f until a nonblank line not starting with a hash (#) is encountered and returns the line.""" while True: line = f.readline() if not line: raise SpacegroupNotFoundError( 'invalid spacegroup %s, not found in data base'%spacegroup) line.strip() if line and not line....
447,948
def _skip_to_nonblank(f, spacegroup): """Read lines from f until a nonblank line not starting with a hash (#) is encountered and returns the line.""" while True: line = f.readline() if not line: raise SpacegroupNotFoundError( 'invalid spacegroup %s, not found in data base'%spacegroup) line.strip() if line and not line....
def _skip_to_nonblank(f, spacegroup): """Read lines from f until a nonblank line not starting with a hash (#) is encountered and returns the line.""" while True: line1 = f.readline() if not line1: raise SpacegroupNotFoundError( 'invalid spacegroup %s, not found in data base'%spacegroup) line.strip() if line and not lin...
447,949
def _skip_to_nonblank(f, spacegroup): """Read lines from f until a nonblank line not starting with a hash (#) is encountered and returns the line.""" while True: line = f.readline() if not line: raise SpacegroupNotFoundError( 'invalid spacegroup %s, not found in data base'%spacegroup) line.strip() if line and not line....
def _skip_to_nonblank(f, spacegroup): """Read lines from f until a nonblank line not starting with a hash (#) is encountered and returns the line.""" while True: line = f.readline() if not line: raise SpacegroupNotFoundError( 'invalid spacegroup %s, not found in data base'%spacegroup) line.strip() if line and not line....
447,950
def _skip_to_nonblank(f, spacegroup): """Read lines from f until a nonblank line not starting with a hash (#) is encountered and returns the line.""" while True: line = f.readline() if not line: raise SpacegroupNotFoundError( 'invalid spacegroup %s, not found in data base'%spacegroup) line.strip() if line and not line....
def _skip_to_nonblank(f, spacegroup): """Read lines from f until a nonblank line not starting with a hash (#) is encountered and returns the line.""" while True: line = f.readline() if not line: raise SpacegroupNotFoundError( 'invalid spacegroup %s, not found in data base'%spacegroup) line.strip() if line and not line....
447,951
def _read_datafile_entry(spg, no, symbol, f): """Read space group data from f to spg.""" spg._no = no spg._symbol = symbol.strip() spg._setting = int(f.readline().split()[1]) spg._centrosymmetric = bool(f.readline().split()[1]) # primitive vectors f.readline() spg._scaled_primitive_cell = np.array([map(float, f.readlin...
def _read_datafile_entry(spg, no, symbol, f): """Read space group data from f to spg.""" spg._no = no spg._symbol = symbol.strip() spg._setting = setting spg._centrosymmetric = bool(f.readline().split()[1]) # primitive vectors f.readline() spg._scaled_primitive_cell = np.array([map(float, f.readline().split()) for i in...
447,952
def _read_datafile(spg, spacegroup, f): if isinstance(spacegroup, int): pass elif isinstance(spacegroup, basestring): spacegroup = ' '.join(spacegroup.strip().split()) else: raise SpacegroupValueError('`spacegroup` must be of type int or str') while True: line = _skip_to_nonblank(f, spacegroup) _no,_symbol = line.strip...
def _read_datafile(spg, spacegroup, setting, f): if isinstance(spacegroup, int): pass elif isinstance(spacegroup, basestring): spacegroup = ' '.join(spacegroup.strip().split()) else: raise SpacegroupValueError('`spacegroup` must be of type int or str') while True: line = _skip_to_nonblank(f, spacegroup) _no,_symbol = l...
447,953
def _read_datafile(spg, spacegroup, f): if isinstance(spacegroup, int): pass elif isinstance(spacegroup, basestring): spacegroup = ' '.join(spacegroup.strip().split()) else: raise SpacegroupValueError('`spacegroup` must be of type int or str') while True: line = _skip_to_nonblank(f, spacegroup) _no,_symbol = line.strip...
def _read_datafile(spg, spacegroup, f): if isinstance(spacegroup, int): pass elif isinstance(spacegroup, basestring): spacegroup = ' '.join(spacegroup.strip().split()) else: raise SpacegroupValueError('`spacegroup` must be of type int or str') while True: line1, line2 = _skip_to_nonblank(f, spacegroup, setting) _no,_sy...
447,954
def _read_datafile(spg, spacegroup, f): if isinstance(spacegroup, int): pass elif isinstance(spacegroup, basestring): spacegroup = ' '.join(spacegroup.strip().split()) else: raise SpacegroupValueError('`spacegroup` must be of type int or str') while True: line = _skip_to_nonblank(f, spacegroup) _no,_symbol = line.strip...
def _read_datafile(spg, spacegroup, f): if isinstance(spacegroup, int): pass elif isinstance(spacegroup, basestring): spacegroup = ' '.join(spacegroup.strip().split()) else: raise SpacegroupValueError('`spacegroup` must be of type int or str') while True: line = _skip_to_nonblank(f, spacegroup) _no,_symbol = line.strip...
447,955
def _read_datafile(spg, spacegroup, f): if isinstance(spacegroup, int): pass elif isinstance(spacegroup, basestring): spacegroup = ' '.join(spacegroup.strip().split()) else: raise SpacegroupValueError('`spacegroup` must be of type int or str') while True: line = _skip_to_nonblank(f, spacegroup) _no,_symbol = line.strip...
def _read_datafile(spg, spacegroup, f): if isinstance(spacegroup, int): pass elif isinstance(spacegroup, basestring): spacegroup = ' '.join(spacegroup.strip().split()) else: raise SpacegroupValueError('`spacegroup` must be of type int or str') while True: line = _skip_to_nonblank(f, spacegroup) _no,_symbol = line.strip...
447,956
def write_aims(filename, atoms): """Method to write FHI-aims geometry files. Writes the atoms positions and constraints (only FixAtoms is supported at the moment). """ from ase.constraints import FixAtoms, FixCartesian import numpy as np fd = open(filename, 'w') i = 0 if atoms.get_pbc().any(): for n, vector in enume...
def write_aims(filename, atoms): """Method to write FHI-aims geometry files. Writes the atoms positions and constraints (only FixAtoms is supported at the moment). """ from ase.constraints import FixAtoms, FixCartesian import numpy as np fd = open(filename, 'w') i = 0 if atoms.get_pbc().any(): for n, vector in enume...
447,957
def set_psp(self, sym=None, z=None, psp=None): ''' set the pseudopotential file for a species or an atomic number.
def set_psp(self, sym=None, z=None, psp=None): ''' set the pseudopotential file for a species or an atomic number.
447,958
def set_psp(self, sym=None, z=None, psp=None): ''' set the pseudopotential file for a species or an atomic number.
defelif self.psp[sym] != psp: self.psp[sym] = psp self.ready = False self.set_status('new') if not self.ready: set_psp(self,elif self.psp[sym] != psp: self.psp[sym] = psp self.ready = False self.set_status('new') if not self.ready: sym=None,elif self.psp[sym] != psp: self.psp[sym] = psp self.ready = False self.set_st...
447,959
def restart(self): ''' Restart the calculator by deleting nc dimensions that will be rewritten on the next calculation. This is sometimes required when certain dimensions change related to unitcell size changes planewave/densitywave cutoffs and kpt changes. These can cause fortran netcdf errors if the data does not mat...
def restart(self): ''' Restart the calculator by deleting nc dimensions that will be rewritten on the next calculation. This is sometimes required when certain dimensions change related to unitcell size changes planewave/densitywave cutoffs and kpt changes. These can cause fortran netcdf errors if the data does not mat...
447,960
def restart(self): ''' Restart the calculator by deleting nc dimensions that will be rewritten on the next calculation. This is sometimes required when certain dimensions change related to unitcell size changes planewave/densitywave cutoffs and kpt changes. These can cause fortran netcdf errors if the data does not mat...
def restart(self): ''' Restart the calculator by deleting nc dimensions that will be rewritten on the next calculation. This is sometimes required when certain dimensions change related to unitcell size changes planewave/densitywave cutoffs and kpt changes. These can cause fortran netcdf errors if the data does not mat...
447,961
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',...
447,962
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',...
447,963
def __init__(self, nwannier, calc, file=None, nbands=None, fixedenergy=None, fixedstates=None, spin=0, initialwannier='random', seed=None, verbose=False): """ Required arguments:
def __init__(self, nwannier, calc, file=None, nbands=None, fixedenergy=None, fixedstates=None, spin=0, initialwannier='random', seed=None, verbose=False): """ Required arguments:
447,964
def __init__(self, atoms, restart=None, logfile='-', maxstep=.2, trajectory=None, c1=.23, c2=0.46, alpha=10., stpmax=50.): """Minimize a function using the BFGS algorithm.
def __init__(self, atoms, restart='restart.pickle', logfile='-', maxstep=.2, trajectory=None, c1=.23, c2=0.46, alpha=10., stpmax=50.): """Minimize a function using the BFGS algorithm.
447,965
def step(self, f): atoms = self.atoms r = atoms.get_positions() r = r.reshape(-1) g = -f.reshape(-1) / self.alpha #g = -f.reshape(-1) p0 = self.p self.update(r, g, self.r0, self.g0, p0) e = atoms.get_potential_energy() / self.alpha #e = self.func(r)
def step(self, f): atoms = self.atoms r = atoms.get_positions() r = r.reshape(-1) g = -f.reshape(-1) / self.alpha #g = -f.reshape(-1) p0 = self.p self.update(r, g, self.r0, self.g0, p0) e = atoms.get_potential_energy() / self.alpha #e = self.func(r)
447,966
def update(self, r, g, r0, g0, p0): self.I = eye(len(self.atoms) * 3, dtype=int) if self.H is None: self.H = eye(3 * len(self.atoms)) #self.H = eye(3 * len(self.atoms)) / self.alpha return else: dr = r - r0 dg = g - g0 if not (self.alpha_k > 0 and abs(np.dot(g,p0))-abs(np.dot(g0,p0)) < 0): return if self.no_update == T...
def update(self, r, g, r0, g0, p0): self.I = eye(len(self.atoms) * 3, dtype=int) if self.H is None: self.H = eye(3 * len(self.atoms)) #self.H = eye(3 * len(self.atoms)) / self.alpha return else: dr = r - r0 dg = g - g0 if not ((self.alpha_k > 0 and abs(np.dot(g,p0))-abs(np.dot(g0,p0)) < 0) \ or self.replay): return if ...
447,967
def replay_trajectory(self, traj): """Initialize hessian from old trajectory.""" if isinstance(traj, str): from ase.io.trajectory import PickleTrajectory traj = PickleTrajectory(traj, 'r') self.H = None atoms = traj[0] r0 = atoms.get_positions().ravel() f0 = atoms.get_forces().ravel() for atoms in traj: r = atoms.get_p...
def replay_trajectory(self, traj): """Initialize hessian from old trajectory.""" if isinstance(traj, str): from ase.io.trajectory import PickleTrajectory traj = PickleTrajectory(traj, 'r') atoms = traj[0] r0 = atoms.get_positions().ravel() f0 = atoms.get_forces().ravel() for atoms in traj: r = atoms.get_positions().rav...
447,968
def replay_trajectory(self, traj): """Initialize hessian from old trajectory.""" if isinstance(traj, str): from ase.io.trajectory import PickleTrajectory traj = PickleTrajectory(traj, 'r') self.H = None atoms = traj[0] r0 = atoms.get_positions().ravel() f0 = atoms.get_forces().ravel() for atoms in traj: r = atoms.get_p...
def replay_trajectory(self, traj): """Initialize hessian from old trajectory.""" if isinstance(traj, str): from ase.io.trajectory import PickleTrajectory traj = PickleTrajectory(traj, 'r') self.H = None atoms = traj[0] r0 = None g0 = None for i in range(0, len(traj) - 1): r = traj[i].get_positions().ravel() g = - traj[...
447,969
def replay_trajectory(self, traj): """Initialize hessian from old trajectory.""" if isinstance(traj, str): from ase.io.trajectory import PickleTrajectory traj = PickleTrajectory(traj, 'r') self.H = None atoms = traj[0] r0 = atoms.get_positions().ravel() f0 = atoms.get_forces().ravel() for atoms in traj: r = atoms.get_p...
def replay_trajectory(self, traj): """Initialize hessian from old trajectory.""" if isinstance(traj, str): from ase.io.trajectory import PickleTrajectory traj = PickleTrajectory(traj, 'r') self.H = None atoms = traj[0] r0 = atoms.get_positions().ravel() f0 = atoms.get_forces().ravel() for atoms in traj: r = atoms.get_p...
447,970
def print_four_vector(self, bracket, numbers): bra, ket = bracket (x,y,z) = numbers a = 2*x - y b = -x + 2*y c = -x -y d = 2*z print " %s%d, %d, %d%s ~ %s%d, %d, %d, %d%s" % \ (bra,x,y,z,ket, bra,a,b,c,d,ket)
def print_four_vector(self, bracket, numbers): bra, ket = bracket (x,y,z) = numbers a = 2*x - y b = -x + 2*y c = -x -y d = 2*z print " %s%d, %d, %d%s ~ %s%d, %d, %d, %d%s" % \ (bra,x,y,z,ket, bra,a,b,c,d,ket)
447,971
def mol_role(role, rawtext, text, lineno, inliner, options={}, content=[]): n = [] t = '' while text: if text[0] == '_': n.append(nodes.inline(text=t)) t = '' n.append(nodes.subscript(text=text[1])) text = text[2:] else: t += text[0] text = text[1:] n.append(nodes.inline(text=t)) return n, []
def mol_role(role, rawtext, text, lineno, inliner, options={}, content=[]): n = [] t = '' while text: if text[0] == '_': n.append(nodes.Text(t)) t = '' n.append(nodes.subscript(text=text[1])) text = text[2:] else: t += text[0] text = text[1:] n.append(nodes.Text(t)) return n, []
447,972
def mol_role(role, rawtext, text, lineno, inliner, options={}, content=[]): n = [] t = '' while text: if text[0] == '_': n.append(nodes.inline(text=t)) t = '' n.append(nodes.subscript(text=text[1])) text = text[2:] else: t += text[0] text = text[1:] n.append(nodes.inline(text=t)) return n, []
def mol_role(role, rawtext, text, lineno, inliner, options={}, content=[]): n = [] t = '' while text: if text[0] == '_': n.append(nodes.Text(t)) t = '' n.append(nodes.subscript(text=text[1])) text = text[2:] else: t += text[0] text = text[1:] n.append(nodes.Text(t)) return n, []
447,973
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 function is used to create slabs of different sizes and orientations. The vectors *a*, *b* and...
447,974
def write_svnrevision(output): f = open(path.join('ase', 'svnrevision.py'),'w') f.write('svnrevision = "%s"\n' % output) f.close() print 'svnrevision = ' +output+' written to ase/svnrevision.py' # assert svn:ignore property if the installation is under svn control # because svnrevision.py has to be ignored by svn! cmd ...
def write_svnrevision(output, asedir='ase'): fname = path.join(asedir, 'svnrevision.py') f = open(fname,'w') f.write('svnrevision = "%s"\n' % output) f.close() print 'svnrevision = ' +output+' written to ase/svnrevision.py' # assert svn:ignore property if the installation is under svn control # because svnrevision.py h...
447,975
def write_svnrevision(output): f = open(path.join('ase', 'svnrevision.py'),'w') f.write('svnrevision = "%s"\n' % output) f.close() print 'svnrevision = ' +output+' written to ase/svnrevision.py' # assert svn:ignore property if the installation is under svn control # because svnrevision.py has to be ignored by svn! cmd ...
def write_svnrevision(output): f = open(path.join('ase', 'svnrevision.py'),'w') f.write('svnrevision = "%s"\n' % output) f.close() print 'svnrevision = ' + output + ' written to ' + fname # assert svn:ignore property if the installation is under svn control # because svnrevision.py has to be ignored by svn! cmd = popen...
447,976
def write_svnrevision(output): f = open(path.join('ase', 'svnrevision.py'),'w') f.write('svnrevision = "%s"\n' % output) f.close() print 'svnrevision = ' +output+' written to ase/svnrevision.py' # assert svn:ignore property if the installation is under svn control # because svnrevision.py has to be ignored by svn! cmd ...
def write_svnrevision(output): f = open(path.join('ase', 'svnrevision.py'),'w') f.write('svnrevision = "%s"\n' % output) f.close() print 'svnrevision = ' +output+' written to ase/svnrevision.py' # assert svn:ignore property if the installation is under svn control # because svnrevision.py has to be ignored by svn! cmd ...
447,977
def new_atoms(self, atoms, init_magmom=False): "Set a new atoms object." self.notify_vulnerable() self.reset_tools_modes() rpt = getattr(self.images, 'repeat', None) self.images.repeat_images(np.ones(3, int)) self.images.initialize([atoms], init_magmom=init_magmom) self.frame = 0 # Prevent crashes self.images.repeat...
def new_atoms(self, atoms, init_magmom=False): "Set a new atoms object." self.reset_tools_modes() rpt = getattr(self.images, 'repeat', None) self.images.repeat_images(np.ones(3, int)) self.images.initialize([atoms], init_magmom=init_magmom) self.frame = 0 # Prevent crashes self.images.repeat_images(rpt) self.set_col...
447,978
def birch(self,parameters,V): ''' From Intermetallic compounds: Principles and Practice, Vol. I: Princples Chapter 9 pages 195-210 by M. Mehl. B. Klein, D. Papaconstantopoulos paper downloaded from Web
def birch(self,parameters,V): ''' From Intermetallic compounds: Principles and Practice, Vol. I: Principles Chapter 9 pages 195-210 by M. Mehl. B. Klein, D. Papaconstantopoulos paper downloaded from Web
447,979
def __init__(self, gui): SetupWindow.__init__(self) self.set_title("Nanotube") vbox = gtk.VBox()
def __init__(self, gui): SetupWindow.__init__(self) self.set_title("Graphene") vbox = gtk.VBox()
447,980
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 the 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....
447,981
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....
447,982
def __init__(self, label='dftb', write_dftb=False, charge=0.0, include_dispersion=False, do_spin_polarized=False, unpaired_electrons=0.0, fermi_temperature=0.0, scc=False): """Construct DFTB-calculator object.
def __init__(self, label='dftb', write_dftb=False, charge=0.0, include_dispersion=False, do_spin_polarized=False, unpaired_electrons=0.0, fermi_temperature=0.0, scc=False): """Construct DFTB-calculator object.
447,983
def initialize(self, atoms): self.par = {} self.rc = 0.0 self.numbers = atoms.get_atomic_numbers() for Z in self.numbers: if Z not in self.par: p = parameters[chemical_symbols[Z]] s0 = p[1] * Bohr eta2 = p[3] / Bohr kappa = p[4] / Bohr rc = beta * s0 * 0.5 * (sqrt(3) + sqrt(4)) x = eta2 * beta * s0 gamma1 = 0.0 gamma2 ...
def initialize(self, atoms): self.par = {} self.rc = 0.0 self.numbers = atoms.get_atomic_numbers() for Z in self.numbers: if Z not in self.par: p = parameters[chemical_symbols[Z]] s0 = p[1] * Bohr eta2 = p[3] / Bohr kappa = p[4] / Bohr x = eta2 * beta * s0 gamma1 = 0.0 gamma2 = 0.0 if p[7] == 'fcc': for i, n in enumera...
447,984
def initialize(self, atoms): self.par = {} self.rc = 0.0 self.numbers = atoms.get_atomic_numbers() for Z in self.numbers: if Z not in self.par: p = parameters[chemical_symbols[Z]] s0 = p[1] * Bohr eta2 = p[3] / Bohr kappa = p[4] / Bohr rc = beta * s0 * 0.5 * (sqrt(3) + sqrt(4)) x = eta2 * beta * s0 gamma1 = 0.0 gamma2 ...
def initialize(self, atoms): self.par = {} self.rc = 0.0 self.numbers = atoms.get_atomic_numbers() for Z in self.numbers: if Z not in self.par: p = parameters[chemical_symbols[Z]] s0 = p[1] * Bohr eta2 = p[3] / Bohr kappa = p[4] / Bohr rc = beta * s0 * 0.5 * (sqrt(3) + sqrt(4)) x = eta2 * beta * s0 gamma1 = 0.0 gamma2 ...
447,985
def initialize(self, atoms): self.par = {} self.rc = 0.0 self.numbers = atoms.get_atomic_numbers() for Z in self.numbers: if Z not in self.par: p = parameters[chemical_symbols[Z]] s0 = p[1] * Bohr eta2 = p[3] / Bohr kappa = p[4] / Bohr rc = beta * s0 * 0.5 * (sqrt(3) + sqrt(4)) x = eta2 * beta * s0 gamma1 = 0.0 gamma2 ...
def initialize(self, atoms): self.par = {} self.rc = 0.0 self.numbers = atoms.get_atomic_numbers() for Z in self.numbers: if Z not in self.par: p = parameters[chemical_symbols[Z]] s0 = p[1] * Bohr eta2 = p[3] / Bohr kappa = p[4] / Bohr rc = beta * s0 * 0.5 * (sqrt(3) + sqrt(4)) x = eta2 * beta * s0 gamma1 = 0.0 gamma2 ...
447,986
def initialize(self, atoms): self.par = {} self.rc = 0.0 self.numbers = atoms.get_atomic_numbers() for Z in self.numbers: if Z not in self.par: p = parameters[chemical_symbols[Z]] s0 = p[1] * Bohr eta2 = p[3] / Bohr kappa = p[4] / Bohr rc = beta * s0 * 0.5 * (sqrt(3) + sqrt(4)) x = eta2 * beta * s0 gamma1 = 0.0 gamma2 ...
def initialize(self, atoms): self.par = {} self.rc = 0.0 self.numbers = atoms.get_atomic_numbers() for Z in self.numbers: if Z not in self.par: p = parameters[chemical_symbols[Z]] s0 = p[1] * Bohr eta2 = p[3] / Bohr kappa = p[4] / Bohr rc = beta * s0 * 0.5 * (sqrt(3) + sqrt(4)) x = eta2 * beta * s0 gamma1 = 0.0 gamma2 ...
447,987
def initialize(self, atoms): self.par = {} self.rc = 0.0 self.numbers = atoms.get_atomic_numbers() for Z in self.numbers: if Z not in self.par: p = parameters[chemical_symbols[Z]] s0 = p[1] * Bohr eta2 = p[3] / Bohr kappa = p[4] / Bohr rc = beta * s0 * 0.5 * (sqrt(3) + sqrt(4)) x = eta2 * beta * s0 gamma1 = 0.0 gamma2 ...
def initialize(self, atoms): self.par = {} self.rc = 0.0 self.numbers = atoms.get_atomic_numbers() for Z in self.numbers: if Z not in self.par: p = parameters[chemical_symbols[Z]] s0 = p[1] * Bohr eta2 = p[3] / Bohr kappa = p[4] / Bohr rc = beta * s0 * 0.5 * (sqrt(3) + sqrt(4)) x = eta2 * beta * s0 gamma1 = 0.0 gamma2 ...
447,988
def initialize(self, atoms): self.par = {} self.rc = 0.0 self.numbers = atoms.get_atomic_numbers() for Z in self.numbers: if Z not in self.par: p = parameters[chemical_symbols[Z]] s0 = p[1] * Bohr eta2 = p[3] / Bohr kappa = p[4] / Bohr rc = beta * s0 * 0.5 * (sqrt(3) + sqrt(4)) x = eta2 * beta * s0 gamma1 = 0.0 gamma2 ...
def initialize(self, atoms): self.par = {} self.rc = 0.0 self.numbers = atoms.get_atomic_numbers() for Z in self.numbers: if Z not in self.par: p = parameters[chemical_symbols[Z]] s0 = p[1] * Bohr eta2 = p[3] / Bohr kappa = p[4] / Bohr rc = beta * s0 * 0.5 * (sqrt(3) + sqrt(4)) x = eta2 * beta * s0 gamma1 = 0.0 gamma2 ...
447,989
def calculate(self, atoms): self.positions = atoms.get_positions().copy() self.cell = atoms.get_cell().copy() self.pbc = atoms.get_pbc().copy() icell = np.linalg.inv(self.cell) scaled = np.dot(self.positions, icell) N = [] for i in range(3): if self.pbc[i]: scaled[:, i] %= 1.0 v = icell[:, i] h = 1 / sqrt(np.dot(v, v)...
def calculate(self, atoms): self.positions = atoms.get_positions().copy() self.cell = atoms.get_cell().copy() self.pbc = atoms.get_pbc().copy() icell = np.linalg.inv(self.cell) scaled = np.dot(self.positions, icell) N = [] for i in range(3): if self.pbc[i]: scaled[:, i] %= 1.0 v = icell[:, i] h = 1 / sqrt(np.dot(v, v)...
447,990
def calculate(self, atoms): self.positions = atoms.get_positions().copy() self.cell = atoms.get_cell().copy() self.pbc = atoms.get_pbc().copy() icell = np.linalg.inv(self.cell) scaled = np.dot(self.positions, icell) N = [] for i in range(3): if self.pbc[i]: scaled[:, i] %= 1.0 v = icell[:, i] h = 1 / sqrt(np.dot(v, v)...
def calculate(self, atoms): self.positions = atoms.get_positions().copy() self.cell = atoms.get_cell().copy() self.pbc = atoms.get_pbc().copy() icell = np.linalg.inv(self.cell) scaled = np.dot(self.positions, icell) N = [] for i in range(3): if self.pbc[i]: scaled[:, i] %= 1.0 v = icell[:, i] h = 1 / sqrt(np.dot(v, v)...
447,991
def calculate(self, atoms): self.positions = atoms.get_positions().copy() self.cell = atoms.get_cell().copy() self.pbc = atoms.get_pbc().copy() icell = np.linalg.inv(self.cell) scaled = np.dot(self.positions, icell) N = [] for i in range(3): if self.pbc[i]: scaled[:, i] %= 1.0 v = icell[:, i] h = 1 / sqrt(np.dot(v, v)...
def calculate(self, atoms): self.positions = atoms.get_positions().copy() self.cell = atoms.get_cell().copy() self.pbc = atoms.get_pbc().copy() icell = np.linalg.inv(self.cell) scaled = np.dot(self.positions, icell) N = [] for i in range(3): if self.pbc[i]: scaled[:, i] %= 1.0 v = icell[:, i] h = 1 / sqrt(np.dot(v, v)...
447,992
def calculate(self, atoms): self.positions = atoms.get_positions().copy() self.cell = atoms.get_cell().copy() self.pbc = atoms.get_pbc().copy() icell = np.linalg.inv(self.cell) scaled = np.dot(self.positions, icell) N = [] for i in range(3): if self.pbc[i]: scaled[:, i] %= 1.0 v = icell[:, i] h = 1 / sqrt(np.dot(v, v)...
def calculate(self, atoms): self.positions = atoms.get_positions().copy() self.cell = atoms.get_cell().copy() self.pbc = atoms.get_pbc().copy() icell = np.linalg.inv(self.cell) scaled = np.dot(self.positions, icell) N = [] for i in range(3): if self.pbc[i]: scaled[:, i] %= 1.0 v = icell[:, i] h = 1 / sqrt(np.dot(v, v)...
447,993
def interact1(self, a1, a2, d, r, p, ksi): x = exp(acut * (r - p['rc'])) theta = 1.0 / (1.0 + x) y = (0.5 * p['V0'] * exp(-p['kappa'] * (r / beta - p['s0'])) * ksi / p['gamma2'] * theta) self.energy -= y f = y * (p['kappa'] / beta + acut * theta * x) * d / r self.forces[a1] += f self.forces[a2] -= f self.sigma1[a1] += ...
def interact1(self, a1, a2, d, r, p, ksi): x = exp(acut * (r - p['rc'])) theta = 1.0 / (1.0 + x) y = (0.5 * p1['V0'] * exp(-p2['kappa'] * (r / beta - p2['s0'])) * ksi / p1['gamma2'] * theta) self.energy -= y f = y * (p['kappa'] / beta + acut * theta * x) * d / r self.forces[a1] += f self.forces[a2] -= f self.sigma1[a1]...
447,994
def interact1(self, a1, a2, d, r, p, ksi): x = exp(acut * (r - p['rc'])) theta = 1.0 / (1.0 + x) y = (0.5 * p['V0'] * exp(-p['kappa'] * (r / beta - p['s0'])) * ksi / p['gamma2'] * theta) self.energy -= y f = y * (p['kappa'] / beta + acut * theta * x) * d / r self.forces[a1] += f self.forces[a2] -= f self.sigma1[a1] += ...
def interact1(self, a1, a2, d, r, p, ksi): x = exp(acut * (r - p['rc'])) theta = 1.0 / (1.0 + x) y = (0.5 * p['V0'] * exp(-p['kappa'] * (r / beta - p['s0'])) * ksi / p['gamma2'] * theta) self.energy -= y f = y * (p2['kappa'] / beta + self.acut * theta * x) * d / r self.forces[a1] += f self.forces[a2] -= f self.sigma1[a...
447,995
def interact1(self, a1, a2, d, r, p, ksi): x = exp(acut * (r - p['rc'])) theta = 1.0 / (1.0 + x) y = (0.5 * p['V0'] * exp(-p['kappa'] * (r / beta - p['s0'])) * ksi / p['gamma2'] * theta) self.energy -= y f = y * (p['kappa'] / beta + acut * theta * x) * d / r self.forces[a1] += f self.forces[a2] -= f self.sigma1[a1] += ...
def interact1(self, a1, a2, d, r, p, ksi): x = exp(acut * (r - p['rc'])) theta = 1.0 / (1.0 + x) y = (0.5 * p['V0'] * exp(-p['kappa'] * (r / beta - p['s0'])) * ksi / p['gamma2'] * theta) self.energy -= y f = y * (p['kappa'] / beta + acut * theta * x) * d / r self.forces[a1] += f self.forces[a2] -= f self.sigma1[a1] += ...
447,996
def interact2(self, a1, a2, d, r, p, ksi): x = exp(acut * (r - p['rc'])) theta = 1.0 / (1.0 + x) y = (exp(-p['eta2'] * (r - beta * p['s0'])) * ksi / p['gamma1'] * theta * self.deds[a1]) f = y * (p['eta2'] + acut * theta * x) * d / r self.forces[a1] -= f self.forces[a2] += f
def interact2(self, a1, a2, d, r, p, ksi): x = exp(acut * (r - p['rc'])) theta = 1.0 / (1.0 + x) y = (exp(-p2['eta2'] * (r - beta * p2['s0'])) * ksi / p1['gamma1'] * theta * self.deds[a1]) f = y * (p2['eta2'] + self.acut * theta * x) * d / r self.forces[a1] -= f self.forces[a2] += f
447,997
def __init__(self): self.atoms = None
def __init__(self): self.atoms = None
447,998
def index_startswith(lines, string): for i, line in enumerate(lines): if line.startswith(string): return i raise ValueError
def index_startswith(lines, string): for i, line in enumerate(lines): if line.startswith(string): return i raise ValueError
447,999