def _create_supercell(self, unitcell, symprec): mat = self._supercell_matrix frame = self._get_surrounding_frame(mat) sur_cell, u2sur_map = self._get_simple_supercell(frame, unitcell) # Trim the simple supercell by the supercell matrix trim_frame = np.array([ mat[0] / float(frame[0]), mat[1] / float(frame[1]), mat[2] / float(frame[2]) ]) supercell, sur2s_map, mapping_table = trim_cell( trim_frame, sur_cell, symprec) multi = supercell.get_number_of_atoms( ) // unitcell.get_number_of_atoms() if multi != determinant(self._supercell_matrix): print("Supercell creation failed.") print("Probably some atoms are overwrapped. " "The mapping table is give below.") print(mapping_table) Atoms.__init__(self) else: Atoms.__init__( self, numbers=supercell.get_atomic_numbers(), masses=supercell.get_masses(), #magmoms=supercell.get_magnetic_moments(), scaled_positions=supercell.get_scaled_positions(), cell=supercell.get_cell(), #pbc=True) ) self._u2s_map = np.arange(unitcell.get_number_of_atoms()) * multi self._u2u_map = dict([(j, i) for i, j in enumerate(self._u2s_map)]) self._s2u_map = np.array(u2sur_map)[sur2s_map] * multi
def __init__(self, symbols=None, positions=None, numbers=None, tags=None, momenta=None, masses=None, magmoms=None, charges=None, scaled_positions=None, cell=None, pbc=None, constraint=None, calculator=None, container=None, atoms=None): """ Modified atoms class for hotbit. Input parameters as for ase.Atoms, except for keyword container. @param container: either container type ('Bravais','Wedge','Chiral' or any other container from hotbit/containers/*.py), or dictionary describing the generalized unit cell, where container['type'] selects the cell class; for other keywords, look at the selected classes """ ase_Atoms.__init__(self,symbols=symbols, positions=positions, numbers=numbers, tags=tags, momenta=momenta, masses=masses, magmoms=magmoms, charges=charges, scaled_positions=scaled_positions, cell=cell, pbc=pbc, constraint=constraint, calculator=calculator) if type(atoms)!=type(None): self += atoms self.set_pbc( atoms.get_pbc() ) self.set_cell( atoms.get_cell() ) if container==None: dict = {'type':container_magic(self)} elif type(container)==type(''): dict = {'type':container} else: dict = container.copy() # create the container instance assert 'type' in dict exec( 'self.container_class = %s' %dict['type'] ) self.container = self.container_class(atoms=self,type=dict['type']) container_magic(self,container=dict['type']) dict.pop('type') if dict!={}: self.container.set(**dict) # these are just for shorter references self._transform = self.container.transform self._rotation = self.container.rotation
def _primitive_cell(self, supercell): trimed_cell, p2s_map, mapping_table = trim_cell( self._primitive_matrix, supercell, self._symprec) Atoms.__init__( self, numbers=trimed_cell.get_atomic_numbers(), masses=trimed_cell.get_masses(), #magmoms=trimed_cell.get_magnetic_moments(), scaled_positions=trimed_cell.get_scaled_positions(), cell=trimed_cell.get_cell(), pbc=True) self._p2s_map = np.array(p2s_map, dtype='intc')
def __init__(self, *args, **kwargs): if kwargs.get('filename') is not None: filename = kwargs.pop('filename') ase_Atoms.__init__(self, *args, **kwargs) #ase_Atoms.read(self,filename, kwargs.get('filetype')) #elif isinstance(args[0],ase_Atoms): #self=args[0] #print 'dsdsdsdsdgsdgsdgsdg' #assert False else: ase_Atoms.__init__(self, *args, **kwargs) self.data = {} self.set_data() self.analyzed = []
def __init__(self, *args, **kwargs): if kwargs.get('filename') is not None: filename = kwargs.pop('filename') ase_Atoms.__init__(self, *args, **kwargs) #ase_Atoms.read(self,filename, kwargs.get('filetype')) #elif isinstance(args[0],ase_Atoms): #self=args[0] #print 'dsdsdsdsdgsdgsdgsdg' #assert False else: ase_Atoms.__init__(self, *args, **kwargs) self.data={} self.set_data() self.analyzed=[]
def __init__(self, *args, **kwargs): self.data = {} if len(args) > 0: filename = args[0] if isinstance(filename, str): self.read(filename, kwargs.get('filetype')) return else: Atoms.__init__(self, []) if kwargs.get('filename') is not None: filename = kwargs.pop('filename') Atoms.__init__(self, *args, **kwargs) self.read(filename, kwargs.get('filetype')) else: Atoms.__init__(self, *args, **kwargs)
def __init__(self, *args, **kwargs): self.mc_optim = np.zeros(101, np.intc) Atoms.__init__(self, *args, **kwargs)