def _toatoms(self, include_results=False): if not include_results: return ase.atoms.Atoms( self.numbers, self.positions, cell=self.cell, pbc=(self.pbc & np.array([1, 2, 4])).astype(bool), ) if self.constraints: constraints = json.loads(self.constraints) if len(constraints[0]['kwargs']['indices']) > 0: constraints = [dict2constraint(d) for d in constraints] else: constraints = None atoms = ase.atoms.Atoms(self.numbers, self.positions, cell=self.cell, pbc=(self.pbc & np.array([1, 2, 4])).astype(bool), magmoms=self.magmoms, charges=self.charges, tags=self.tags, masses=self.masses, momenta=self.momenta, constraint=constraints) if not self.calculator == "unknown": params = self.get('calculator_parameters', {}) atoms.calc = get_calculator(self.calculator)(**params) else: all_properties = [ 'energy', 'forces', 'stress', 'dipole', 'charges', 'magmom', 'magmoms', 'free_energy' ] results = {} #print(getattr(self, 'energy')) for prop in all_properties: result = getattr(self, prop, None) if result is not None: results[prop] = result # print(results) if results: atoms.calc = SinglePointCalculator(atoms, **results) atoms.calc.name = getattr(self, 'calculator', 'unknown') atoms.info = {} atoms.info['unique_id'] = self.unique_id atoms.info['key_value_pairs'] = self.key_value_pairs data = self.data if data: atoms.info['data'] = data return atoms
def process_result_value(self, value, dialect): return json.loads(value)
def _dft_code(self): return json.loads(self.key_value_pairs).get('dft_code', '')
def _dft_functional(self): return json.loads(self.key_value_pairs).get('dft_functional', '')
def _facet(self): return json.loads(self.key_value_pairs).get('facet', '').strip("()")
def _substrate(self): return json.loads(self.key_value_pairs).get('substrate', '')
def _adsorbate(self): return json.loads(self.key_value_pairs).get('adsorbate', '')
def _username(self): return json.loads(self.key_value_pairs).get('username', '')
def _reaction(self): reaction = json.loads(self.key_value_pairs).get('reaction', '') reaction = reaction.replace('__', '->').replace('_', '+') return reaction