Skip to content
Snippets Groups Projects
Commit cf52e3cd authored by Adam Fekete's avatar Adam Fekete
Browse files

backup

parent d9f9e1df
Branches refactoring
No related tags found
No related merge requests found
Pipeline #182493 failed
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
from atomic_features_package import datasets # structure maps
# tote
```
%% Cell type:code id: tags:
``` python
pip install atomic_feauter_my_data
```
%% Cell type:code id: tags:
db = datasets.load(name='qm9') ``` python
WHAT? <=> MEAN? HOW(WHICH)?
```
%% Cell type:code id: tags:
``` python
from atomic_features_package import datasets
db = datasets.load(name='my_data')
db.describe() db.describe()
db['C'].atomic_size # return value db['C'].atomic_size # return value
db['C'].atomic_size # return value
elements = ['C', 'O', 'N', 'F', 'H'] elements = ['C', 'O', 'N', 'F', 'H']
table = db.get_table(elements, ['atomic_size']) table = db.get_table(elements, ['atomic_size'])
for element in elements: for element in elements:
... ...
# db.query('atomic_size > 1.0, n_neigh =3')
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
from atomic_features_package.category import root from atomic_features_package.category import root
root.find_property('atomic_size') # search for slug/property name or description root.find_property('atomic_size') # search for slug/property name or description
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
from atomic_features_package.property.atomic_properties.physical_poperties import atomic_size from atomic_features_package.property.atomic_properties.physical_poperties import atomic_size
print(atomic_size.describe()) print(atomic_size.describe())
dbs = atomic_size.list_dataset() dbs = atomic_size.list_dataset()
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
# dataset needs to be registered dataset object # dataset needs to be registered dataset object
# a dataset's metadata needs to be registered into the poperty # a dataset's metadata needs to be registered into the poperty
# property needs to be registered into category and tags # property needs to be registered into category and tags
# only properties of already imported datasets can be seen (plugin mechanism?) # only properties of already imported datasets can be seen (plugin mechanism?)
# lazy load: loading the dataset's metadata not the dataset itself # lazy load: loading the dataset's metadata not the dataset itself
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
package package
- multiple datasets (separate metadata) - multiple datasets (separate metadata)
p p
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
from typing import Dict, Generic, TypeVar from typing import Dict, Generic, TypeVar
T = TypeVar("T") T = TypeVar("T")
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
from __future__ import annotations from __future__ import annotations
from pydantic import BaseModel from pydantic import BaseModel
class Foo(BaseModel): class Foo(BaseModel):
a: int = 123 a: int = 123
#: The sibling of `Foo` is referenced directly by type #: The sibling of `Foo` is referenced directly by type
sibling: Foo = None sibling: Foo = None
print(Foo()) print(Foo())
``` ```
%% Output %% Output
a=123 sibling=None a=123 sibling=None
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
x = Foo() x = Foo()
x.a = 1.654654 x.a = 1.654654
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
x x
``` ```
%% Output %% Output
Foo(a=1.654654, sibling=None) Foo(a=1.654654, sibling=None)
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## Properties ## Properties
## Taxonomies: ## Taxonomies:
Fetures: Fetures:
- name - name
- slug - slug
- descrition - descrition
- hierarchical: category - hierarchical: category
- not hierachical: tags - not hierachical: tags
behind the schene behind the schene
register a new taxonomy register a new taxonomy
crete relationship database crete relationship database
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
set(['1','2']) set(['1','2'])
``` ```
%% Output %% Output
{'1', '2'} {'1', '2'}
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
# ?? slug vs name of the object # ?? slug vs name of the object
# https://github.com/fekad/optimade-properties # https://github.com/fekad/optimade-properties
# https://github.com/fekad/optimade-prototype # https://github.com/fekad/optimade-prototype
# https://github.com/fekad/optimade-notes # https://github.com/fekad/optimade-notes
# Metaclasses # Metaclasses
class Taxonomy: class Taxonomy:
pass pass
class Term(BaseModel): class Term(BaseModel):
name: str name: str
slug: str = None slug: str = None
description: str = None description: str = None
class HierarchicalTaxonomy(Taxonomy, Term): class HierarchicalTaxonomy(Taxonomy, Term):
# childs: dict[str, HierarchicalTaxonomy] = None # childs: dict[str, HierarchicalTaxonomy] = None
childs: list[HierarchicalTaxonomy] = None childs: list[HierarchicalTaxonomy] = None
# childs: dict[slug, HierarchicalTaxonomy] = None # childs: dict[slug, HierarchicalTaxonomy] = None
# parent: HierarchicalTaxonomy = None # parent: HierarchicalTaxonomy = None
# def __getitem__(self, key: str) -> HierarchicalTaxonomy: # def __getitem__(self, key: str) -> HierarchicalTaxonomy:
# return self.childs[key] # return self.childs[key]
class NonHierarchicalTaxonomy(Taxonomy, Term): class NonHierarchicalTaxonomy(Taxonomy, Term):
terms: set[Term] = None terms: set[Term] = None
def __getitem__(self, key: str) -> Term: def __getitem__(self, key: str) -> Term:
if key not in self.terms: if key not in self.terms:
raise KeyError(f"{key} not in {self.name}") raise KeyError(f"{key} not in {self.name}")
return key return key
# TODO parametric type # TODO parametric type
class Category(HierarchicalTaxonomy): class Category(HierarchicalTaxonomy):
pass pass
# TODO parametric type # TODO parametric type
class Tags(NonHierarchicalTaxonomy): class Tags(NonHierarchicalTaxonomy):
pass pass
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
# TODO: singular names for categories
root = Category( root = Category(
name="Propeties", name="Property",
description="Category description", description="Category description",
) )
atomic_properties=Category( atomic_properties=Category(
name="Atomic properties", name="Atomic properties",
description="Atomic Properties", description="Atomic Properties",
slug="atomic_properties", slug="atomic_properties",
parent=root, parent=root,
) )
abundances = Category( abundances = Category(
name="Abundances", name="Abundances",
slug="abundances", slug="abundances",
parent=atomic_properties parent=atomic_properties
) )
atom_sizes = Category( atom_sizes = Category(
name="Atom sizes", name="Atom sizes",
slug="atom_sizes", slug="atom_sizes",
parent=atomic_properties parent=atomic_properties
) )
crystal_structure = Category( crystal_structure = Category(
name="Crystal structure", name="Crystal structure",
slug="crystal_structure", slug="crystal_structure",
parent=atomic_properties parent=atomic_properties
) )
electronegativities = Category( electronegativities = Category(
name="Electronegativities", name="Electronegativities",
slug="electronegativities", slug="electronegativities",
parent=atomic_properties parent=atomic_properties
) )
heat_properties = Category( heat_properties = Category(
name="Heat properties", name="Heat properties",
slug="heat_properties", slug="heat_properties",
parent=atomic_properties parent=atomic_properties
) )
isotopes_and_nmr = Category( isotopes_and_nmr = Category(
name="Isotopes and NMR", name="Isotopes and NMR",
slug="isotopes_and_nmr", slug="isotopes_and_nmr",
parent=atomic_properties parent=atomic_properties
) )
orbital_properties = Category( orbital_properties = Category(
name="Orbital properties", name="Orbital property",
slug="orbital_properties", slug="orbital_propert",
parent=atomic_properties parent=atomic_properties
) )
physical_properties = Category( physical_properties = Category(
name="Physical properties", name="Physical properties",
slug="physical_properties", slug="physical_properties",
parent=atomic_properties parent=atomic_properties
) )
print(root.json(indent=2, exclude_none=True)) print(root.json(indent=2, exclude_none=True))
# usage: # usage:
# from atomic_features_package.categories import root # from atomic_features_package.categories import root
# print(root['atomic_properties']['atom_sizes']) # print(root['atomic_properties']['atom_sizes'])
# from atomic_features_package.categories import atom_sizes # from atomic_features_package.categories import atom_sizes
# print(atom_sizes) # print(atom_sizes)
# pros: # pros:
# - it can be more compact # - it can be more compact
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
# Instnatiation # Instnatiation
root = Category( root = Category(
name="Propeties", name="Propeties",
description="Category description", description="Category description",
childs=[ childs=[
Category( Category(
name="Atomic properties", name="Atomic properties",
slug="atomic_properties", slug="atomic_properties",
description="Atomic Properties", description="Atomic Properties",
childs=[ childs=[
Category(name="Abundances", slug="abundances"), Category(name="Abundances", slug="abundances"),
Category(name="Atom sizes", slug="atom_sizes"), Category(name="Atom sizes", slug="atom_sizes"),
Category(name="Crystal structure", slug="crystal_structure"), Category(name="Crystal structure", slug="crystal_structure"),
Category(name="Electronegativities", slug="electronegativities"), Category(name="Electronegativities", slug="electronegativities"),
Category(name="Heat properties", slug="heat_properties"), Category(name="Heat properties", slug="heat_properties"),
Category(name="Isotopes and NMR", slug="isotopes_and_nmr"), Category(name="Isotopes and NMR", slug="isotopes_and_nmr"),
Category(name="Orbital properties", slug="orbital_properties"), Category(name="Orbital properties", slug="orbital_properties"),
Category(name="Physical properties", slug="physical_properties"), Category(name="Physical properties", slug="physical_properties"),
] ]
), ),
] ]
) )
print(root.json(indent=2, exclude_none=True)) print(root.json(indent=2, exclude_none=True))
# usage: # usage:
# from atomic_features_package.categories import root # from atomic_features_package.categories import root
# print(root['atomic_properties']['atom_sizes']) # print(root['atomic_properties']['atom_sizes'])
# pros: # pros:
# - you can see the full hiearchy # - you can see the full hiearchy
# cons: # cons:
# - it could verbose # - it could verbose
``` ```
%% Output %% Output
{ {
"name": "Propeties", "name": "Propeties",
"description": "Category description", "description": "Category description",
"childs": [ "childs": [
{ {
"name": "Atomic properties", "name": "Atomic properties",
"slug": "atomic_properties", "slug": "atomic_properties",
"description": "Atomic Properties", "description": "Atomic Properties",
"childs": [ "childs": [
{ {
"name": "Abundances" "name": "Abundances"
}, },
{ {
"name": "Atom sizes" "name": "Atom sizes"
}, },
{ {
"name": "Atom sizes" "name": "Atom sizes"
}, },
{ {
"name": "Crystal structure" "name": "Crystal structure"
}, },
{ {
"name": "Electronegativities" "name": "Electronegativities"
}, },
{ {
"name": "Heat properties" "name": "Heat properties"
}, },
{ {
"name": "Isotopes and NMR" "name": "Isotopes and NMR"
}, },
{ {
"name": "Orbital properties" "name": "Orbital properties"
}, },
{ {
"name": "Physical properties" "name": "Physical properties"
} }
] ]
} }
] ]
} }
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
category['atomic_properties']['physical_properties'] category['atomic_properties']['physical_properties']
``` ```
%% Output %% Output
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
TypeError Traceback (most recent call last) TypeError Traceback (most recent call last)
/var/folders/5q/g7by8qk10j1d8j0d31ljzm9c0000gn/T/ipykernel_59724/116230986.py in <cell line: 1>() /var/folders/5q/g7by8qk10j1d8j0d31ljzm9c0000gn/T/ipykernel_59724/116230986.py in <cell line: 1>()
----> 1 category['atomic_properties']['physical_properties'] ----> 1 category['atomic_properties']['physical_properties']
TypeError: 'Category' object is not subscriptable TypeError: 'Category' object is not subscriptable
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
tags = Category( tags = Category(
name="tags", name="tags",
description="Tags", description="Tags",
) )
calculated = Tag(name="calculated", slug="calculated", parent=tags) calculated = Tag(name="calculated", slug="calculated", parent=tags)
estimated = Tag(name="estimated", slug="estimated", parent=tags) estimated = Tag(name="estimated", slug="estimated", parent=tags)
measured = Tag(name="measured", slug="measured", parent=tags) measured = Tag(name="measured", slug="measured", parent=tags)
elementary = Tag(name="elementary", slug="elementary", parent=tags) elementary = Tag(name="elementary", slug="elementary", parent=tags)
derived_value = Tag(name="derived value", slug="derived value", parent=tags) derived_value = Tag(name="derived value", slug="derived value", parent=tags)
electron = Tag(name="electron", slug="electron", parent=tags) electron = Tag(name="electron", slug="electron", parent=tags)
proton = Tag(name="proton", slug="proton", parent=tags) proton = Tag(name="proton", slug="proton", parent=tags)
print(tags.json(indent=2, exclude_none=True)) print(tags.json(indent=2, exclude_none=True))
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
tags = NonHierarchicalTaxonomy( tags = NonHierarchicalTaxonomy(
name="tags", name="tags",
description="Tags", description="Tags",
terms={ terms={
"calculated", "calculated",
"estimated", "estimated",
"measured", "measured",
"elementary", "elementary",
"derived value", "derived value",
"electron", "electron",
"proton", "proton",
} }
) )
print(tags.json(indent=2, exclude_none=True)) print(tags.json(indent=2, exclude_none=True))
``` ```
%% Output %% Output
{ {
"name": "tags", "name": "tags",
"description": "Tags", "description": "Tags",
"terms": [ "terms": [
"measured", "measured",
"estimated", "estimated",
"electron", "electron",
"elementary", "elementary",
"calculated", "calculated",
"proton", "proton",
"derived value" "derived value"
] ]
} }
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
# label: Optional[str] = Field(None, title="Latex label", description='Latex symbol of the property') # label: Optional[str] = Field(None, title="Latex label", description='Latex symbol of the property')
# synonyms: List[str] = Field(None, description='List of possible synonyms ()') # synonyms: List[str] = Field(None, description='List of possible synonyms ()')
# dtype: Optional[DType] = Field(DType.float, description='Type of the property') # dtype: Optional[DType] = Field(DType.float, description='Type of the property')
# shape: Optional[List[int]] # shape: Optional[List[int]]
# tensor_rank: Optional[int] = Field(0, description='The rank od the property (default: 0)', ge=0) # tensor_rank: Optional[int] = Field(0, description='The rank od the property (default: 0)', ge=0)
# units: Optional[str] = Field(None, description='') # units: Optional[str] = Field(None, description='')
# unit_system: Optional[str] = Field(None, description='') # unit_system: Optional[str] = Field(None, description='')
# dimension: Optional[str] = Field(None, description='') # dimension: Optional[str] = Field(None, description='')
# class Config: # class Config:
# # TODO: temporary :) # # TODO: temporary :)
# extra = 'allow' # extra = 'allow'
# #
# def as_unit(self, str): # def as_unit(self, str):
# # TODO: lazy unit conversation # # TODO: lazy unit conversation
# pass # pass
class Property(BaseModel): class Property(BaseModel):
name: str name: str
uri: str uri: str
unit: str unit: str
description: str = None description: str = None
category: Category = None # category: Category = None category: Category = None # category: Category = None
tags: list[Tag] = None # tags: list[Tag] = None #
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
# catorgory ref: category/atomic_properties/physical_properties # catorgory ref: category/atomic_properties/physical_properties
# tags ref: tags/estimated, tags/measured # tags ref: tags/estimated, tags/measured
# Note: tag and catogory are singleton objects (uniqueness) # Note: tag and catogory are singleton objects (uniqueness)
# TODO: type and shape # TODO: type and shape
# TODO: complex types > list, dict, list of dicts # TODO: complex types > list, dict, list of dicts
# TODO: doi vs slugs: doi is unique identifier, the name of the object is the slug itself # TODO: doi vs slugs: doi is unique identifier, the name of the object is the slug itself
density_of_solid = Property( density_of_solid = Property(
name="Density of solid", name="Density of solid",
uri=None, uri=None,
description="The density of a solid material is defined as its mass per unit volume.", description="The density of a solid material is defined as its mass per unit volume.",
unit="g/cm3", unit="g/cm3",
category=category['atomic_properties']['physical_properties'], category=category['atomic_properties']['physical_properties'],
tags=[tags['estimated'],tags['measured']] tags=[tags['estimated'],tags['measured']]
) )
density_of_solid = Property( density_of_solid = Property(
name="Density of solid", name="Density of solid",
uri=None, uri=None,
description="The density of a solid material is defined as its mass per unit volume.", description="The density of a solid material is defined as its mass per unit volume.",
unit="g/cm3", unit="g/cm3",
category=category.atomic_properties.physical_properties, category=category.atomic_properties.physical_properties,
tags=[tags.estimated,tags.measured] tags=[tags.estimated,tags.measured]
) )
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
# ionisation energies # ionisation energies
# Ionisation energy number Enthalpy / kJ mol‑1 # Ionisation energy number Enthalpy / kJ mol‑1
# 1st 1086.45 # 1st 1086.45
# 2nd 2352.62 # 2nd 2352.62
# 3rd 4620.47 # 3rd 4620.47
# 4th 6222.68 # 4th 6222.68
# 5th 37831.0 # 5th 37831.0
# 6th 47277.1 # 6th 47277.1
# [1086.45, 2352.62, 4620.47, 6222.68, 37831.0, 47277.1] # [1086.45, 2352.62, 4620.47, 6222.68, 37831.0, 47277.1]
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
# Effective nuclear charges for carbon # Effective nuclear charges for carbon
# 1s 5.6727 # 1s 5.6727
# 2s 3.22 2p 3.14 # 2s 3.22 2p 3.14
# 3s (no data) 3p (no data) 3d (no data) # 3s (no data) 3p (no data) 3d (no data)
# 4s (no data) 4p (no data) 4d (no data) 4f (no data) # 4s (no data) 4p (no data) 4d (no data) 4f (no data)
# 5s (no data) 5p (no data) 5d (no data) # 5s (no data) 5p (no data) 5d (no data)
# 6s (no data) 6p (no data) # 6s (no data) 6p (no data)
# 7s # 7s
# {'1s':5.6727, '2s':3.22, '2p':3.14} # {'1s':5.6727, '2s':3.22, '2p':3.14}
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
# Isotope Mass / Da Natural abundance (atom %) Nuclear spin (I) Magnetic moment (μ/μN) # Isotope Mass / Da Natural abundance (atom %) Nuclear spin (I) Magnetic moment (μ/μN)
[ [
{ {
'Isotope':'12C', 'Isotope':'12C',
'Mass / Da': 12.0000000, 'Mass / Da': 12.0000000,
'Natural abundance (atom %)': 98.93, 'Natural abundance (atom %)': 98.93,
'Nuclear spin (I)': 0, 'Nuclear spin (I)': 0,
'Magnetic moment (μ/μN)': 0 'Magnetic moment (μ/μN)': 0
}, },
{ {
'Isotope':'13C', 'Isotope':'13C',
'Mass / Da': 13.0033548378, 'Mass / Da': 13.0033548378,
'Natural abundance (atom %)': 1.07, 'Natural abundance (atom %)': 1.07,
'Nuclear spin (I)': 1/2, 'Nuclear spin (I)': 1/2,
'Magnetic moment (μ/μN)': 0.702411 'Magnetic moment (μ/μN)': 0.702411
} }
] ]
``` ```
%% Output %% Output
[{'Isotope': '12C', [{'Isotope': '12C',
'Mass / Da': 12.0, 'Mass / Da': 12.0,
'Natural abundance (atom %)': 98.93, 'Natural abundance (atom %)': 98.93,
'Nuclear spin (I)': 0, 'Nuclear spin (I)': 0,
'Magnetic moment (μ/μN)': 0}, 'Magnetic moment (μ/μN)': 0},
{'Isotope': '13C', {'Isotope': '13C',
'Mass / Da': 13.0033548378, 'Mass / Da': 13.0033548378,
'Natural abundance (atom %)': 1.07, 'Natural abundance (atom %)': 1.07,
'Nuclear spin (I)': 0.5, 'Nuclear spin (I)': 0.5,
'Magnetic moment (μ/μN)': 0.702411}] 'Magnetic moment (μ/μN)': 0.702411}]
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
class Material(BaseModel): class Material(BaseModel):
name: str name: str
slug: str slug: str
description: str = None description: str = None
density_of_solid: build_property(density_of_solid, unit="g/cm3") density_of_solid: build_property(density_of_solid, unit="g/cm3")
density_of_solid: density_of_solid.definiton(unit="g/cm3") density_of_solid: density_of_solid.definiton(unit="g/cm3")
``` ```
%% Output %% Output
HierarchicalTaxonomy(name='Atomic properties', description='Atomic Properties', childs={'abundances': HierarchicalTaxonomy(name='Abundances', description=None, childs=None), 'atom_sizes': HierarchicalTaxonomy(name='Atom sizes', description=None, childs=None), 'crystal_structure': HierarchicalTaxonomy(name='Crystal structure', description=None, childs=None), 'electronegativities': HierarchicalTaxonomy(name='Electronegativities', description=None, childs=None), 'heat_properties': HierarchicalTaxonomy(name='Heat properties', description=None, childs=None), 'isotopes_and_nmr': HierarchicalTaxonomy(name='Isotopes and NMR', description=None, childs=None), 'orbital_properties': HierarchicalTaxonomy(name='Orbital properties', description=None, childs=None), 'physical_properties': HierarchicalTaxonomy(name='Physical properties', description=None, childs=None)}) HierarchicalTaxonomy(name='Atomic properties', description='Atomic Properties', childs={'abundances': HierarchicalTaxonomy(name='Abundances', description=None, childs=None), 'atom_sizes': HierarchicalTaxonomy(name='Atom sizes', description=None, childs=None), 'crystal_structure': HierarchicalTaxonomy(name='Crystal structure', description=None, childs=None), 'electronegativities': HierarchicalTaxonomy(name='Electronegativities', description=None, childs=None), 'heat_properties': HierarchicalTaxonomy(name='Heat properties', description=None, childs=None), 'isotopes_and_nmr': HierarchicalTaxonomy(name='Isotopes and NMR', description=None, childs=None), 'orbital_properties': HierarchicalTaxonomy(name='Orbital properties', description=None, childs=None), 'physical_properties': HierarchicalTaxonomy(name='Physical properties', description=None, childs=None)})
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
refering to a property: refering to a property:
- uri? vd code? - uri? vd code?
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
...@@ -53,7 +53,7 @@ class FhiAimsSpin(BaseModel): ...@@ -53,7 +53,7 @@ class FhiAimsSpin(BaseModel):
atomic_element_symbol: str = Field(description="""Provides the symbol of element as per periodic table""") atomic_element_symbol: str = Field(description="""Provides the symbol of element as per periodic table""")
atomic_r_s: Optional[list[float]] = Field(description="""Provides the s orbital atomic radii [angstrom]""") atomic_r_s: Optional[list[float]] = Field(description="""Provides the s orbital atomic radii [angstrom]""")
atomic_r_p: Optional[list[float]] = Field(description="""Provides the p orbital atomic radii [angstrom]""") atomic_r_p: Optional[list[float]] = Field(description="""Provides the p orbital atomic radii [angstrom]""")
atomic_r_d: Optional[list[float]] = eField(description="""Provides the d orbital atomic radii [angstrom]""") atomic_r_d: Optional[list[float]] = Field(description="""Provides the d orbital atomic radii [angstrom]""")
atomic_r_val: list[float] = Field(description="""Provides the atomic radii of element [angstrom]""") atomic_r_val: list[float] = Field(description="""Provides the atomic radii of element [angstrom]""")
atomic_ea: float = Field(description="""Provides the atomic electron affinity calculated from energy difference [joule]""") atomic_ea: float = Field(description="""Provides the atomic electron affinity calculated from energy difference [joule]""")
atomic_ip: float = Field(description="""Provides the atomic ionization potential calculated from energy difference [joule]""") atomic_ip: float = Field(description="""Provides the atomic ionization potential calculated from energy difference [joule]""")
......
#%%
from pydantic import BaseModel, Field
class Property(BaseModel):
name: str
descrtption: str
type: type
unit: str
# %%
class Category(BaseModel):
name: str
description: str
properties: dict[str, Property]
# %%
class Model(BaseModel):
prop:float = Field(..., description='hello', unit='eV')
# %%
class PymatgenData(BaseModel)
\ No newline at end of file
#%%
from pydantic import BaseModel, Field
class Property(BaseModel):
name: str
descrtption: str
type: type
unit: str
# %%
class Category(BaseModel):
name: str
description: str
properties: dict[str, Property]
# %%
class Model(BaseModel):
prop:float = Field(..., description='hello', unit='eV')
# %%
class PymatgenData(BaseModel)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment