MCPcopy Create free account
hub / github.com/SINGROUP/dscribe / create_single

Method create_single

dscribe/descriptors/mbtr.py:391–420  ·  view source on GitHub ↗

Return the many-body tensor representation for the given system. Args: system (:class:`ase.Atoms` | :class:`.System`): Input system. Returns: np.ndarray | sparse.COO: A single concatenated output vector is returned, either as a sparse or a dense

(self, system)

Source from the content-addressed store, hash-verified

389 return output
390
391 def create_single(self, system):
392 """Return the many-body tensor representation for the given system.
393
394 Args:
395 system (:class:`ase.Atoms` | :class:`.System`): Input system.
396
397 Returns:
398 np.ndarray | sparse.COO: A single concatenated output vector is
399 returned, either as a sparse or a dense vector.
400 """
401 # Ensuring variables are re-initialized when a new system is introduced
402 self.system = system
403 self._interaction_limit = len(system)
404
405 # Validate and normalize system
406 self.validate_positions(system.get_positions())
407 self.validate_atomic_numbers(system.get_atomic_numbers())
408 pbc = self.validate_pbc(system.get_pbc())
409 self.validate_cell(system.get_cell(), pbc)
410
411 mbtr, _ = getattr(self, f"_get_k{self.k}")(system, True, False)
412
413 # Handle normalization
414 if self.normalization == "l2":
415 mbtr /= np.linalg.norm(np.array(mbtr.data))
416 elif self.normalization == "n_atoms":
417 n_atoms = len(system)
418 mbtr /= n_atoms
419
420 return mbtr
421
422 def get_number_of_features(self):
423 """Used to inquire the final number of features that this descriptor

Callers 2

derivatives_numericalMethod · 0.45
derivatives_numericalMethod · 0.45

Calls 5

validate_positionsMethod · 0.80
get_atomic_numbersMethod · 0.80
validate_pbcMethod · 0.80
validate_cellMethod · 0.80

Tested by

no test coverage detected