Property

Basics of a Property

A Property stores all of the information about the output of a calculation. A Property is usually extracted from a Configuration object using the parse_data() of a Dataset() object. For more details about how this data is stored on a Configuration, see Configuration info and arrays fields. For more details on how to specify the mapping for loading data off of a Configuration, see Parsing data.

Best practice is to also include a PropertySettings object.

class colabfit.tools.property.Property(definition, instance, configuration_ids, property_map=None, settings=None, instance_id=1, convert_units=False)

A Property is used to store the results of some kind of calculation or experiment, and should be mapped to an OpenKIM Property Definition. Best practice is for the Property to also point to one or more PropertySettings objects that fully define the conditions under which the Property was obtained.

definition

A KIM Property Definition

Type

dict

instance

A dictionary defining an OpenKIM Property Instance. For more details, see the OpenKIM Property Framework documentation. In most cases, this dictionary should not be manually constructed by the user. Instead, a Property Definition and a Configuration should be passed to the from_definition() function.

Type

dict

property_map

key = a string that can be used as a key like self.instance[key]

value = A sub-dictionary with the following keys:

  • field:

    A field name used to access Configuration.info or Configuration.arrays

  • units:

    A string matching one of the units names in ase.units. These units will be used to convert the given units to eV, Angstrom, a.m.u., Kelvin, … For compound units (e.g. “eV/Ang”), the string will be split on ‘*’ and ‘/’. The raw data will be multiplied by the first unit and anything preceded by a ‘*’. It will be divided by anything preceded by a ‘/’.

Type

dict

configuration_ids

A list of IDs of Configuration objects.

Type

list

settings

A PropertySettings object defining the conditions under which the propoerty was obtained. This is allowed to be None, but it is highly recommended that it be provided.

Type

PropertySettings

__delitem__(k)

Delete self[key].

__eq__(other)

Returns False if any of the following conditions are true:

  • Properties point to settings with different calculation methods

  • Properties point to different configurations

  • OpenKIM EDN fields differ in any way

Note that comparison is performed by hashing

__getitem__(k)

Overloaded dict.__getitem__() for getting the values of self.edn

__hash__()

Hashes the Property by hashing its EDN. Note that the property hash also depends upon the hashes of the linked configurations; this is to handle the case where two properties happen to be the same even though their underlying configurations are different.

__init__(definition, instance, configuration_ids, property_map=None, settings=None, instance_id=1, convert_units=False)
Parameters
  • definition (dict) – A KIM Property Definition

  • instance (dict) – A dictionary defining an OpenKIM Property Instance

  • configuration_ids (list) – A list of IDs of ColabFit Configuration objects

  • settings (PropertySettings) – A colabfit.property.PropertySettings objects specifying how to compute the property.

  • property_map (dict) – A property map as described in the Property attributes section.

  • instance_id (int) – A positive non-zero integer

  • convert_units (bool) – If True, converts units to those expected by ColabFit. Default is False

__repr__()

Return repr(self).

__setitem__(k, v)

Overloaded dict.__setitem__() for setting the values of self.edn

__str__()

Return str(self).

__weakref__

list of weak references to the object (if defined)

convert_units()

For each key in self.property_map, convert self.edn[key] from its original units to the expected ColabFit-compliant units.

classmethod from_definition(definition, configuration, property_map, settings=None, instance_id=1, convert_units=False)

A function for constructing a Property given a configuration, a property definition, and a property map.

Parameters
  • definition (dict) – A valid KIM Property Definition

  • configuration (Configuration) – A Configuration objects from which to extract the property data

  • property_map (dict) – A property map as described in the Property attributes section.

get_data(k)

First checks if k is in self.edn. If not, checks under possible pseudonyms. If nothing exists, returns np.nan

Returns

self[k]['source-value'] if k is a valid key, else np.nan.

Return type

data (np.array or np.nan)

keys()

Overloaded dictionary function for getting the keys of self.edn