bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
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. | 454,700 |
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... | 454,701 |
def convert(self): lines = open(self.xdatcar).readlines() | def convert(self): lines = open(self.xdatcar).readlines() | 454,702 |
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... | 454,703 |
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... | 454,704 |
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) | 454,705 |
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 | 454,706 |
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 | 454,707 |
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 | 454,708 |
def __str__(self): ''' pretty-print the calculator and atoms. | def __str__(self): ''' pretty-print the calculator and atoms. | 454,709 |
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... | 454,710 |
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 ... | 454,711 |
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 ... | 454,712 |
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. | 454,713 |
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) | 454,714 |
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 ... | 454,715 |
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... | 454,716 |
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[... | 454,717 |
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... | 454,718 |
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) | 454,719 |
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) | 454,720 |
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) | 454,721 |
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) | 454,722 |
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 | 454,723 |
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 | 454,724 |
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... | 454,725 |
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... | 454,726 |
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... | 454,727 |
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... | 454,728 |
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: | 454,729 |
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 =... | 454,730 |
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 =... | 454,731 |
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... | 454,732 |
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)) | 454,733 |
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()) | 454,734 |
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) | 454,735 |
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 ... | 454,736 |
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. | 454,737 |
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 | 454,738 |
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 | 454,739 |
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 ... | 454,740 |
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.... | 454,741 |
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... | 454,742 |
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.... | 454,743 |
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.... | 454,744 |
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... | 454,745 |
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... | 454,746 |
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... | 454,747 |
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... | 454,748 |
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... | 454,749 |
def get_mass(self): return self._get('mass') | def get_mass(self): return self._get('mass') | 454,750 |
def set_mass(self, mass): self._set('mass', mass) | def set_mass(self, mass): self._set('mass', mass) | 454,751 |
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. | 454,752 |
def set_kpts(self, kpts): ''' set the kpt grid. | def set_kpts(self, kpts): ''' set the kpt grid. | 454,753 |
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 | 454,754 |
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 | 454,755 |
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 | 454,756 |
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 | 454,757 |
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 | 454,758 |
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,'... | 454,759 |
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 | 454,760 |
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... | 454,761 |
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 | 454,762 |
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 | 454,763 |
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 | 454,764 |
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... | 454,765 |
def __init__(self, stpmin=1e-8, xtol=1e-14): | def __init__(self, stpmin=1e-8, xtol=1e-14): | 454,766 |
def __init__(self, stpmin=1e-8, xtol=1e-14): | def __init__(self, stpmin=1e-8, xtol=1e-14): | 454,767 |
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=()): | 454,768 |
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=()): | 454,769 |
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=()): | 454,770 |
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': | 454,771 |
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': | 454,772 |
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': | 454,773 |
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': | 454,774 |
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': | 454,775 |
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': | 454,776 |
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 | 454,777 |
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 | 454,778 |
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 | 454,779 |
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... | 454,780 |
def close_dome (self): | def close_dome (self): | 454,781 |
def isEmbedded(self, name): return ( name == 'embedded_data' or name == 'embedded_data_byte' ) | def isEmbedded(self, name): return ( name == 'embedded_data' or name == 'embedded_data_byte' ) | 454,782 |
def Tag_attr_ubyte(self): new_tag = unpack('B', self.data[self.index])[0] | def Tag_attr_ubyte(self): new_tag = unpack('B', self.data[self.index])[0] | 454,783 |
def singleValueType(self): if ( self.Tag_ubyte() or self.Tag_uint16() or self.Tag_uint32() or \ self.Tag_sint16() or self.Tag_sint32() or self.Tag_real32() ): size = self.size_of_element if ( self.unpack_string == 'f' ): print "%f" % self.unpack(self.unpack_string, self.data[self.index:self.index+size]), else: print "%... | def singleValueType(self): if ( self.Tag_ubyte() or self.Tag_uint16() or self.Tag_uint32() or \ self.Tag_sint16() or self.Tag_sint32() or self.Tag_real32() ): size = self.size_of_element if ( self.unpack_string == 'f' ): print "%f" % self.unpack(self.unpack_string, self.data[self.index:self.index+size]), else: print "%... | 454,784 |
# def student_t(df): | # def student_t(df): | 454,785 |
# def student_t(df): | # def student_t(df): | 454,786 |
def theor_beta_prod(alpha, n, x): norm = float((alpha + 1) ** n) for i in xrange(1, n): norm /= i return norm * x ** alpha * log(1.0 / x) ** (n - 1) | def theor_beta_prod(alpha, n, x): norm = float((alpha + 1) ** n) for i in xrange(1, n): norm /= i return norm * x ** alpha * log(1.0 / x) ** (n - 1) | 454,787 |
def theor_quot_power(alpha, x): return (x > 0) * (x <= 1) * (alpha + 1.0) / 2 * x**alpha + (x > 1) * (alpha + 1.0) / 2 * x**(-alpha-2) | def theor_quot_power(alpha, x): return (x > 0) * (x <= 1) * (alpha + 1.0) / 2 * x**alpha + (x > 1) * (alpha + 1.0) / 2 * x**(-alpha-2) | 454,788 |
def weightvecs(m1, x1, m2, x2) : return [(x1[0]*m1 + x2[0]*m2)/(m1+m2), (x1[1]*m1 + x2[1]*m2)/(m1+m2), (x1[2]*m1 + x2[2]*m2)/(m1+m2)] | def weightvecs(m1, x1, m2, x2) : return [(x1[0]*m1 + x2[0]*m2)/(m1+m2), (x1[1]*m1 + x2[1]*m2)/(m1+m2), (x1[2]*m1 + x2[2]*m2)/(m1+m2)] | 454,789 |
def profile(nbins=4, min_radius=0.0534932, bin_type='log', group='All', family='all', center='pot', projection='sph', fit_radius=0., debug_flag = 1) : """Perform the Tipsy profile() function. This version implements: linear and logarithmic binning spherical projections base data fields star data fields currently dev... | def profile(nbins=4, min_radius=0.0534932, bin_type='log', group='All', family='all', center='pot', projection='sph', WRITE_TO = 'profile.DAT', fit_radius=0., debug_flag = 1) : """Perform the Tipsy profile() function. This version implements: linear and logarithmic binning spherical projections base data fields star ... | 454,790 |
def weightvecs(m1, x1, m2, x2) : return [(x1[0]*m1 + x2[0]*m2)/(m1+m2), (x1[1]*m1 + x2[1]*m2)/(m1+m2), (x1[2]*m1 + x2[2]*m2)/(m1+m2)] | def weightvecs(m1, x1, m2, x2) : return [(x1[0]*m1 + x2[0]*m2)/(m1+m2), (x1[1]*m1 + x2[1]*m2)/(m1+m2), (x1[2]*m1 + x2[2]*m2)/(m1+m2)] | 454,791 |
basereduce = """def localparticle(p): # sum values used for calculation of base fields to get per-bin results bin = p.list[0][0] num = len(p.list) mass = 0. vel_radial = 0. vel_radial_sigma = 0. vel_tang_sigma = 0. ang_mom = [0., 0., 0.] radius = 0. lum = 0. density = 0. temp = 0. pressure = 0. entropy = 0. gas_mass = ... | basereduce = """def localparticle(p): # sum values used for calculation of base fields to get per-bin results bin = p.list[0][0] num = 0 mass = 0. vel_radial = 0. vel_radial_sigma = 0. vel_tang_sigma = 0. ang_mom = [0., 0., 0.] radius = 0. lum = 0. density = 0. temp = 0. pressure = 0. entropy = 0. gas_mass = 0. for i i... | 454,792 |
basereduce = """def localparticle(p): # sum values used for calculation of base fields to get per-bin results bin = p.list[0][0] num = len(p.list) mass = 0. vel_radial = 0. vel_radial_sigma = 0. vel_tang_sigma = 0. ang_mom = [0., 0., 0.] radius = 0. lum = 0. density = 0. temp = 0. pressure = 0. entropy = 0. gas_mass = ... | basereduce = """def localparticle(p): # sum values used for calculation of base fields to get per-bin results bin = p.list[0][0] num = len(p.list) mass = 0. vel_radial = 0. vel_radial_sigma = 0. vel_tang_sigma = 0. ang_mom = [0., 0., 0.] radius = 0. lum = 0. density = 0. temp = 0. pressure = 0. entropy = 0. gas_mass = ... | 454,793 |
def format_description(self, description, width=None): # textwrap doesn't allow for a way to preserve double newlines # to separate paragraphs, so we do it here. paragraphs = description.split('\n\n') print paragraphs rets = [] | def format_description(self, description, width=None): # textwrap doesn't allow for a way to preserve double newlines # to separate paragraphs, so we do it here. paragraphs = description.split('\n\n') rets = [] | 454,794 |
def parse(self, argv): """ Parse the given arguments and act on them. | def parse(self, argv): """ Parse the given arguments and act on them. | 454,795 |
def parse_params(): global VERBOSE, QUIET, SHENIDAM, FFMPEG, SHENIDAM_PARAMS, TRANSCODE_BASE, OUTPUT_PATTERN, BASE_FN, AUDIO_EXPORT_PARAMS, AUDIO_REMIX_PARAMS, SHENIDAM_PARAMS, TEMP_DIR, AUDIO_ONLY; argv = sys.argv argc = len(argv) i = 1 print(argc) while i < argc: arg = argv[i].strip() i+=1 if arg == "-v" or arg == "-... | def parse_params(): global VERBOSE, QUIET, SHENIDAM, FFMPEG, SHENIDAM_PARAMS, TRANSCODE_BASE, OUTPUT_PATTERN, BASE_FN, AUDIO_EXPORT_PARAMS, AUDIO_REMIX_PARAMS, SHENIDAM_PARAMS, TEMP_DIR, AUDIO_ONLY; argv = sys.argv argc = len(argv) i = 1 while i < argc: arg = argv[i].strip() i+=1 if arg == "-v" or arg == "--verbose": V... | 454,796 |
def parse_params(): global VERBOSE, QUIET, SHENIDAM, FFMPEG, SHENIDAM_PARAMS, TRANSCODE_BASE, OUTPUT_PATTERN, BASE_FN, AUDIO_EXPORT_PARAMS, AUDIO_REMIX_PARAMS, SHENIDAM_PARAMS, TEMP_DIR, AUDIO_ONLY; argv = sys.argv argc = len(argv) i = 1 print(argc) while i < argc: arg = argv[i].strip() i+=1 if arg == "-v" or arg == "-... | def parse_params(): global VERBOSE, QUIET, SHENIDAM, FFMPEG, SHENIDAM_PARAMS, TRANSCODE_BASE, OUTPUT_PATTERN, BASE_FN, AUDIO_EXPORT_PARAMS, AUDIO_REMIX_PARAMS, SHENIDAM_PARAMS, TEMP_DIR, AUDIO_ONLY; argv = sys.argv argc = len(argv) i = 1 print(argc) while i < argc: arg = argv[i].strip() i+=1 if arg == "-v" or arg == "-... | 454,797 |
def Init(self,component_name): rospy.loginfo("Waiting for %s_controller init...", component_name) service_name = component_name + "_controller/Init" try: rospy.wait_for_service(service_name,rospy.get_param('server_timeout',1)) except rospy.ROSException, e: print "Service not available: %s"%e return False try: init = ro... | def Init(self,component_name): rospy.loginfo("Initialize <<%s>>", component_name) rospy.loginfo("Waiting for <<%s>> to be initialized...", component_name) service_name = component_name + "_controller/Init" try: rospy.wait_for_service(service_name,rospy.get_param('server_timeout',1)) except rospy.ROSException, e: print ... | 454,798 |
def Init(self,component_name): rospy.loginfo("Waiting for %s_controller init...", component_name) service_name = component_name + "_controller/Init" try: rospy.wait_for_service(service_name,rospy.get_param('server_timeout',1)) except rospy.ROSException, e: print "Service not available: %s"%e return False try: init = ro... | def Init(self,component_name): rospy.loginfo("Waiting for %s_controller init...", component_name) service_name = component_name + "_controller/Init" try: rospy.wait_for_service(service_name,rospy.get_param('server_timeout',1)) except rospy.ROSException, e: print "Service not available: %s"%e return False try: init = ro... | 454,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.