def get_structure(job): atoms = pyiron_to_ase(job.load_object().get_structure()) atoms_dict = { "symbols": atoms.get_chemical_symbols(), "positions": atoms.get_positions().tolist(), "cell": atoms.get_cell().tolist(), "pbc": atoms.get_pbc().tolist(), "celldisp": atoms.get_celldisp().tolist(), } if atoms.has("tags"): atoms_dict["tags"] = atoms.get_tags().tolist() if atoms.has("masses"): atoms_dict["masses"] = atoms.get_masses().tolist() if atoms.has("momenta"): atoms_dict["momenta"] = atoms.get_momenta().tolist() if atoms.has("initial_magmoms"): atoms_dict["magmoms"] = atoms.get_initial_magnetic_moments().tolist() if atoms.has("initial_charges"): atoms_dict["charges"] = atoms.get_initial_charges().tolist() if not atoms.__dict__["_calc"] == None: warnings.warn("Found calculator: " + str(atoms.__dict__["_calc"])) if not atoms.__dict__["_constraints"] == []: warnings.warn("Found constraint: " + str(atoms.__dict__["_constraints"])) return {"structure": json.dumps(atoms_dict)}
def get_structure(job): atoms = pyiron_to_ase(job.load_object().get_structure()) atoms_dict = { 'symbols': atoms.get_chemical_symbols(), 'positions': atoms.get_positions().tolist(), 'cell': atoms.get_cell().tolist(), 'pbc': atoms.get_pbc().tolist(), 'celldisp': atoms.get_celldisp().tolist() } if atoms.has('tags'): atoms_dict['tags'] = atoms.get_tags().tolist() if atoms.has('masses'): atoms_dict['masses'] = atoms.get_masses().tolist() if atoms.has('momenta'): atoms_dict['momenta'] = atoms.get_momenta().tolist() if atoms.has('initial_magmoms'): atoms_dict['magmoms'] = atoms.get_initial_magnetic_moments().tolist() if atoms.has('initial_charges'): atoms_dict['charges'] = atoms.get_initial_charges().tolist() if not atoms.__dict__['_calc'] == None: warnings.warn('Found calculator: ' + str(atoms.__dict__['_calc'])) if not atoms.__dict__['_constraints'] == []: warnings.warn('Found constraint: ' + str(atoms.__dict__['_constraints'])) return {'structure': json.dumps(atoms_dict)}
def get_steinhardt_parameter_structure(structure, neighbor_method="cutoff", cutoff=0, n_clusters=2, q=(4, 6), averaged=False, clustering=True): """ Calculate Steinhardts parameters Args: job (job): pyiron job neighbor_method (str) : can be ['cutoff', 'voronoi'] cutoff (float) : can be 0 for adaptive cutoff or any other value n_clusters (int) : number of clusters for K means clustering q (list) : can be from 2-12, the required q values to be calculated averaged (bool) : If True, calculates the averaged versions of the parameter clustering (bool) : If True, cluster based on the q values Returns: q (list) : calculated q parameters """ sys = pc.System() sys.read_inputfile( pyiron_to_ase(structure), format='ase', is_triclinic=not UnfoldingPrism(structure.cell, digits=15).is_skewed()) sys.find_neighbors(method=neighbor_method, cutoff=cutoff) sys.calculate_q(q, averaged=averaged) sysq = sys.get_qvals(q, averaged=averaged) if clustering: cl = cluster.KMeans(n_clusters=n_clusters) ind = cl.fit(list(zip(*sysq))).labels_ == 0 return sysq, ind else: return sysq
def get_steinhardt_parameter_structure(structure, cutoff=3.50, n_clusters=2, q=[4, 6]): sys = pc.System() sys.read_inputfile( pyiron_to_ase(structure), format='ase', is_triclinic=not UnfoldingPrism(structure.cell, digits=15).is_skewed() ) sys.find_neighbors( method='cutoff', cutoff=cutoff ) sys.calculate_q( q, averaged=True ) sysq = sys.get_qvals( q, averaged=True ) cl = cluster.KMeans( n_clusters=n_clusters ) ind = cl.fit(list(zip(*sysq))).labels_ == 0 return sysq, ind
def pyiron_to_pymatgen(structure): return AseAtomsAdaptor.get_structure(pyiron_to_ase(structure))
def structure(self, basis): if not isinstance(basis, Atoms): basis = pyiron_to_ase(basis) self._structure = basis
def structure(self, structure): if isinstance(structure, PAtoms): structure = pyiron_to_ase(structure) GenericInteractive.structure.fset(self, structure)