rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
def get_mass(self): return self._get('mass') | def get_mass(self): return self._get('mass') | |
def set_mass(self, mass): self._set('mass', mass) | def set_mass(self, mass): self._set('mass', mass) | |
md_dftb_write_vel: boolean True: velocities are written in dftb_in.hsd file to be read by dftb (in this case md_dftb_init_t is ignored) False: velocities are not written in dftb_in.hsd (requires that md_dftb==True, ie MD is run by DFTB+ program) (requires that also write_dftb_input_file==True) | md_dftb_write_vel: bool True: velocities are written in dftb_in.hsd file to be read by dftb (in this case md_dftb_init_t is ignored) False: velocities are not written in dftb_in.hsd (requires that md_dftb==True, ie MD is run by DFTB+ program) (requires that also write_dftb_input_file==True) | 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... |
__version__ = 0.4 | __version__ = '0.4' | 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) |
self._set_frame_number() | def __init__(self, nc='out.nc', outnc=None, debug=logging.WARN, stay_alive=False, **kwargs): ''' Initialize the Jacapo calculator | |
self._set_frame_number() | def __init__(self, nc='out.nc', outnc=None, debug=logging.WARN, stay_alive=False, **kwargs): ''' Initialize the Jacapo calculator | |
ncf.jacapo_version = Jacapo.__version__ | ncf.Jacapo_version = Jacapo.__version__ | def initnc(self, ncfile=None): '''create an ncfile with minimal dimensions in it |
return 'ncfile does not exist yet' | return 'ncfile (%s) does not exist yet' % self.nc | def __str__(self): ''' pretty-print the calculator and atoms. |
'set framenumber in the netcdf file' | 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 ... | |
nc = netCDF(self.nc, 'r') if 'TotalEnergy' in nc.variables: frame = nc.variables['TotalEnergy'].shape[0] if nc.variables.get('TotalEnergy', None)[-1] > 1E36: log.warn("Total energy > 1E36. NC file is incomplete. \ calc.restart required") self.restart() | if os.path.exists(self.nc): nc = netCDF(self.nc, 'r') number_ionic_steps = nc.dimensions['number_ionic_steps'] frame = number_ionic_steps -1 nc.close() | 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 ... |
frame = 1 nc.close() log.info("Current frame number is: %i" % (frame-1)) | if hasattr(self,'atoms'): frame = 1 else: frame = 0 log.info("Current frame number is: %i" % (frame-1)) | 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 ... |
raise RuntimeError('Remove constraint before modifying atoms.') | 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 RuntimeError('Remove all constraints beyond FixAtoms b... | 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)) |
run_test(get_atoms, get_calculator_gpaw, name + '-gpaw', 'GPAW (lcao)') run_test(get_atoms, get_calculator_emt, name + '-emt', 'EMT') | run_test(get_atoms, get_calculator_emt, name + '-emt') run_test(get_atoms, get_calculator_gpaw, name + '-gpaw') | 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 |
print 'Using %' % classname | print 'Using ' + classname | def __init__(self, nwannier, calc, file=None, nbands=None, fixedenergy=None, fixedstates=None, spin=0, initialwannier='random', seed=None, verbose=False): """ Required arguments: |
__version__ = 0.3 | __version__ = 0.4 | 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) |
debug=0, | debug=logging.WARN, | def __init__(self, nc='out.nc', outnc=None, debug=0, stay_alive=False, **kwargs): ''' Initialize the Jacapo calculator |
debug : integer set debug level (0 = off, 10 = extreme) | debug : level for logging could be something like logging.DEBUG or an integer 0-50. The higher the integer, the less information you see set debug level (0 = off, 10 = extreme) | def __init__(self, nc='out.nc', outnc=None, debug=0, stay_alive=False, **kwargs): ''' Initialize the Jacapo calculator |
if self.debug > 1: print 'Updating the atoms in kwargs' print atoms.get_positions() | def __init__(self, nc='out.nc', outnc=None, debug=0, stay_alive=False, **kwargs): ''' Initialize the Jacapo calculator | |
if self.debug > 1: print atoms.get_positions() | def __init__(self, nc='out.nc', outnc=None, debug=0, stay_alive=False, **kwargs): ''' Initialize the Jacapo calculator | |
if self.debug > 1: print key, 'notchanged = ',notchanged | log.debug('%s notchanged = %s' % (key,notchanged)) | def set(self, **kwargs): '''set a parameter |
if self.debug > 1: print changef, ' not found' | log.warn('%s not found' % changef) | def set(self, **kwargs): '''set a parameter |
if self.debug > 0: print 'setting: %s. self.ready = False ' % key | log.debug('setting: %s. self.ready = False ' % key) | def set(self, **kwargs): '''set a parameter |
if self.debug > 0: print 'wrote %s: %s' % (key, str(self.pars[key])) | log.debug('wrote %s: %s' % (key, str(self.pars[key]))) | def write_input(self): '''write out input parameters as needed |
if self.debug > 0: print 'getting ', key | log.debug('getting key: %s' % key) | 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 |
if self.debug > 0: print 'initializing ', ncfile | log.debug('initializing %s' % ncfile) | def initnc(self, ncfile): 'create an ncfile with minimal dimensions in it' if self.debug > 0: print 'initializing ', ncfile |
if self.debug > 1: print nc.variables.get('TotalEnergy', None)[-1] print "NC file is incomplete. Restart required" | log.warn("Total energy > 1E36. NC file is incomplete. calc.restart required") | 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 ... |
if self.debug > 1: print "Current frame number is: ", frame-1 | log.info("Current frame number is: %i" % (frame-1)) | 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 ... |
if self.debug > 1: print 'incrementing frame' | log.debug('incrementing frame') | def _increment_frame(self): if self.debug > 1: print 'incrementing frame' self._frame += 1 |
if self.debug > 0: print 'kpts = ', self.get_kpts() | log.debug('kpts = %s' % str(self.get_kpts())) | def set_kpts(self, kpts): ''' set the kpt grid. |
if self.debug > 1: print 'posmatch = ',posmatch,abs(a['positions'] - b['positions']) print 'cellmatch = ',cellmatch,self.atoms.get_cell(),atoms.get_cell() print 'lenmatch = ',lenmatch | 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 | |
if self.debug > 1: print 'No change to atoms in set_atoms, returning' | log.debug('No change to atoms in set_atoms, returning') | def set_atoms(self, atoms): '''attach an atoms to the calculator and update the ncfile |
if self.debug>1: print 'in set atoms, atoms != self.atoms, incrementing' print atoms.get_positions() print self.atoms.get_positions() | log.debug('atoms != self.atoms, incrementing') | def set_atoms(self, atoms): '''attach an atoms to the calculator and update the ncfile |
if self.debug > 0: print 'copying %s to %s' % (self.nc,nc) | log.debug('copying %s to %s' % (self.nc,nc)) | def set_nc(self,nc='out.nc'): ''' set filename for the netcdf and text output for this calculation |
if self.debug > 0: print 'calculation required for energy' | log.debug('calculation required for energy') | 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:... |
if self.debug > 0: print 'no calculation required for energy' | log.debug('no calculation required for energy') | 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:... |
if self.debug > 0: print 'returning total energy' print nc.variables['TotalEnergy'][:] | 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:... | |
if self.debug > 0: print 'calculation required for forces' | 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 | |
if self.debug > 0: print 'running calculation_required' | log.debug('running calculation_required') | def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed. |
if self.debug > 0: print 'found that atoms != self.atoms' | log.debug('found that atoms != self.atoms') | def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed. |
if self.debug > 0: print 'restart required! because cell changed' | log.debug('restart required! because cell changed') | def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed. |
if self.debug > 0: print 'Unitcells apparently the same' | log.debug('Unitcells apparently the same') | def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed. |
if self.debug > 0: print 'returning true for calculation required' | def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed. | |
if self.debug > 0: print 'atoms tested equal' | log.debug('atoms tested equal') | def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed. |
if self.debug > 0: print 'ncfile = ',self.nc | def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed. | |
if self.debug > 0: print 'ncfile exists, but is not ready' print 'self.ready = ',self.ready | log.debug('ncfile exists, but is not ready') | def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed. |
if self.debug > 0: print 'default calculation required' | def calculation_required(self, atoms=None, quantities=None): ''' determines if a calculation is needed. | |
if self.debug > 0: print 'running a calculation' | log.debug('running a calculation') | def calculate(self): '''run a calculation. |
if self.debug > 0: print cmd | log.debug(cmd) | def calculate(self): '''run a calculation. |
if self.debug > 0: if hasattr(self,"_dacapo"): print "Starting External Dynamics while Dacapo is runnning ",self._dacapo.poll() else: print "No dacapo instance has been started yet" print "Stopprogram",stopprogram | if hasattr(self,"_dacapo"): log.debug("Starting External Dynamics while Dacapo is runnning: %s " % str(self._dacapo.poll())) else: log.debug("No dacapo instance has been started yet") log.debug("Stopprogram: %s" % stopprogram) | 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... |
if self.debug > 0: print cmd | log.debug(cmd) | 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... |
write out a netcdffile. This does not change the ncfile attached to the calculator! | write out atoms to a netcdffile. This does not write out the calculation parameters! | def write_nc(self,nc=None,atoms=None): ''' write out a netcdffile. This does not change the ncfile attached to the calculator! |
if self.debug > 0: print 'beginning: going to delete dims: ',ncdims print 'beginning: going to delete vars: ',ncvars | log.debug('beginning: going to delete dims: %s' % ncdims) log.debug('beginning: going to delete vars: %s' % ncvars) | def delete_ncattdimvar(self,ncf,ncattrs=(),ncdims=(),ncvars=()): ''' helper function to delete attributes, dimensions and variables in a netcdffile |
if self.debug > 0: print 'deleting %s of %s' % (dim,str(ncdims)) | log.debug('deleting %s of %s' % (dim,str(ncdims))) | def delete_ncattdimvar(self,ncf,ncattrs=(),ncdims=(),ncvars=()): ''' helper function to delete attributes, dimensions and variables in a netcdffile |
if self.debug > 0: print 'deleting "%s" because it depends on dim "%s"' %(v,dim) | log.debug('deleting "%s" because it depends on dim "%s"' %(v,dim)) | def delete_ncattdimvar(self,ncf,ncattrs=(),ncdims=(),ncvars=()): ''' helper function to delete attributes, dimensions and variables in a netcdffile |
if self.debug>0: print 'vars to delete: ',ncvars print 'deleting ncvar: ',v | log.debug('vars to delete: %s ' % ncvars) log.debug('deleting ncvar: %s' % v) | def delete_ncattdimvar(self,ncf,ncattrs=(),ncdims=(),ncvars=()): ''' helper function to delete attributes, dimensions and variables in a netcdffile |
if self.debug > 0: print 'TypeError EXCEPTION HAPPENED in delete_NCATTR, you can ignore this message.' print 'variable name: %s' % v | def delete_ncattdimvar(self,ncf,ncattrs=(),ncdims=(),ncvars=()): ''' helper function to delete attributes, dimensions and variables in a netcdffile | |
if self.debug > 0: print 'deletencatt--2 (.nfs): ', glob.glob('.nfs*') | log.debug('looking for .nfs files before copying: %s' % glob.glob('.nfs*')) | def delete_ncattdimvar(self,ncf,ncattrs=(),ncdims=(),ncvars=()): ''' helper function to delete attributes, dimensions and variables in a netcdffile |
if self.debug > 0: print 'deletencatt-end (.nfs): ', glob.glob('.nfs*') | log.debug('looking for .nfs files after copying: %s' % glob.glob('.nfs*')) | def delete_ncattdimvar(self,ncf,ncattrs=(),ncdims=(),ncvars=()): ''' helper function to delete attributes, dimensions and variables in a netcdffile |
if self.debug > 0: print 'restarting!' | log.debug('restarting!') | 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... |
self.set_title("Nanotube") | self.set_title("Graphene") | def __init__(self, gui): SetupWindow.__init__(self) self.set_title("Nanotube") vbox = gtk.VBox() |
else: | elif ados is None and x is not None: | def ados_changed(self,x): ados = self.get_ados() |
elif ados is not None and x is None: return True | def ados_changed(self,x): ados = self.get_ados() | |
if np.linalg.det(np.dot(np.array([a, b, -c]), cell)) < 0: | if np.linalg.det(np.dot(np.array([a, b, c]), cell)) < 0: | 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... |
From Intermetallic compounds: Principles and Practice, Vol. I: Princples | From Intermetallic compounds: Principles and Practice, Vol. I: Principles | 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 |
from rotations import rotate_vec_into_newvec | from rot_tools import rotate_vec_into_newvec | def scroll(self, window, event): from copy import copy CTRL = event.state == gtk.gdk.CONTROL_MASK SHIFT = event.state == gtk.gdk.SHIFT_MASK dxdydz = {gtk.keysyms.KP_Add: ('zoom', 1.2, 0), gtk.keysyms.KP_Subtract: ('zoom', 1 / 1.2), gtk.keysyms.Up: ( 0, -1 + CTRL, +CTRL), gtk.keysyms.Down: ( 0, +1 - CTRL, -CTRL), gt... |
bravais_basis = [[0,0,0], [1.0/3.0, 2.0/3.0, 0]] | bravais_basis = [[0,0,0], [1.0/3.0, 2.0/3.0, 0], [1.0/3.0,2.0/3.0,0.5], [2.0/3.0,1.0/3.0,0.5]] | 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) |
if self.psp[sym] != psp: | if sym not in self.psp: | def set_psp(self, sym=None, z=None, psp=None): ''' set the pseudopotential file for a species or an atomic number. |
elif self.psp[sym] != psp: self.psp[sym] = psp self.ready = False self.set_status('new') if not self.ready: | def set_psp(self, sym=None, z=None, psp=None): ''' set the pseudopotential file for a species or an atomic number. | |
'max_projectors_per_atom'] | 'max_projectors_per_atom', 'atomdos_energygrid_size', 'atomdos_angular_channels', 'atomdos_radial_orbs'] | 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... |
'StructureFactor'] | 'StructureFactor', 'EigenValues', 'OccupationNumbers'] | 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... |
parprint('Maximum force on atom in `eqiulibrium`: %.4f eV/Å' % | parprint('Maximum force on atom in `equilibrium`: %.4f eV/Å' % | def summary(self, method='standard', direction='central'): hnu = self.get_energies(method, direction) s = 0.01 * units._e / units._c / units._hplanck parprint('-------------------------------------') parprint(' Mode Frequency Intensity') parprint(' # meV cm^-1 (D/Å)^2 amu^-1') parprint('------------... |
_read_datafile(self, spacegroup, f) | _read_datafile(self, spacegroup, setting, f) | def __init__(self, spacegroup, setting=1, datafile=None): """Returns a new Spacegroup instance. |
def _skip_to_blank(f, spacegroup): | def _skip_to_blank(f, spacegroup, setting): | 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 |
'invalid spacegroup: %s, not found in data base'%spacegroup) | 'invalid spacegroup %s, setting %i not found in data base' % ( spacegroup, setting ) ) | 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_nonblank(f, spacegroup): | def _skip_to_nonblank(f, spacegroup, setting): | 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.... |
line = f.readline() if not line: | line1 = f.readline() if not line1: | 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.... |
'invalid spacegroup %s, not found in data base'%spacegroup) line.strip() if line and not line.startswith(' | 'invalid spacegroup %s, setting %i not found in data base' % ( spacegroup, setting ) ) line1.strip() if line1 and not line1.startswith(' line2 = f.readline() | 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.... |
return line def _read_datafile_entry(spg, no, symbol, f): | return line1, line2 def _read_datafile_entry(spg, no, symbol, setting, f): | 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.... |
spg._setting = int(f.readline().split()[1]) | spg._setting = setting | 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(spg, spacegroup, f): | def _read_datafile(spg, spacegroup, setting, f): | 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... |
line = _skip_to_nonblank(f, spacegroup) _no,_symbol = line.strip().split(None, 1) | line1, line2 = _skip_to_nonblank(f, spacegroup, setting) _no,_symbol = line1.strip().split(None, 1) _setting = int(line2.strip().split()[1]) | 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... |
(isinstance(spacegroup, basestring) and _symbol == spacegroup)): _read_datafile_entry(spg, _no, _symbol, f) | (isinstance(spacegroup, basestring) and _symbol == spacegroup)) and _setting == setting: _read_datafile_entry(spg, _no, _symbol, _setting, f) | 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... |
_skip_to_blank(f, spacegroup) | _skip_to_blank(f, spacegroup, setting) | 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... |
p.add_option('--c_over_a', type='float', | p.add_option('--c-over-a', type='float', | 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',... |
slab = hcp0001(surf, (n, m, opt.layers), a, opt.c_over_a, opt.vacuum) | slab = hcp0001(surf, (n, m, opt.layers), a, a * opt.c_over_a, opt.vacuum) | 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 write_svnrevision(output): f = open(path.join('ase', 'svnrevision.py'),'w') | def write_svnrevision(output, asedir='ase'): fname = path.join(asedir, 'svnrevision.py') f = open(fname,'w') | 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 ... |
print 'svnrevision = ' +output+' written to ase/svnrevision.py' | print 'svnrevision = ' + output + ' written to ' + fname | 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 ... |
cmd = popen3('svn propset svn:ignore svnrevision.py ase')[1] | cmd = popen3('svn propset svn:ignore svnrevision.py ' + asedir)[1] | 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 ... |
maxstep=.2, c1=.23, c2=0.46, xtrapl=1.1, xtrapu=4., stpmax=50, args=()): | 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=()): |
self.old_stp = alpha1 | 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=()): | |
return stp, f, g | def step(self, stp, f, g, c1, c2, xtol, isave, dsave): if self.task[:5] == 'START': | |
if pymax(self.pk) * dr > self.maxstep: dr /= (pymax(self.pk) * dr / self.maxstep) | if abs(pymax(self.pk) * dr) > self.maxstep: dr /= abs((pymax(self.pk) * dr) / self.maxstep) | 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 |
if x is not None: | if x is not None and isinstance(x,dict): | def _set_external_dipole(self,x): if x is not None: self.set_external_dipole(**x) |
v = nc.createVariable('ExternalDipolePotential','d') v.setValue(value) | v = nc.createVariable('ExternalDipolePotential','d',()) v.assignValue(value) | def set_external_dipole(self, value, position=None): ''' Externally imposed dipole potential. This option overwrites DipoleCorrection if set. |
images.append(atoms) | if not molecular_dynamics: images.append(atoms) | 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... |
self.choose_possible_deformations() | self.choose_possible_deformations(first=True) | def __init__(self, gui): Simulation.__init__(self, gui) self.set_title("Homogeneous scaling") vbox = gtk.VBox() self.packtext(vbox, "XXXX Bla bla bla.") self.packimageselection(vbox) pack(vbox, gtk.Label("")) |
def choose_possible_deformations(self): | def choose_possible_deformations(self, first=False): | def choose_possible_deformations(self): """Turn on sensible radio buttons. |
if but.get_active() and but.get_sensitive(): | if but.get_active(): | def get_deformation_axes(self): """Return which axes the user wants to deform along.""" for but, deform in self.deformtable: if but.get_active() and but.get_sensitive(): return np.array(deform) # No deformation chosen! oops("No deformation chosen: Please choose a deformation mode.") return False |
return 'FixedMode(%d, %s)' % (ints2string(self.index), self.mode.tolist()) | return 'FixedMode(%s, %s)' % (ints2string(self.index), self.mode.tolist()) | def __repr__(self): return 'FixedMode(%d, %s)' % (ints2string(self.index), self.mode.tolist()) |
fd.write('constraint_relaxation %s\n' % 'xyz'[n]) | fd.write('constrain_relaxation %s\n' % 'xyz'[n]) | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.