bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def set_startup_hook(function=None): # TODO add pass
def set_startup_hook(function=None): # TODO addsys._jy_interpreter.startupHook = function def set_pre_input_hook(function=None): print "Not implemented: set_pre_input_hook", function
447,800
def set_pre_input_hook(function=None): # TODO add pass
def set_pre_input_hook(function=None): # TODO add pass
447,801
def set_completer(function=None): """set_completer([function]) -> None Set or remove the completer function. The function is called as function(text, state), for state in 0, 1, 2, ..., until it returns a non-string. It should return the next possible completion starting with 'text'.""" _completion_function = function ...
def set_completer(function=None): """set_completer([function]) -> None Set or remove the completer function. The function is called as function(text, state), for state in 0, 1, 2, ..., until it returns a non-string. It should return the next possible completion starting with 'text'.""" global _completer_function _comp...
447,802
def complete_handler(buffer, cursor, candidates): for state in xrange(100): # TODO arbitrary, what's the number used by gnu readline? completion = None try: completion = function(buffer[:cursor], state) except: pass if completion: candidates.add(completion) else: break return 0
def complete_handler(buffer, cursor, candidates): for state in xrange(100): # TODO arbitrary, what's the number used by gnu readline? completion = None try: completion = function(delimited, state) except: pass if completion: candidates.add(completion) else: break return 0
447,803
def complete_handler(buffer, cursor, candidates): for state in xrange(100): # TODO arbitrary, what's the number used by gnu readline? completion = None try: completion = function(buffer[:cursor], state) except: pass if completion: candidates.add(completion) else: break return 0
def complete_handler(buffer, cursor, candidates): for state in xrange(100): # TODO arbitrary, what's the number used by gnu readline? completion = None try: completion = function(buffer[:cursor], state) except: pass if completion: candidates.add(completion) else: break return 0
447,804
def get_completer(): return _completion_function
def get_completer(): return _completer_function def _get_delimited(buffer, cursor): start = cursor for i in xrange(cursor-1, -1, -1): if buffer[i] in _completer_delims: break start = i return start, cursor
447,805
def get_begidx(): # TODO add pass
def get_begidx(): # TODO addreturn _get_delimited(str(reader.cursorBuffer.buffer), reader.cursorBuffer.cursor)[0]
447,806
def get_endidx(): # TODO add pass
def get_endidx(): # TODO addreturn _get_delimited(str(reader.cursorBuffer.buffer), reader.cursorBuffer.cursor)[1]
447,807
def set_completer_delims(string): pass
def set_completer_delims(string): global _completer_delims, _completer_delims_set _completer_delims = string _completer_delims_set = set(string)
447,808
def get_completer_delims(): pass
def get_completer_delims(): return _completer_delims
447,809
def test_main(): test.test_support.run_unittest(SysTest, ShadowingTest)
def test_main(): test.test_support.run_unittest(SysTest, ShadowingTest, SyspathResourceTest)
447,810
def test_main(): test_support.run_unittest(FunctionTypeTestCase, MethodHashCodeTestCase)
def test_main(): test_support.run_unittest(FunctionTypeTestCase, MethodHashCodeTestCase, SingleMethodInterfaceTestCase)
447,811
def parse_and_bind(string): if string == "tab: complete": try: keybindings_field = _reader.class.getDeclaredField("keybindings") keybindings_field.setAccessible(True) keybindings = keybindings_field.get(_reader) COMPLETE = _reader.KEYMAP_NAMES.get('COMPLETE') if java.lang.reflect.Array.getShort(keybindings, 9) != COMPL...
def parse_and_bind(string): if string == "tab: complete": try: keybindings_field = _reader.class.getDeclaredField("keybindings") keybindings_field.setAccessible(True) keybindings = keybindings_field.get(_reader) COMPLETE = _reader.KEYMAP_NAMES.get('COMPLETE') if java.lang.reflect.Array.getShort(keybindings, 9) != COMPL...
447,812
def parse_and_bind(string): if string == "tab: complete": try: keybindings_field = _reader.class.getDeclaredField("keybindings") keybindings_field.setAccessible(True) keybindings = keybindings_field.get(_reader) COMPLETE = _reader.KEYMAP_NAMES.get('COMPLETE') if java.lang.reflect.Array.getShort(keybindings, 9) != COMPL...
def parse_and_bind(string): if string == "tab: complete": try: keybindings_field = _reader.class.getDeclaredField("keybindings") keybindings_field.setAccessible(True) keybindings = keybindings_field.get(_reader) COMPLETE = _reader.KEYMAP_NAMES.get('COMPLETE') if java.lang.reflect.Array.getShort(keybindings, 9) != COMPL...
447,813
def read_init_file(filename=None): warn("read_init_file: %s" % (filename,), NotImplementedWarning)
def read_init_file(filename=None): warn("read_init_file: %s" % (filename,), NotImplementedWarning, "module", 2)
447,814
def remove_history_item(pos): if _history_list: _history_list.remove(pos) else: warn("Cannot remove history item at position: %s" % (pos,), SecurityWarning)
def remove_history_item(pos): if _history_list: _history_list.remove(pos) else: warn("Cannot remove history item at position: %s" % (pos,), SecurityWarning, stacklevel=2)
447,815
def set_pre_input_hook(function=None): warn("set_pre_input_hook %s" % (function,), NotImplementedWarning)
def set_pre_input_hook(function=None): warn("set_pre_input_hook %s" % (function,), NotImplementedWarning, stacklevel=2)
447,816
def test_main(): test_support.run_unittest(InstantiationTest, BeanTest, SysIntegrationTest, IOTest, JavaReservedNamesTest, PyReservedNamesTest, ImportTest, ColorTest, TreePathTest, BigNumberTest, JavaStringTest, JavaDelegationTest, SecurityManagerTest, JavaWrapperCustomizationTest, SerializationTest)
def test_main(): test_support.run_unittest(InstantiationTest, BeanTest, SysIntegrationTest, IOTest, JavaReservedNamesTest, PyReservedNamesTest, ImportTest, ColorTest, TreePathTest, BigNumberTest, JavaStringTest, JavaDelegationTest, SecurityManagerTest, JavaWrapperCustomizationTest, SerializationTest, UnicodeTest)
447,817
def serve_forever(self): """Handle one request at a time until doomsday.""" while 1: self.handle_request()
def serve_forever(self): """Handle one request at a time until doomsday.""" while 1: self.handle_request()
447,818
def handle_request(self): """Handle one request, possibly blocking.""" try: request, client_address = self.get_request() except socket.error: return if self.verify_request(request, client_address): try: self.process_request(request, client_address) except: self.handle_error(request, client_address) self.close_request(r...
def handle_request(self): """Handle one request, possibly blocking.""" try: os.remove(fn) except os.error: pass testfiles[:] = [] def testloop(proto, servers, hdlrcls, testfunc): for svrcls in servers: addr = pickaddr(proto) if verbose: print "ADDR =", addr print "CLASS =", svrcls t = ServerThread(addr, svrcls, hdlrcl...
447,819
def handle_request(self): """Handle one request, possibly blocking.""" try: request, client_address = self.get_request() except socket.error: return if self.verify_request(request, client_address): try: self.process_request(request, client_address) except: self.handle_error(request, client_address) self.close_request(r...
def handle_request(self): """Handle one request, possibly blocking.""" try: request, client_address = self.get_request() except socket.error: return if self.verify_request(request, client_address): try: self.process_request(request, client_address) except: self.handle_error(request, client_address) self.close_request(r...
447,820
def check_list(self, control, results, initial): for result in results: try: len(result) except: print result self.assertEquals(len(control), len(result), "%s is wrong for %s" % (type(result), initial)) for pvalue, jvalue in zip(control, result): self.assertEquals(pvalue, jvalue)
def _arraylist_of(self, xs): """ Converts a python list to a java.util.ArrayList """ a = ArrayList() a.addAll( xs ) return a def check_list(self, control, results, list_type_names, initial, test_name): for result, type_name in zip(results, list_type_names): try: len(result) except: print result self.assertEquals(len(c...
447,821
def check_list(self, control, results, initial): for result in results: try: len(result) except: print result self.assertEquals(len(control), len(result), "%s is wrong for %s" % (type(result), initial)) for pvalue, jvalue in zip(control, result): self.assertEquals(pvalue, jvalue)
def check_list(self, control, results, initial): for result in results: try: len(result) except: print result self.assertEquals(len(control), len(result), "%s is wrong for %s" % (type(result), initial)) for pvalue, jvalue in zip(control, result): self.assertEquals(pvalue, jvalue)
447,822
def _list_op_test(self, initial_value, op_func, check_value): """ Tests a list operation
def _list_op_test(self, initial_value, op_func, check_value): """ Tests a list operation
447,823
def _list_op_test(self, initial_value, op_func, check_value): """ Tests a list operation
def _list_op_test(self, initial_value, op_func, check_value): """ Tests a list operation
447,824
def _list_op_test(self, initial_value, op_func, check_value): """ Tests a list operation
def _list_op_test(self, initial_value, op_func, check_value): """ Tests a list operation
447,825
def test_get_integer(self): initial_value = range(0, 5)
def test_get_integer(self): initial_value = range(0, 5)
447,826
def _f(xs): xs[index] = 100
def _f(xs): xs[index] = 100
447,827
def test_set_slice(self): initial_value = range(0, 10)
def test_set_slice(self): initial_value = range(0, 10)
447,828
def _f(xs): xs[i:j:k] = v
def _f(xs): xs[i:j:k] = v
447,829
def _f(xs): del xs[index]
def _f(xs): del xs[index]
447,830
def test_del_slice(self): initial_value = range(0,10)
def test_del_slice(self): initial_value = range(0,10)
447,831
def _f(xs): del xs[i:j:k]
def _f(xs): del xs[i:j:k]
447,832
def size(self): return self._jffi_type.size
def size(self): return self._jffi_type.size
447,833
def sizeof(type): if hasattr(type, '_jffi_type'): return type._jffi_type.size else: raise TypeError("this type has no size")
def sizeof(type): if hasattr(type, '_jffi_type'): return type._jffi_type.size() else: raise TypeError("this type has no size")
447,834
def alignment(type): return type._jffi_type.alignment
def alignment(type): return type._jffi_type.alignment()
447,835
def test_java_serialization(self): date_list = [Date(), Date()] output = ByteArrayOutputStream() serializer = ObjectOutputStream(output) serializer.writeObject(date_list) serializer.close()
def test_java_serialization(self): date_list = [Date(), Date()] output = ByteArrayOutputStream() serializer = ObjectOutputStream(output) serializer.writeObject(date_list) serializer.close()
447,836
def characters(self, char, start, len): self._cont_handler.characters(String(char, start, len).getBytes('utf-8').tostring().decode('utf-8'))
def characters(self, char, start, len): self._cont_handler.characters(String(char, start, len).getBytes('utf-8').tostring().decode('utf-8'))
447,837
def ignorableWhitespace(self, char, start, len): self._cont_handler.ignorableWhitespace(String(char, start, len).getBytes('utf-8').tostring().decode('utf-8'))
def ignorableWhitespace(self, char, start, len): self._cont_handler.ignorableWhitespace(String(char, start, len).getBytes('utf-8').tostring().decode('utf-8'))
447,838
def extract_ov_meths(jcl,envl_class): meths = java.lang.Class.getDeclaredMethods(jcl) names = [ m.name for m in meths] meth_dict = {} for name in names: if name.startswith('ov_') and not meth_dict.has_key(name): meth_dict[name] = envl_class(name,[ m for m in meths if m.name == name ]) return meth_dict
def extract_ov_meths(jcl,envl_class): meths = java.lang.Class.getDeclaredMethods(jcl) names = [ m.name for m in meths] meth_dict = {} for name in names: if name.startswith('ov_') and not meth_dict.has_key(name): meth_dict[name] = envl_class(name,[ m for m in meths if m.name == name ]) return meth_dict
447,839
def printout(meth_dict,lbl,rng,args): for i in rng: print meth_dict['ov_%s%s' % (lbl,i)](jo,args)
def printout(meth_dict,lbl,rng,args): for i in rng: print meth_dict['ov_%s%s' % (lbl,i)](jo,args)
447,840
def printout(meth_dict,lbl,rng,args): for i in rng: print meth_dict['ov_%s%s' % (lbl,i)](jo,args)
def printout(meth_dict,lbl,rng,args): for i in rng: print meth_dict['ov_%s%s' % (lbl,i)](jo,args)
447,841
def __init__(self, source): if isinstance(source, str): javasax.InputSource.__init__(self, source) elif hasattr(source, "read"):#file like object f = source javasax.InputSource.__init__(self, FilelikeInputStream(f)) if hasattr(f, "name"): self.setSystemId(f.name) else:#xml.sax.xmlreader.InputSource object #Use byte str...
def __init__(self, source): if isinstance(source, basestring): javasax.InputSource.__init__(self, source) elif hasattr(source, "read"):#file like object f = source javasax.InputSource.__init__(self, FilelikeInputStream(f)) if hasattr(f, "name"): self.setSystemId(f.name) else:#xml.sax.xmlreader.InputSource object #Use b...
447,842
def test_main(): test_support.run_unittest(ReferencesTestCase)
def test_main(): test_support.run_unittest(ReferencesTestCase, ArgsTestCase)
447,843
def test_lock_type(self): "thread.LockType should exist" t = thread.LockType self.assertEquals(t, type(thread.allocate_lock()), "thread.LockType has wrong value")
def test_lock_type(self): """thread.LockType should exist""" t = thread.LockType self.assertEquals(t, type(thread.allocate_lock()), "thread.LockType has wrong value")
447,844
def comment(self, char, start, len): print "Content handler is %s" % self._cont_handler.__class__ self._cont_handler.comment(unicode(String(char, start, len)))
def comment(self, char, start, len): self._cont_handler.comment(unicode(String(char, start, len)))
447,845
def on_disconnected(self): self._logger.warning('TCP/IP connection lost.')
def on_disconnected(self): self._logger.warning('TCP/IP connection lost.')
447,846
def send(self, destination=None, message='', headers=None, **keyword_headers): """Add message to local queue for sending to MSG server. @param destination: An MSG topic or queue, e.g. /topic/dashboard.test. @param message: A string or dictionary of key-value pairs. @param headers: A dictionary of headers. @param keywo...
def send(self, destination=None, message='', headers=None, **keyword_headers): """Add message to local queue for sending to MSG server. @param destination: An MSG topic or queue, e.g. /topic/dashboard.test. @param message: A string or dictionary of key-value pairs. @param headers: A dictionary of headers. @param keywo...
447,847
def _disconnect(self): """Disconnects (quietly) from MSG server if not already disconnected.""" cx = self._cx if cx is not None: self._log(logging.DEBUG, 'Disconnecting') self._cx = None if cx.is_connected(): try: cx.disconnect() except Exception: self._log(logging.WARNING, 'Exception on disconnect.', exc_info=True) se...
def _disconnect(self): """Disconnects (quietly) from MSG server if not already disconnected.""" cx = self._cx if cx is not None: self._log(logging.DEBUG, 'Disconnecting') self._cx = None if cx.is_connected(): try: cx.disconnect() except Exception: self._log(logging.DEBUG, 'Exception on disconnect.', exc_info=True) self...
447,848
def run(self): """Send messages, connecting as necessary and disconnecting after idle_timeout seconds. """ # indicates time in seconds since last connect/send attempt idle_time = 0 # indicates time in seconds before next connect/send attempt backoff_time = 0 # run unless should_stop and (queue empty or backing off) whi...
def run(self): """Send messages, connecting as necessary and disconnecting after idle_timeout seconds. """ # indicates time in seconds since last connect/send attempt idle_time = 0 # indicates time in seconds before next connect/send attempt backoff_time = 0 # run unless should_stop and (queue empty or backing off) whi...
447,849
def findSongBySize(self, size): cursor = self.db.cursor() query = cursor.execute( self.querystring + " where tracks.filesize = " + size ) results = cursor.fetchall() return self.rowsToSongs( results )
def findSongBySize(self, size): cursor = self.db.cursor() query = cursor.execute( self.querystring + " where tracks.filesize = " + str(size) ) results = cursor.fetchall() return self.rowsToSongs( results )
447,850
def correlateSong( self, song, confirm, fastAndLoose, promptForDisambiguate ): match = None matches = self.parser.findSongBySize( song.size ); matchcount = len(matches) # no results if matchcount == 0: print "\t no matches found" self.zeroMatches = self.zeroMatches + 1 # full match elif matchcount == 1: match = match...
def correlateSong( self, song, confirm, fastAndLoose, promptForDisambiguate ): match = None matches = self.parser.findSongBySize( song.size ); matchcount = len(matches) # no results if matchcount == 0: print "\t no matches found" self.zeroMatches = self.zeroMatches + 1 # full match elif matchcount == 1: match = match...
447,851
def correlateSong( self, song, confirm, fastAndLoose, promptForDisambiguate ): match = None matches = self.parser.findSongBySize( song.size ); matchcount = len(matches) # no results if matchcount == 0: print "\t no matches found" self.zeroMatches = self.zeroMatches + 1 # full match elif matchcount == 1: match = match...
def correlateSong( self, song, confirm, fastAndLoose, promptForDisambiguate ): match = None matches = self.parser.findSongBySize( song.size ); matchcount = len(matches) # no results if matchcount == 0: print "\t no matches found" self.zeroMatches = self.zeroMatches + 1 # full match elif matchcount == 1: match = match...
447,852
def correlateSong( self, song, confirm, fastAndLoose, promptForDisambiguate ): match = None matches = self.parser.findSongBySize( song.size ); matchcount = len(matches) # no results if matchcount == 0: print "\t no matches found" self.zeroMatches = self.zeroMatches + 1 # full match elif matchcount == 1: match = match...
def correlateSong( self, song, confirm, fastAndLoose, promptForDisambiguate ): match = None matches = self.parser.findSongBySize( song.size ); matchcount = len(matches) # no results if matchcount == 0: print "\t no matches found" self.zeroMatches = self.zeroMatches + 1 # full match elif matchcount == 1: match = match...
447,853
def __init__(self, location) self.doc = libxml2.parseFile( location ) self.xpathContext = doc.xpathNewContext() return
def __init__(self, location): self.doc = libxml2.parseFile( location ) self.xpathContext = doc.xpathNewContext() return
447,854
def getSongs(self): return getPlaylistFiles('Library')
def getSongs(self): return self.getPlaylistFiles('Library')
447,855
def __init__(self, WMPSong): self.wmpNode = WMPSong self.artist = WMPSong.getItemInfo("WM/AlbumArtist") self.album = WMPSong.getItemInfo("WM/AlbumTitle") self.title = WMPSong.name self.size = WMPSong.getItemInfo("FileSize") self.rating = WMPSong.getItemInfo("UserRating") self.playcount = WMPSong.getItemInfo("UserPlayco...
def __init__(self, WMPSong): self.wmpNode = WMPSong self.artist = WMPSong.getItemInfo("WM/AlbumArtist") self.album = WMPSong.getItemInfo("WM/AlbumTitle") self.title = WMPSong.name self.size = WMPSong.getItemInfo("FileSize") try: self.rating = int(WMPSong.getItemInfo("UserRating")) except ValueError: print WMPSong.getIt...
447,856
def showUsage(self): print "iTunesToRhythm <path to ItunesMusicLibrary.xml> <path to rhythmdb.xml>
def showUsage(self): print "iTunesToRhythm <path to ItunesMusicLibrary.xml> <path to rhythmdb.xml>"
447,857
def setRating( self, rating): ratingValueNodes = self.xmlNode.xpathEval("integer[preceding-sibling::* = 'Rating'][1]") if len( ratingValueNodes ) == 0: newRatingKeyNode= libxml2.newNode("key") newRatingKeyNode.setContent("rating") ratingValueNode = libxml2.newNode("integer") newRatingKeyNode.addSibling( ratingValueNo...
def setRating( self, rating): ratingValueNodes = self.xmlNode.xpathEval("integer[preceding-sibling::* = 'Rating'][1]") if len( ratingValueNodes ) == 0: newRatingKeyNode= libxml2.newNode("key") newRatingKeyNode.setContent("Rating") ratingValueNode = libxml2.newNode("integer") newRatingKeyNode.addSibling( ratingValueNo...
447,858
def setPlaycount(self, playcount): self.wmpNode.setItemInfo("UserPlaycount", rating)
def setPlaycount(self, playcount): self.wmpNode.setItemInfo("UserPlaycount", rating)
447,859
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
447,860
def equivalent_sites(self, scaled_positions, ondublicates='error', symprec=1e-3): """Returns the scaled positions and all their equivalent sites.
def equivalent_sites(self, scaled_positions, ondublicates='error', symprec=1e-3): """Returns the scaled positions and all their equivalent sites.
447,861
def equivalent_sites(self, scaled_positions, ondublicates='error', symprec=1e-3): """Returns the scaled positions and all their equivalent sites.
def equivalent_sites(self, scaled_positions, ondublicates='error', symprec=1e-3): """Returns the scaled positions and all their equivalent sites.
447,862
def equivalent_sites(self, scaled_positions, ondublicates='error', symprec=1e-3): """Returns the scaled positions and all their equivalent sites.
def equivalent_sites(self, scaled_positions, ondublicates='error', symprec=1e-3): """Returns the scaled positions and all their equivalent sites.
447,863
def equivalent_sites(self, scaled_positions, ondublicates='error', symprec=1e-3): """Returns the scaled positions and all their equivalent sites.
def equivalent_sites(self, scaled_positions, ondublicates='error', symprec=1e-3): """Returns the scaled positions and all their equivalent sites.
447,864
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...
447,865
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...
447,866
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...
447,867
def get_dipole_moment(self, atoms): """Returns total dipole moment of the system.""" self.update(atoms) return self.dipole
def get_dipole_moment(self, atoms): """Returns total dipole moment of the system.""" self.update(atoms) return self.dipole
447,868
def get_calculator_gpaw(): calc = GPAW(h=0.2, mode='lcao', basis='szp(dzp)', nbands=-5, xc='LDA', width=0.1, mixer=Mixer(beta=0.1, nmaxold=5, weight=50.0), poissonsolver=PoissonSolver(nn='M', relax='GS'), convergence={'energy':1e-4, 'bands':-3}, stencils=(3, 3), txt='neb.txt') return calc
def get_calculator_gpaw(): calc = GPAW(h=0.2, mode='lcao', basis='szp(dzp)', nbands=-5, xc='LDA', width=0.1, mixer=Mixer(beta=0.1, nmaxold=5, weight=50.0), poissonsolver=PoissonSolver(nn='M', relax='GS'), convergence={'energy':1e-4, 'bands':-3}, stencils=(3, 3), txt='neb.txt') return calc
447,869
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,870
def read_only_atoms(self,ncfile): '''read only the atoms from an existing netcdf file. Used to initialize a calculator from a ncfilename.
def read_only_atoms(self,ncfile): '''read only the atoms from an existing netcdf file. Used to initialize a calculator from a ncfilename.
447,871
def read_only_atoms(self,ncfile): '''read only the atoms from an existing netcdf file. Used to initialize a calculator from a ncfilename.
def read_only_atoms(self,ncfile): '''read only the atoms from an existing netcdf file. Used to initialize a calculator from a ncfilename.
447,872
def __init__(self, nc='out.nc', outnc=None, debug=0, stay_alive=False, **kwargs): ''' Initialize the Jacapo calculator
def __init__(self, nc='out.nc', outnc=None, debug=0, stay_alive=False, **kwargs): ''' Initialize the Jacapo calculator
447,873
def set_kpts(self, kpts): ''' set the kpt grid.
def set_kpts(self, kpts): ''' set the kpt grid.
447,874
def set_kpts(self, kpts): ''' set the kpt grid.
def set_kpts(self, kpts): ''' set the kpt grid.
447,875
def get_ensemble_coefficients(self): ''' adapted from ASE/dacapo.py def GetEnsembleCoefficients(self): self.Calculate() E = self.GetPotentialEnergy() xc = self.GetNetCDFEntry('EnsembleXCEnergies') Exc = xc[0] exc_c = self.GetNetCDFEntry('EvaluateCorrelationEnergy') exc_e = self.GetNetCDFEntry('EvaluateExchangeEnergy')...
def get_ensemble_coefficients(self): ''' adapted from ASE/dacapo.py def GetEnsembleCoefficients(self): self.Calculate() E = self.GetPotentialEnergy() xc = self.GetNetCDFEntry('EnsembleXCEnergies') Exc = xc[0] exc_c = self.GetNetCDFEntry('EvaluateCorrelationEnergy') exc_e = self.GetNetCDFEntry('EvaluateExchangeEnergy')...
447,876
def __init__(self, energy, forces, stress, magmoms, atoms): """Save energy, forces and stresses for the current configuration.""" self.energy = energy self.forces = np.array(forces, float) self.stress = np.array(stress, float) self.magmoms = np.array(magmoms, float) self.atoms = atoms.copy()
def __init__(self, energy, forces, stress, magmoms, atoms): """Save energy, forces and stresses for the current configuration.""" self.energy = energy if forces is not None: forces = np.array(forces, float) self.forces = forces if stress is not None: stress = np.array(stress, float) self.stress = stress if magmoms is n...
447,877
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,878
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, kpt_n11=1, kpt_n12=0, kpt_n13=0, kpt_n21=0, kpt_n22=1, kpt_n23=0, kpt_n31=0, kpt_n32=0, kpt_n33=1, kpt_s1=0.0, kpt_s2=0.0, kpt_s3=0.0, md_dftb=False...
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, kpt_n11=1, kpt_n12=0, kpt_n13=0, kpt_n21=0, kpt_n22=1, kpt_n23=0, kpt_n31=0, kpt_n32=0, kpt_n33=1, kpt_s1=0.0, kpt_s2=0.0, kpt_s3=0.0, md_dftb=False...
447,879
def valid_ascii_debug(x): return (x in ['Off', 'MediumLevel', 'HighLevel'])
def valid_ascii_debug(x): return (x.strip() in ['Off', 'MediumLevel', 'HighLevel'])
447,880
def valid_electronic_minimization(x): valid_keys = ['method', 'diagsperband'] for key in x: if key not in valid_keys: return False elif key == 'method': if x[key] not in ['resmin', 'eigsolve', 'rmm-diis']: return False elif key == 'diagsperband': if not valid_int(x[key]): return False return True
def valid_electronic_minimization(x): valid_keys = ['method', 'diagsperband'] for key in x: if key not in valid_keys: return False elif key == 'method': if x[key] not in ['resmin', 'eigsolve', 'rmm-diis']: return False elif key == 'diagsperband': if not (valid_int(x[key]) or x[key] is None): return False return True
447,881
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 if isinstance(atoms, (list, tuple)): if len(atoms) > 1: raise RuntimeError("Don...
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 if isinstance(atoms, (list, tuple)): if len(atoms) > 1: raise RuntimeError("Don...
447,882
def get_magnetic_moments(self, atoms): if self.int_params['lorbit']>=10 or self.list_params['rwigs']: self.update(atoms) return self.magnetic_moments else: raise RuntimeError( "The combination %s for lorbit with %s for rwigs not supported to calculate magnetic moments" % (p['lorbit'], p['rwigs']))
def get_magnetic_moments(self, atoms): if self.int_params['lorbit']>=10 or self.list_params['rwigs']: self.update(atoms) return self.magnetic_moments else: raise RuntimeError( "The combination %s for lorbit with %s for rwigs not supported to calculate magnetic moments" % (p['lorbit'], p['rwigs']))
447,883
def __eq__(self, other): """Chech whether *self* and *other* refer to the same spacegroup number and setting.""" return self.no == other.no and self.setting == other.setting
def __eq__(self, other): """Chech whether *self* and *other* refer to the same spacegroup number and setting.""" return self.no == other.no and self.setting == other.setting
447,884
def _read_datafile_entry(spg, no, symbol, setting, 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())...
def _read_datafile_entry(spg, no, symbol, setting, f): """Read space group data from f to spg.""" spg._no = no spg._symbol = symbol.strip() spg._setting = setting spg._centrosymmetric = bool(int(f.readline().split()[1])) # primitive vectors f.readline() spg._scaled_primitive_cell = np.array([map(float, f.readline().spl...
447,885
def set_psp_database(self, xc=None): ''' get the xc-dependent psp database
def set_psp_database(self, xc=None): ''' get the xc-dependent psp database
447,886
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=()):
447,887
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=()):
447,888
def step(self, stp, f, g, c1, c2, xtol, isave, dsave): if self.task[:5] == 'START':
defstep(self,stp,f,g,c1,c2,xtol,isave,dsave):ifself.task[:5]=='START':
447,889
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':
447,890
def update(self, stx, fx, gx, sty, fy, gy, stp, fp, gp, bracket, stpmin, stpmax): sign = gp * (gx / abs(gx))
defupdate(self,stx,fx,gx,sty,fy,gy,stp,fp,gp,bracket,stpmin,stpmax):sign=gp*(gx/abs(gx))
447,891
def update(self, stx, fx, gx, sty, fy, gy, stp, fp, gp, bracket, stpmin, stpmax): sign = gp * (gx / abs(gx))
defupdate(self,stx,fx,gx,sty,fy,gy,stp,fp,gp,bracket,stpmin,stpmax):sign=gp*(gx/abs(gx))
447,892
def determine_step(self, stp): dr = stp - self.old_stp if pymax(self.pk) * dr > self.maxstep: dr /= (pymax(self.pk) * dr / self.maxstep) stp = self.old_stp + dr return stp
def determine_step(self, stp): dr = stp - self.old_stp if abs(pymax(self.pk) * dr) > self.maxstep: dr /= abs((pymax(self.pk) * dr) / self.maxstep) stp = self.old_stp + dr return stp
447,893
def set(self, **kwargs): '''set a parameter
def set(self, **kwargs): '''set a parameter
447,894
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)
447,895
def __init__(self, nc='out.nc', outnc=None, debug=0, 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
447,896
def __init__(self, nc='out.nc', outnc=None, debug=0, stay_alive=False, **kwargs): ''' Initialize the Jacapo calculator
def __init__(self, nc='out.nc', outnc=None, debug=0, stay_alive=False, **kwargs): ''' Initialize the Jacapo calculator
447,897
def __init__(self, nc='out.nc', outnc=None, debug=0, stay_alive=False, **kwargs): ''' Initialize the Jacapo calculator
def __init__(self, nc='out.nc', outnc=None, debug=0, stay_alive=False, **kwargs): ''' Initialize the Jacapo calculator
447,898
def __init__(self, nc='out.nc', outnc=None, debug=0, stay_alive=False, **kwargs): ''' Initialize the Jacapo calculator
def __init__(self, nc='out.nc', outnc=None, debug=0, stay_alive=False, **kwargs): ''' Initialize the Jacapo calculator
447,899