diff --git a/nomad/datamodel/metainfo/basesections.py b/nomad/datamodel/metainfo/basesections.py index 315c1f575a816d68e05d86a20ab1ee44f8e775fb..e9a07aa9dcf3f11f6d608d3536d619cdbb2d24f0 100644 --- a/nomad/datamodel/metainfo/basesections.py +++ b/nomad/datamodel/metainfo/basesections.py @@ -732,6 +732,7 @@ class Instrument(Entity): ''' A base section that can be used for instruments. ''' + def normalize(self, archive, logger: 'BoundLogger') -> None: ''' The normalizer for the `Instrument` class. @@ -1383,6 +1384,14 @@ class PubChemPureSubstanceSection(PureSubstanceSection): ), ) + load_data = Quantity( + type=bool, + default=True, + a_eln=dict( + component='BoolEditQuantity', + ), + ) + def _populate_from_cid(self, logger: 'BoundLogger') -> None: ''' Private method for populating unfilled properties by searching the PubChem using @@ -1525,12 +1534,12 @@ class PubChemPureSubstanceSection(PureSubstanceSection): ''' if logger is None: logger = utils.get_logger(__name__) - - if self.pub_chem_cid: - if any(getattr(self, value) is None for value in self.m_def.all_quantities): - self._populate_from_cid(logger) - else: - self._find_cid(logger) + if self.load_data: + if self.pub_chem_cid: + if any(getattr(self, value) is None for value in self.m_def.all_quantities): + self._populate_from_cid(logger) + else: + self._find_cid(logger) super(PubChemPureSubstanceSection, self).normalize(archive, logger)