diff --git a/.gitignore b/.gitignore
index dbbd457..2b514ca 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,13 @@ rdf_structure_store/
*.db
wf*
*.data
+*.ipynb
+*.dump
+*POSCAR*
+*.tar.gz
+*.in
+*.dot
+*.png
# Byte-compiled / optimized / DLL files
__pycache__/
diff --git a/atomrdf/data/asmo.owl b/atomrdf/data/asmo.owl
index bf333f6..506b35c 100644
--- a/atomrdf/data/asmo.owl
+++ b/atomrdf/data/asmo.owl
@@ -10,13 +10,23 @@
xmlns:prov="http://www.w3.org/ns/prov#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
- xmlns:terms="http://purl.org/dc/terms/">
+ xmlns:terms="http://purl.org/dc/terms/"
+ xmlns:schema="https://schema.org/">
- https://orcid.org/0000-0002-6776-1213
- https://orcid.org/0000-0001-7564-7990
+
+
+
+
+
ASMO is an ontology that aims to define the concepts needed to describe commonly used atomic scale simulation methods, i.e. density functional theory, molecular dynamics, Monte Carlo methods, etc. ASMO uses the Provenance Ontology (PROV-O) to describe the simulation process.
+ https://creativecommons.org/licenses/by/4.0/
Atomistic Simulation Methods Ontology (ASMO)
+ https://github.com/OCDO/asmo
0.0.1
+ Azocar Guzman, A., Menon, S., Hofmann, V., Hickel, T., Sandfeld. S. (2024), Atomistic Simulation Methods Ontology, https://purls.helmholtz-metadaten.de/asmo/
+ Pre-release
+ https://ror.org/05qj6w324
+ https://raw.githubusercontent.com/OCDO/.github/refs/heads/main/profile/ocdo_logo.png
@@ -182,6 +192,16 @@ f(x) = 1/(√(2 π) σ) e^-((x - μ)^2/(2 σ^2))
+
+
+
+ License
+ A legal document giving official permission to do something with the resource.
+
+
+
+
+
@@ -312,6 +332,30 @@ f(x) = 1/(√(2 π) σ) e^-((x - μ)^2/(2 σ^2))
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A data property linking an addition with the addend value.
+ has addend
+
+
+
+
+
+
+
+
+
+ A data property linking a subtraction with the difference value.
+ has difference
+
+
+
+
+
+
+
+
+
+ A data property linking a division with the dividend value.
+ has dividend
+
+
+
+
+
+
+
+
+
+ A data property linking a division with the divisor value.
+ has divisor
+
+
+
+
+
+
+
+
+
+ A data property linking a multiplication with the factor value.
+ has factor
+
+
+
+
+
+
+
+
+
+ A data property linking a subtraction with the minuend value.
+ has minuend
+
+
+
+
+
+
+
+
+
+ A data property linking a multiplication with the product value.
+ has product
+
+
+
+
+
+
+
+
+
+ A data property linking a division with the quotient value.
+ has quotient
+
+
+
+
+
+
+
+
+
+ A data property linking a subtraction with the subtrahend value.
+ has subtrahend
+
+
+
+
+
+
+
+
+
+ A data property linking an addition with the sum value.
+ has sum
+
+
+
+
@@ -697,8 +851,8 @@ prov:wasInfluencedBy should not be used without also using one of its subpropert
+ A data property linking an entity with a reference (e.g. bibliographic) to another resource.
has reference
- A data property linking an entity with a reference (e.g. bibliographic) to another resource.
@@ -760,6 +914,16 @@ prov:wasInfluencedBy should not be used without also using one of its subpropert
+
+
+
+
+ An arithmetic operation by which the total or sum of two or more numbers is computed, symbolized by the plus symbol +.
+ Addition
+
+
+
+
@@ -781,6 +945,16 @@ prov:wasInfluencedBy should not be used without also using one of its subpropert
+
+
+
+
+ An arithmetic operation by which the quotient of two numbers (dividen and divisor) is computed, symbolized by / or ÷.
+ Division
+
+
+
+
@@ -797,7 +971,7 @@ prov:wasInfluencedBy should not be used without also using one of its subpropert
-
+
Energy calculation is an activity where the energy of the system is computed within the given optimization constraints.
This activity does not specify the way the energy is calculated, it can be used to refer to a rigid calculation or also to energy minimization or optimization. See RelaxationDOF class for specifics about the constraints.
Energy Calculation
@@ -805,11 +979,14 @@ prov:wasInfluencedBy should not be used without also using one of its subpropert
-
+
-
-
- Energy Difference Calculation
+
+
+ Equation of state is a relationship between the volume of a body and the pressure to which it is subjected. There are multiple proposed equations for fitting the values of the energy as a function of the volume obtained from ab-initio and molecular dynamics calculations.
+ Equation of State Fit
+ EOS
+ Equation of State
@@ -872,6 +1049,18 @@ prov:wasInfluencedBy should not be used without also using one of its subpropert
+
+
+
+
+ In mathematics, an operation is a function which takes zero or more input values (also called "operands" or "arguments") to a well-defined output value.
+ https://en.wikipedia.org/wiki/Operation_(mathematics)
+ Mathematical Operation
+ http://purl.obolibrary.org/obo/NCIT_C54025
+
+
+
+
@@ -932,6 +1121,36 @@ prov:wasInfluencedBy should not be used without also using one of its subpropert
+
+
+
+
+ An arithmetic operation by which the product of two numbers is computed, symbolized by x or *.
+ http://purl.obolibrary.org/obo/NCIT_C90596
+ Multiplication
+
+
+
+
+
+
+
+
+ Point defect creation is a type of structure manipulation to introduce a point defect, i.e. add, delete or substitute atoms.
+ Point Defect Creation
+
+
+
+
+
+
+
+
+ Quasi-harmonic Model
+
+
+
+
@@ -943,6 +1162,47 @@ prov:wasInfluencedBy should not be used without also using one of its subpropert
+
+
+
+
+ Rotation is a type of spatial transformation described by the motion of an object around a point or axis.
+ Rotation
+
+
+
+
+
+
+
+
+ Shear
+
+
+
+
+
+
+
+
+ In computational materials science, a simulation refers to the production of a computer model of a material system, for the purpose of imitating a process over time.
+ Simulation
+
+
+
+
+
+
+
+
+ Spatial transformation is a type of structure manipulation to convert the coordinates of an image to the coordinates of a reference image.
+ https://doi.org/10.1561/0600000009
+ The spatial transformations that involve translation or rotation are generally considered rigid body or Euclidean transformations, since the Euclidean distances within images are preserved. In contrast, the other ones are classified as non-rigid or elastic.
+ Spatial Transformation
+
+
+
+
@@ -964,6 +1224,45 @@ prov:wasInfluencedBy should not be used without also using one of its subpropert
+
+
+
+
+ Structure manipulation is an activity where methods are applied to a structure (e.g. atomic structure) to modify it.
+ Structure Manipulation
+
+
+
+
+
+
+
+
+ An arithmetic operation by which the removal of a number from another number or amount is computed, symbolized by the minus symbol -.
+ Subtraction
+
+
+
+
+
+
+
+
+ Thermodynamic Integration
+
+
+
+
+
+
+
+
+ Translation is a type of spatial transformation described by the motion of every point of an object by the same distance in a given direction.
+ Translation
+
+
+
+
@@ -1176,6 +1475,16 @@ prov:wasInfluencedBy should not be used without also using one of its subpropert
+
+
+
+
+ Substitution of an atom to create an impurity.
+ Add Atom
+
+
+
+
@@ -1186,6 +1495,18 @@ prov:wasInfluencedBy should not be used without also using one of its subpropert
+
+
+
+
+ Equation of state proposed by Albert Francis Birch in 1947, based on the Murnaghan equation.
+ https://doi.org/10.1103/PhysRev.71.809
+ https://en.wikipedia.org/wiki/Birch%E2%80%93Murnaghan_equation_of_state
+ Birch-Murnaghan
+
+
+
+
@@ -1218,6 +1539,16 @@ prov:wasInfluencedBy should not be used without also using one of its subpropert
+
+
+
+
+ Deletion of an atom to create a vacancy.
+ Delete Atom
+
+
+
+
@@ -1263,6 +1594,51 @@ prov:wasInfluencedBy should not be used without also using one of its subpropert
Microcanonical Ensemble
NVE ensemble
+
+
+
+
+
+
+
+ Equation of state proposed by Francis D. Murnaghan in 1944. The Murnaghan equation is derived, under certain assumptions, from the equations of continuum mechanics. It involves two adjustable parameters: the modulus of incompressibility K0 and its first derivative with respect to the pressure, K′0, both measured at ambient pressure.
+ "Finite Deformation of an Elastic Solid", Applied mathematics series, ISSN 0272-1643
+ https://en.wikipedia.org/wiki/Murnaghan_equation_of_state
+ Murnaghan
+
+
+
+
+
+
+
+
+ Substitution of an atom to create an impurity.
+ Substitute Atom
+
+
+
+
+
+
+
+
+ EOS calculation using a third-order polynomial fit.
+ Third-order polynomial fit
+
+
+
+
+
+
+
+
+ Equation of state proposed by Pascal Vinet in 1987. It is a modification of the Birch–Murnaghan equation of state.
+ https://doi.org/10.1103/PhysRevB.35.1945
+ https://en.wikipedia.org/wiki/Rose%E2%80%93Vinet_equation_of_state
+ Vinet
+ Rose–Vinet
+
diff --git a/atomrdf/data/cmso.owl b/atomrdf/data/cmso.owl
index 52975eb..07d6762 100644
--- a/atomrdf/data/cmso.owl
+++ b/atomrdf/data/cmso.owl
@@ -9,16 +9,23 @@
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
- xmlns:terms="http://purl.org/dc/terms/">
+ xmlns:terms="http://purl.org/dc/terms/"
+ xmlns:schema="https://schema.org/">
- https://orcid.org/0000-0001-9560-4728
- https://orcid.org/0000-0002-5149-603X
- https://orcid.org/0000-0002-6776-1213
- https://orcid.org/0000-0003-0698-4891
- https://orcid.org/0000-0001-7564-7990
+
+
+
+
+
CMSO is an ontology that aims to describe computational materials science samples (or structures), including crystalline defects.
+ https://creativecommons.org/licenses/by/4.0/
Computational Material Sample Ontology (CMSO)
+ https://github.com/OCDO/cmso-ontology
0.0.1
+ Azocar Guzman, A., Menon, S., Hofmann, V., Hickel, T., Sandfeld. S. (2024), Computational Material Sample Ontology, https://purls.helmholtz-metadaten.de/cmso/
+ Pre-release
+ https://ror.org/05qj6w324
+ https://raw.githubusercontent.com/OCDO/.github/refs/heads/main/profile/ocdo_logo.png
@@ -40,6 +47,12 @@
+
+
+
+
+
+
@@ -105,6 +118,18 @@ We also have the outstanding issue of how to aim different definitions to differ
+
+
+
+ A normal distribution probability density function has a formula of:
+f(x) = 1/(√(2 π) σ) e^-((x - μ)^2/(2 σ^2))
+ An annotation property that represents a mathematical formula.
+ Asiyah Yu Lin, Jie Zheng, Yongqun He
+ mathematical formula
+
+
+
+
@@ -180,6 +205,16 @@ We also have the outstanding issue of how to aim different definitions to differ
+
+
+
+ License
+ A legal document giving official permission to do something with the resource.
+
+
+
+
+
@@ -255,6 +290,30 @@ We also have the outstanding issue of how to aim different definitions to differ
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The relation between a plane and a vector normal to it.
+ has normal vector
+
+
+
+
@@ -634,6 +705,17 @@ We also have the outstanding issue of how to aim different definitions to differ
+
+
+
+
+
+ A data property linking an plane with the value of distance from its origin.
+ has distance from origin
+
+
+
+
@@ -1080,6 +1162,16 @@ We also have the outstanding issue of how to aim different definitions to differ
+
+
+
+
+ In crystallography, lattice planes are sets of parallel mathematical planes, where each lattice point is on a lattice plane. The lattice plane of a crystal is represented by three integers —h,k,l— which are referred to as the Miller indices.
+ Lattice Plane
+
+
+
+
@@ -1174,6 +1266,16 @@ We also have the outstanding issue of how to aim different definitions to differ
+
+
+
+
+ The normal vector is a vector perpendicular to a given object.
+ Normal Vector
+
+
+
+
@@ -1185,6 +1287,17 @@ We also have the outstanding issue of how to aim different definitions to differ
+
+
+
+ In mathematics, a plane is a two-dimensional space or flat surface that extends indefinitely.
+ 𝑎 𝑥 + 𝑏 𝑦 + 𝑐 𝑧 + 𝑑 = 0
+ The equation of a plane is 𝑎 𝑥 + 𝑏 𝑦 + 𝑐 𝑧 + 𝑑 = 0 , where 𝑎 , 𝑏 , and 𝑐 are the components of the normal vector ⃑ 𝑛 = ( 𝑎 , 𝑏 , 𝑐 ) , which is perpendicular to the plane or any vector parallel to the plane.
+ Plane
+
+
+
+
diff --git a/atomrdf/data/pldo.owl b/atomrdf/data/pldo.owl
index 61bcb9e..f5f9150 100644
--- a/atomrdf/data/pldo.owl
+++ b/atomrdf/data/pldo.owl
@@ -331,6 +331,8 @@ We also have the outstanding issue of how to aim different definitions to differ
A data property indicating the misorientation angle (θ) of the grains with respect to each other.
+ https://doi.org/10.1016/j.actamat.2022.118006
+ A disorientation angle can also be used to describe the grain boundary and is defined by the minimum misorientation angle when the misorientation axis is found in the standard stereographic triangle.
has misorientation angle
diff --git a/atomrdf/graph.py b/atomrdf/graph.py
index b291d86..4ef2600 100644
--- a/atomrdf/graph.py
+++ b/atomrdf/graph.py
@@ -916,6 +916,8 @@ def archive(self, package_name, format="turtle", compress=True, add_simulations=
# now go through each sample, and copy the file, at the same time fix the paths
for sample in self.sample_ids:
filepath = self.value(URIRef(f"{sample}_Position"), CMSO.hasPath).toPython()
+ #filepath has to fixed with the correct prefix as needed
+ filepath = os.path.join(self.structure_store, os.path.basename(filepath))
shutil.copy(filepath, structure_store)
# now we have to remove the old path, and fix new
@@ -1500,10 +1502,11 @@ def _get_ancestor(self, prop, prov):
propname = _name(prop)
operation = [x[1] for x in self.triples((prop, ASMO.wasCalculatedBy, None))]
+
if len(operation) > 0:
parent = [x[2] for x in self.triples((prop, ASMO.wasCalculatedBy, None))]
operation = operation[0]
- parent = parent[0]
+ parent = parent[0]
prov[propname]['operation'] = 'output_parameter'
prov[propname]['inputs'] = {}
prov[propname]['inputs']['0'] = _name(parent)
@@ -1583,7 +1586,7 @@ def _get_ancestor(self, prop, prov):
prov[propname]['inputs']['1'] = _name(dividend)
self._add_to_dict(divisor, prov)
self._add_to_dict(dividend, prov)
-
+ print(operation)
prov[propname]['found'] = True
return prov
diff --git a/atomrdf/namespace.py b/atomrdf/namespace.py
index d6cb5ae..9a5a1f5 100644
--- a/atomrdf/namespace.py
+++ b/atomrdf/namespace.py
@@ -83,9 +83,9 @@ def __init__(self, infile, delimiter="/"):
PLDO = Namespace(os.path.join(file_location, "data/pldo.owl"))
PODO = Namespace(os.path.join(file_location, "data/podo.owl"))
ASMO = Namespace(os.path.join(file_location, "data/asmo.owl"))
+MATH = Namespace(os.path.join(file_location, "data/asmo.owl"))
+
PROV = RDFLibNamespace("http://www.w3.org/ns/prov#")
MDO = RDFLibNamespace("https://w3id.org/mdo/calculation/")
-
-MATH = RDFLibNamespace("http://purls.helmholtz-metadaten.de/asmo/")
UNSAFECMSO = RDFLibNamespace("http://purls.helmholtz-metadaten.de/cmso/")
UNSAFEASMO = RDFLibNamespace("http://purls.helmholtz-metadaten.de/asmo/")
diff --git a/atomrdf/network/ontology.py b/atomrdf/network/ontology.py
index 30df473..173e15d 100644
--- a/atomrdf/network/ontology.py
+++ b/atomrdf/network/ontology.py
@@ -34,10 +34,10 @@ def read_ontology():
file_location = os.path.dirname(__file__).split("/")
file_location = "/".join(file_location[:-1])
- cmso = OntologyNetwork(os.path.join(file_location, "data/cmso.owl")) #eb8a58a60af1759afc4115ae395ad62ddffb6844
- pldo = OntologyNetwork(os.path.join(file_location, "data/pldo.owl")) #d15d27712e3f64b405d75c70ad970c9d54ff0b51
+ cmso = OntologyNetwork(os.path.join(file_location, "data/cmso.owl")) #b7c8f3544d16d0ec9a9aace682da0e6abba1c57f
+ pldo = OntologyNetwork(os.path.join(file_location, "data/pldo.owl")) #688ce36a3e6520a6e280bb248789c231d3c36f25
podo = OntologyNetwork(os.path.join(file_location, "data/podo.owl")) #6a74d511c5b78042e1cb7a6e76e948fa56de598e
- asmo = OntologyNetwork(os.path.join(file_location, "data/asmo.owl")) #c7e2da99b9126844f19f225c6a10cdb01aeb55e6
+ asmo = OntologyNetwork(os.path.join(file_location, "data/asmo.owl")) #688ce36a3e6520a6e280bb248789c231d3c36f25
ldo = OntologyNetwork(os.path.join(file_location, "data/ldo.owl")) #e23fa9930351787e701347878a3e1a0e3924d084
# combine them
diff --git a/atomrdf/properties.py b/atomrdf/properties.py
index 0725538..c0af38c 100644
--- a/atomrdf/properties.py
+++ b/atomrdf/properties.py
@@ -440,4 +440,4 @@ def _get_symmetry_dict(system):
atom_types = system._structure_dict["species"]
results = spglib.get_symmetry_dataset((box, direct_coordinates, atom_types))
- return results["international"], results["number"]
+ return results.international, results.number
diff --git a/atomrdf/sample.py b/atomrdf/sample.py
index 893dd0e..d677727 100644
--- a/atomrdf/sample.py
+++ b/atomrdf/sample.py
@@ -4,7 +4,7 @@
In this module a new Sample class is defined.
"""
from pyscal3.atoms import AttrSetter
-from atomrdf.namespace import CMSO, PLDO, PODO, ASMO, PROV, Literal
+from atomrdf.namespace import CMSO, PLDO, PODO, ASMO, PROV, Literal, UNSAFEASMO
from rdflib import RDFS, Namespace, RDF, URIRef
import numpy as np
import uuid
@@ -22,8 +22,9 @@ def __init__(self, name, sample_id, graph):
#create attributes
self.properties = AttrSetter()
mapdict = {
- 'volume': self._volume,
- 'no_of_atoms': self._no_of_atoms,
+ 'SimulationCellVolume': self._volume,
+ 'NumberOfAtoms': self._no_of_atoms,
+ 'SimulationCellLengths': self._simulation_cell_lengths,
}
self.properties._add_attribute(mapdict)
@@ -55,21 +56,26 @@ def structure(self):
@property
def _volume(self):
+ """
+ Volume of the sample, PhysicalQuantity
+ """
+ #get the simulation cell
simcell = self._graph.value(self._sample_id, CMSO.hasSimulationCell)
+ #get the volume, these are volume objects now!
volume = self._graph.value(simcell, CMSO.hasVolume)
+ volume_value = self._graph.value(volume, ASMO.hasValue)
- #initially query if there is property with label volume
+ #find there are already volume attached as calculated property
inps = [k[2] for k in self._graph.triples((self._sample_id, CMSO.hasCalculatedProperty, None))]
+ #initially query if there is property with label volume
labels = [self._graph.value(inp, RDFS.label) for inp in inps]
- if not "Volume" in labels:
- parent = self._graph.create_node(URIRef(f'property:{uuid.uuid4()}'), CMSO.CalculatedProperty)
- self._graph.add((parent, ASMO.hasValue, Literal(volume.toPython())))
- self._graph.add((parent, RDFS.label, Literal("Volume")))
- self._graph.add((self._sample_id, CMSO.hasCalculatedProperty, parent))
- self._graph.add((parent, ASMO.hasUnit, URIRef(f"http://qudt.org/vocab/unit/ANGSTROM3")))
+ if not "SimulationCellVolume" in labels:
+ #add this as a calculated property
+ self._graph.add((self._sample_id, CMSO.hasCalculatedProperty, volume))
+ parent = volume
else:
- parent = inps[labels.index("Volume")]
- return Property(volume.toPython(), graph=self._graph, parent=parent, unit='ANGSTROM3', sample_parent=self._sample_id)
+ parent = inps[labels.index("SimulationCellVolume")]
+ return Property(volume_value.toPython(), graph=self._graph, parent=parent, unit='ANGSTROM3', sample_parent=self._sample_id)
@property
def _no_of_atoms(self):
@@ -77,7 +83,7 @@ def _no_of_atoms(self):
inps = [k[2] for k in self._graph.triples((self._sample_id, CMSO.hasCalculatedProperty, None))]
labels = [self._graph.value(inp, RDFS.label) for inp in inps]
if not "NumberOfAtoms" in labels:
- parent = self._graph.create_node(URIRef(f'property:{uuid.uuid4()}'), CMSO.CalculatedProperty)
+ parent = self._graph.create_node(URIRef(f'property:{uuid.uuid4()}'), UNSAFEASMO.InputParameter)
self._graph.add((parent, ASMO.hasValue, Literal(no_atoms.toPython())))
self._graph.add((parent, RDFS.label, Literal("NumberOfAtoms")))
self._graph.add((self._sample_id, CMSO.hasCalculatedProperty, parent))
@@ -85,7 +91,15 @@ def _no_of_atoms(self):
parent = inps[labels.index("NumberOfAtoms")]
return Property(no_atoms.toPython(), graph=self._graph, parent=parent, sample_parent=self._sample_id)
-
+ @property
+ def _simulation_cell_lengths(self):
+ simcell = self._graph.value(self._sample_id, CMSO.hasSimulationCell)
+ simcelllength = self._graph.value(simcell, CMSO.hasLength)
+ x = self._graph.value(simcelllength, CMSO.hasLength_x).toPython()
+ y = self._graph.value(simcelllength, CMSO.hasLength_y).toPython()
+ z = self._graph.value(simcelllength, CMSO.hasLength_z).toPython()
+ return Property([x, y, z], graph=self._graph, parent=simcelllength, sample_parent=self._sample_id)
+
@property
def _input_properties(self):
activity = self._graph.value(self._sample_id, PROV.wasGeneratedBy)
diff --git a/atomrdf/structure.py b/atomrdf/structure.py
index 852a236..43deca1 100644
--- a/atomrdf/structure.py
+++ b/atomrdf/structure.py
@@ -1160,7 +1160,7 @@ def delete(self, ids=None, indices=None, condition=None, selection=False, copy_s
#write mapping for the operation
if self.sample.toPython() != sys.sample.toPython():
- activity = self.graph.create_node(f"activity:{uuid.uuid4()}", UNSAFEASMO.DeleteAtom)
+ activity = self.graph.create_node(f"activity:{uuid.uuid4()}", ASMO.DeleteAtom)
sys.graph.add((sys.sample, PROV.wasDerivedFrom, self.sample))
sys.graph.add((sys.sample, PROV.wasGeneratedBy, activity))
@@ -1373,7 +1373,7 @@ def substitute_atoms(
#write mapping for the operation
if self.sample.toPython() != sys.sample.toPython():
- activity = self.graph.create_node(f"activity:{uuid.uuid4()}", UNSAFEASMO.SubstituteAtom)
+ activity = self.graph.create_node(f"activity:{uuid.uuid4()}", ASMO.SubstituteAtom)
sys.graph.add((sys.sample, PROV.wasDerivedFrom, self.sample))
sys.graph.add((sys.sample, PROV.wasGeneratedBy, activity))
@@ -1480,7 +1480,8 @@ def add_interstitial_impurities(
if copy_structure:
#sys = self.duplicate()
- sys = System(source=sys.add_atoms({"positions": randpos, "species": element}))
+ sys = System(source=sys.add_atoms({"positions": randpos, "species": element}))
+ sys.graph = self.graph
sys.to_graph()
sys.copy_defects(self.sample)
else:
@@ -1569,7 +1570,7 @@ def add_interstitial_impurities(
sys.add_triples_for_interstitial_impurities(conc_of_impurities, no_of_impurities=no_of_impurities, label=void_type)
#write mapping for the operation
if self.sample.toPython() != sys.sample.toPython():
- activity = self.graph.create_node(f"activity:{uuid.uuid4()}", UNSAFEASMO.AddAtom)
+ activity = self.graph.create_node(f"activity:{uuid.uuid4()}", ASMO.AddAtom)
sys.graph.add((sys.sample, PROV.wasDerivedFrom, self.sample))
sys.graph.add((sys.sample, PROV.wasGeneratedBy, activity))
return sys
@@ -1807,16 +1808,27 @@ def _add_simulation_cell(self):
f"{self._name}_SimulationCell", CMSO.SimulationCell
)
self.graph.add((self.sample, CMSO.hasSimulationCell, simulation_cell))
+ volume = self.graph.create_node(
+ f"{self._name}_Volume", UNSAFEASMO.Volume, label="SimulationCellVolume"
+ )
+ self.graph.add((simulation_cell, UNSAFECMSO.hasVolume, volume))
self.graph.add(
(
- simulation_cell,
- CMSO.hasVolume,
+ volume,
+ UNSAFEASMO.hasValue,
Literal(
np.round(self.schema.simulation_cell.volume(), decimals=2),
datatype=XSD.float,
),
)
)
+ self.graph.add(
+ (
+ volume,
+ UNSAFEASMO.hasUnit,
+ URIRef(f"http://qudt.org/vocab/unit/ANGSTROM3"),
+ )
+ )
self.graph.add(
(
self.sample,
@@ -2514,7 +2526,7 @@ def rotate(self, rotation_vectors, graph=None, label=None):
def add_rotation_triples(self, rotation_vectors, child_sample_id):
activity_id = f"operation:{uuid.uuid4()}"
- activity = self.graph.create_node(activity_id, UNSAFEASMO.Rotation)
+ activity = self.graph.create_node(activity_id, ASMO.Rotation)
self.graph.add((child_sample_id, PROV.wasGeneratedBy, activity))
self.graph.add((child_sample_id, PROV.wasDerivedFrom, self.sample))
@@ -2596,7 +2608,7 @@ def translate(self, translation_vector,
def add_translation_triples(self, translation_vector, plane, distance, ):
activity_id = f"operation:{uuid.uuid4()}"
- activity = self.graph.create_node(activity_id, UNSAFEASMO.Translation)
+ activity = self.graph.create_node(activity_id, ASMO.Translation)
self.graph.add((self.sample, PROV.wasGeneratedBy, activity))
#now add specifics
@@ -2636,7 +2648,7 @@ def shear(self, shear_vector,
def add_shear_triples(self, translation_vector, plane, distance, ):
activity_id = f"operation:{uuid.uuid4()}"
- activity = self.graph.create_node(activity_id, UNSAFEASMO.Shear)
+ activity = self.graph.create_node(activity_id, ASMO.Shear)
self.graph.add((self.sample, PROV.wasGeneratedBy, activity))
#now add specifics
@@ -2650,13 +2662,13 @@ def add_shear_triples(self, translation_vector, plane, distance, ):
#if plane is provided, add that as well
if plane is not None:
plane = self.graph.create_node(f"{activity_id}_Plane", CMSO.Plane)
- plane_vector = self.graph.create_node(f"{activity_id}_PlaneVector", UNSAFECMSO.NormalVector)
+ plane_vector = self.graph.create_node(f"{activity_id}_PlaneVector", CMSO.NormalVector)
self.graph.add((activity, UNSAFECMSO.hasPlane, plane))
- self.graph.add((plane, UNSAFECMSO.hasNormalVector, plane_vector))
+ self.graph.add((plane, CMSO.hasNormalVector, plane_vector))
self.graph.add((plane_vector, CMSO.hasComponent_x, Literal(plane[0], datatype=XSD.float),))
self.graph.add((plane_vector, CMSO.hasComponent_y, Literal(plane[1], datatype=XSD.float),))
self.graph.add((plane_vector, CMSO.hasComponent_z, Literal(plane[2], datatype=XSD.float),))
- self.graph.add((plane, UNSAFECMSO.hasDistanceFromOrigin, Literal(distance, datatype=XSD.float)))
+ self.graph.add((plane, CMSO.hasDistanceFromOrigin, Literal(distance, datatype=XSD.float)))
def copy_defects(self, parent_sample):
if self.sample is None:
diff --git a/atomrdf/workflow/pyiron/calphy.py b/atomrdf/workflow/pyiron/calphy.py
index 9080750..83a61b5 100644
--- a/atomrdf/workflow/pyiron/calphy.py
+++ b/atomrdf/workflow/pyiron/calphy.py
@@ -71,8 +71,21 @@ def identify_method(job, method_dict):
else:
method_dict["potential"]["uri"] = name
method_dict['method'] = 'ThermodynamicIntegration'
- method_dict["temperature"] = job.input.temperature
- method_dict["pressure"] = job.input.pressure
+ method_dict['inputs'] = []
+ method_dict['inputs'].append(
+ {
+ "label": "Pressure",
+ "value": job.input.pressure,
+ "unit": "BAR",
+ }
+ )
+ method_dict['inputs'].append(
+ {
+ "label": "Temperature",
+ "value": job.input.temperature,
+ "unit": "K",
+ }
+ )
def add_software(method_dict):
method_dict["workflow_manager"] = {}
@@ -124,37 +137,8 @@ def extract_calculated_quantities(job, method_dict):
"value": np.round(job['output/atomic_volume'], decimals=4),
"unit": "ANGSTROM3",
"associate_to_sample": True,
+ "base": "Volume",
}
)
-
- structure = job.get_structure(frame=-1)
- lx = np.linalg.norm(structure.cell[0])
- ly = np.linalg.norm(structure.cell[1])
- lz = np.linalg.norm(structure.cell[2])
-
- outputs.append(
- {
- "label": "SimulationCellLength_x",
- "value": np.round(lx, decimals=4),
- "unit": "ANGSTROM",
- "associate_to_sample": True,
- }
- )
- outputs.append(
- {
- "label": "SimulationCellLength_y",
- "value": np.round(ly, decimals=4),
- "unit": "ANGSTROM",
- "associate_to_sample": True,
- }
- )
- outputs.append(
- {
- "label": "SimulationCellLength_z",
- "value": np.round(lz, decimals=4),
- "unit": "ANGSTROM",
- "associate_to_sample": True,
- }
- )
method_dict['outputs'] = outputs
\ No newline at end of file
diff --git a/atomrdf/workflow/pyiron/lammps.py b/atomrdf/workflow/pyiron/lammps.py
index 2008b2a..1c03caf 100644
--- a/atomrdf/workflow/pyiron/lammps.py
+++ b/atomrdf/workflow/pyiron/lammps.py
@@ -93,8 +93,6 @@ def identify_method(job, method_dict):
ensemble = "IsothermalIsobaricEnsemble"
method_dict["method"] = md_method
- method_dict["temperature"] = temp
- method_dict["pressure"] = press
method_dict["dof"] = dof
method_dict["ensemble"] = ensemble
@@ -116,6 +114,25 @@ def identify_method(job, method_dict):
else:
method_dict["potential"]["uri"] = name
+ #add temperature and pressure as inputs
+ method_dict['inputs'] = []
+ if temp is not None:
+ method_dict['inputs'].append(
+ {
+ "label": "Temperature",
+ "value": temp,
+ "unit": "K",
+ }
+ )
+ if press is not None:
+ method_dict['inputs'].append(
+ {
+ "label": "Pressure",
+ "value": press,
+ "unit": "GigaPA",
+ }
+ )
+
def add_software(method_dict):
method_dict["workflow_manager"] = {}
method_dict["workflow_manager"]["uri"] = "http://demo.fiz-karlsruhe.de/matwerk/E457491"
@@ -143,53 +160,45 @@ def extract_calculated_quantities(job, method_dict):
A list of dictionaries, each containing the label, value, unit, and associate_to_sample of a calculated quantity.
"""
- aen = np.mean(job.output.energy_tot)
- avol = np.mean(job.output.volume)
+ energy_tot = np.mean(job.output.energy_tot)
+ energy_pot = np.mean(job.output.energy_pot)
+ energy_kin = energy_tot - energy_pot
+
+ volume = np.mean(job.output.volume)
+
outputs = []
outputs.append(
{
"label": "TotalEnergy",
- "value": np.round(aen, decimals=4),
+ "value": np.round(energy_tot, decimals=4),
"unit": "EV",
"associate_to_sample": True,
}
)
outputs.append(
{
- "label": "TotalVolume",
- "value": np.round(avol, decimals=4),
- "unit": "ANGSTROM3",
+ "label": "PotentialEnergy",
+ "value": np.round(energy_pot, decimals=4),
+ "unit": "EV",
"associate_to_sample": True,
}
)
-
- structure = job.get_structure(frame=-1)
- lx = np.linalg.norm(structure.cell[0])
- ly = np.linalg.norm(structure.cell[1])
- lz = np.linalg.norm(structure.cell[2])
-
outputs.append(
{
- "label": "SimulationCellLength_x",
- "value": np.round(lx, decimals=4),
- "unit": "ANGSTROM",
+ "label": "KineticEnergy",
+ "value": np.round(energy_kin, decimals=4),
+ "unit": "EV",
"associate_to_sample": True,
}
)
outputs.append(
{
- "label": "SimulationCellLength_y",
- "value": np.round(ly, decimals=4),
- "unit": "ANGSTROM",
+ "label": "SimulationCellVolume",
+ "value": np.round(volume, decimals=4),
+ "unit": "ANGSTROM3",
"associate_to_sample": True,
+ "base": "Volume",
}
)
- outputs.append(
- {
- "label": "SimulationCellLength_z",
- "value": np.round(lz, decimals=4),
- "unit": "ANGSTROM",
- "associate_to_sample": True,
- }
- )
+
method_dict['outputs'] = outputs
\ No newline at end of file
diff --git a/atomrdf/workflow/pyiron/murnaghan.py b/atomrdf/workflow/pyiron/murnaghan.py
index 0bd8a26..9e3ad40 100644
--- a/atomrdf/workflow/pyiron/murnaghan.py
+++ b/atomrdf/workflow/pyiron/murnaghan.py
@@ -30,6 +30,7 @@ def process_job(job):
"value": np.round(job['output/equilibrium_energy'], decimals=4),
"unit": "EV",
"associate_to_sample": True,
+ "base": "TotalEnergy",
}
)
outputs.append(
@@ -38,6 +39,7 @@ def process_job(job):
"value": np.round(job['output/equilibrium_volume'], decimals=4),
"unit": "ANGSTROM3",
"associate_to_sample": True,
+ "base": "Volume",
}
)
outputs.append(
@@ -48,36 +50,6 @@ def process_job(job):
"associate_to_sample": True,
}
)
-
- structure = job.get_structure(frame=-1)
- lx = np.linalg.norm(structure.cell[0])
- ly = np.linalg.norm(structure.cell[1])
- lz = np.linalg.norm(structure.cell[2])
-
- outputs.append(
- {
- "label": "SimulationCellLength_x",
- "value": np.round(lx, decimals=4),
- "unit": "ANGSTROM",
- "associate_to_sample": True,
- }
- )
- outputs.append(
- {
- "label": "SimulationCellLength_y",
- "value": np.round(ly, decimals=4),
- "unit": "ANGSTROM",
- "associate_to_sample": True,
- }
- )
- outputs.append(
- {
- "label": "SimulationCellLength_z",
- "value": np.round(lz, decimals=4),
- "unit": "ANGSTROM",
- "associate_to_sample": True,
- }
- )
murnaghan_dict['outputs'] = outputs
lammps.add_software(murnaghan_dict)
diff --git a/atomrdf/workflow/pyiron/quasiharmonic.py b/atomrdf/workflow/pyiron/quasiharmonic.py
index 05cf43d..71e5d4c 100644
--- a/atomrdf/workflow/pyiron/quasiharmonic.py
+++ b/atomrdf/workflow/pyiron/quasiharmonic.py
@@ -23,6 +23,7 @@ def process_job(job):
"value": np.round(job['output/free_energy'].T, decimals=4),
"unit": "EV",
"associate_to_sample": True,
+ "base": "FreeEnergy",
}
)
outputs.append(
@@ -31,6 +32,7 @@ def process_job(job):
"value": np.round(job['output/volumes'].T, decimals=4),
"unit": "ANGSTROM3",
"associate_to_sample": True,
+ "base": "Volume",
}
)
outputs.append(
@@ -39,6 +41,7 @@ def process_job(job):
"value": np.round(job['output/temperatures'][0], decimals=2),
"unit": "K",
"associate_to_sample": True,
+ "base": "Temperature",
}
)
quasi_dict['outputs'] = outputs
diff --git a/atomrdf/workflow/pyiron/vasp.py b/atomrdf/workflow/pyiron/vasp.py
index 4b795ff..ecda020 100644
--- a/atomrdf/workflow/pyiron/vasp.py
+++ b/atomrdf/workflow/pyiron/vasp.py
@@ -99,18 +99,54 @@ def identify_method(job, method_dict):
method_dict['method'] = method
method_dict['dof'] = dof
- encut = mdict['ENCUT']
- method_dict['encut'] = encut
+ inputs = []
+ encut = mdict['ENCUT']
+ inputs.append(
+ {
+ "label": "EnergyCutoff",
+ "value": encut,
+ "unit": "EV",
+ }
+ )
+
indf = job.input.to_dict()['kpoints/data_dict']
params = indf['Parameter']
vals = indf['Value']
kpoint_type = vals[2]
kpoint_grid = vals[3]
- method_dict['kpoint_type'] = kpoint_type
- method_dict['kpoint_grid'] = kpoint_grid
+ if kpoint_type == 'Monkhorst-pack':
+ inputs.append(
+ {
+ "label": "MonkhorstPackKPointMesh",
+ "value": kpoint_grid,
+ }
+ )
+ elif kpoint_type == 'Gamma':
+ inputs.append(
+ {
+ "label": "GammaCenteredKPointMesh",
+ "value": kpoint_grid,
+ }
+ )
+ elif kpoint_type in ['Reciprocal', 'Cartesian']:
+ inputs.append(
+ {
+ "label": "ExplicitKPointMesh",
+ "value": kpoint_grid,
+ }
+ )
+ else:
+ inputs.append(
+ {
+ "label": "KPointMesh",
+ "value": kpoint_grid,
+ }
+ )
+ method_dict['inputs'] = inputs
+
indf = job.input.to_dict()['potcar/data_dict']
xc = indf['Value'][0]
method_dict['xc_functional'] = xc
@@ -153,39 +189,19 @@ def extract_calculated_quantities(job, method_dict):
)
outputs.append(
{
- "label": "TotalVolume",
- "value": np.round(job.output.volume[-1], decimals=5),
- "unit": "ANGSTROM3",
- "associate_to_sample": True,
- }
- )
- structure = job.get_structure(frame=-1)
- lx = np.linalg.norm(structure.cell[0])
- ly = np.linalg.norm(structure.cell[1])
- lz = np.linalg.norm(structure.cell[2])
-
- outputs.append(
- {
- "label": "SimulationCellLength_x",
- "value": np.round(lx, decimals=4),
- "unit": "ANGSTROM",
+ "label": "PotentialEnergy",
+ "value": np.round(job.output.energy_pot[-1], decimals=5),
+ "unit": "EV",
"associate_to_sample": True,
}
)
outputs.append(
{
- "label": "SimulationCellLength_y",
- "value": np.round(ly, decimals=4),
- "unit": "ANGSTROM",
+ "label": "Volume",
+ "value": np.round(job.output.volume[-1], decimals=5),
+ "unit": "ANGSTROM3",
"associate_to_sample": True,
}
)
- outputs.append(
- {
- "label": "SimulationCellLength_z",
- "value": np.round(lz, decimals=4),
- "unit": "ANGSTROM",
- "associate_to_sample": True,
- }
- )
+
method_dict['outputs'] = outputs
\ No newline at end of file
diff --git a/atomrdf/workflow/qe/qe.py b/atomrdf/workflow/qe/qe.py
index d90b316..599c223 100644
--- a/atomrdf/workflow/qe/qe.py
+++ b/atomrdf/workflow/qe/qe.py
@@ -91,13 +91,39 @@ def identify_method(job, method_dict):
encut = data['system']['ecutwfc']
#convert to eV
- method_dict['encut'] = encut*13.6057039763
+ inputs = []
+ inputs.append(
+ {
+ "label": "EnergyCutoff",
+ "value": encut*13.6057039763,
+ "unit": "EV",
+ }
+ )
#get kpoints
if tab['K_POINTS']['extra'] == 'automatic':
- method_dict['kpoint_type'] = 'Monkhorst-Pack'
- method_dict['kpoint_grid'] = " ".join(tab['K_POINTS']['value'][0].split()[:3])
-
+ inputs.append(
+ {
+ "label": "MonkhorstPackKPointMesh",
+ "value": " ".join(tab['K_POINTS']['value'][0].split()[:3]),
+ }
+ )
+ elif tab['K_POINTS']['extra'] == 'gamma':
+ inputs.append(
+ {
+ "label": "GammaCenteredKPointMesh",
+ "value": " ",
+ }
+ )
+ else:
+ inputs.append(
+ {
+ "label": "ExplicitKPointMesh",
+ "value": " ",
+ }
+ )
+ method_dict['inputs'] = inputs
+
#get pseudopotentials
pseudo = None
with open(outfile, 'r') as fin:
@@ -132,39 +158,9 @@ def extract_calculated_quantities(job, method_dict):
)
outputs.append(
{
- "label": "TotalVolume",
+ "label": "Volume",
"value": np.round(struct.get_volume(), decimals=5),
"unit": "ANGSTROM3",
"associate_to_sample": True,
}
- )
-
- lx = np.linalg.norm(struct.cell[0])
- ly = np.linalg.norm(struct.cell[1])
- lz = np.linalg.norm(struct.cell[2])
-
- outputs.append(
- {
- "label": "SimulationCellLength_x",
- "value": np.round(lx, decimals=4),
- "unit": "ANGSTROM",
- "associate_to_sample": True,
- }
- )
- outputs.append(
- {
- "label": "SimulationCellLength_y",
- "value": np.round(ly, decimals=4),
- "unit": "ANGSTROM",
- "associate_to_sample": True,
- }
- )
- outputs.append(
- {
- "label": "SimulationCellLength_z",
- "value": np.round(lz, decimals=4),
- "unit": "ANGSTROM",
- "associate_to_sample": True,
- }
- )
- method_dict['outputs'] = outputs
+ )
diff --git a/atomrdf/workflow/workflow.py b/atomrdf/workflow/workflow.py
index 3ff7c92..1c2a9e5 100644
--- a/atomrdf/workflow/workflow.py
+++ b/atomrdf/workflow/workflow.py
@@ -28,7 +28,7 @@
from atomrdf.structure import System
# Move imports to another file
-from atomrdf.namespace import PROV, CMSO, PODO, ASMO, MDO, Literal
+from atomrdf.namespace import PROV, CMSO, PODO, ASMO, MDO, Literal, UNSAFECMSO, UNSAFEASMO
class Workflow:
def __init__(self, kg):
@@ -269,15 +269,15 @@ def _add_method(
elif job_dict["method"] == "EquationOfState":
#special type of EOS should be initialised!
- self.kg.add((activity, RDF.type, Namespace("http://purls.helmholtz-metadaten.de/asmo/").EquationOfStateFit))
+ self.kg.add((activity, RDF.type, ASMO.EquationOfStateFit))
elif job_dict["method"] == "QuasiHarmonicModel":
- self.kg.add((activity, RDF.type, Namespace("http://purls.helmholtz-metadaten.de/asmo/").QuasiHarmonicModel))
+ self.kg.add((activity, RDF.type, ASMO.QuasiHarmonicModel))
elif job_dict["method"] == "ThermodynamicIntegration":
self._add_dof(job_dict, activity)
self._add_md(job_dict, activity)
- self.kg.add((activity, RDF.type, Namespace("http://purls.helmholtz-metadaten.de/asmo/").ThermodynamicIntegration))
+ self.kg.add((activity, RDF.type, ASMO.ThermodynamicIntegration))
# add that structure was generated
self.kg.add((activity, ASMO.hasComputationalMethod, method))
@@ -291,48 +291,115 @@ def _add_method(
def _add_dof(self, job_dict, activity):
for dof in job_dict["dof"]:
self.kg.add((activity, ASMO.hasRelaxationDOF, getattr(ASMO, dof)))
+
+ def _select_base_property(self, out, main_id, default_class):
+ if "base" in out.keys():
+ base = out["base"]
+ else:
+ base = out["label"]
+
+ if base == 'TotalEnergy':
+ prop = self.kg.create_node(
+ f'{main_id}_{out["label"]}', UNSAFEASMO.TotalEnergy,
+ label=out["label"],
+ )
+ elif base == 'PotentialEnergy':
+ prop = self.kg.create_node(
+ f'{main_id}_{out["label"]}', UNSAFEASMO.PotentialEnergy,
+ label=out["label"],
+ )
+ elif base == 'KineticEnergy':
+ prop = self.kg.create_node(
+ f'{main_id}_{out["label"]}', UNSAFEASMO.KineticEnergy,
+ label=out["label"],
+ )
+ elif base == 'Volume':
+ prop = self.kg.create_node(
+ f'{main_id}_{out["label"]}', UNSAFEASMO.Volume,
+ label=out["label"],
+ )
+ elif base == 'Pressure':
+ prop = self.kg.create_node(
+ f'{main_id}_{out["label"]}', UNSAFEASMO.Pressure,
+ label=out["label"],
+ )
+ elif base == 'Temperature':
+ prop = self.kg.create_node(
+ f'{main_id}_{out["label"]}', UNSAFEASMO.Temperature,
+ label=out["label"],
+ )
+ elif base == 'BulkModulus':
+ prop = self.kg.create_node(
+ f'{main_id}_{out["label"]}', UNSAFEASMO.BulkModulus,
+ label=out["label"],
+ )
+ elif base == 'FreeEnergy':
+ prop = self.kg.create_node(
+ f'{main_id}_{out["label"]}', UNSAFEASMO.FreeEnergy,
+ label=out["label"],
+ )
+ elif base == 'EnergyCutoff':
+ prop = self.kg.create_node(
+ f'{main_id}_{out["label"]}', UNSAFEASMO.EnergyCutoff,
+ label=out["label"],
+ )
+ elif base == 'ExplicitKPointMesh':
+ prop = self.kg.create_node(
+ f'{main_id}_{out["label"]}', UNSAFEASMO.ExplicitKPointMesh,
+ label=out["label"],
+ )
+ elif base == 'GammaCenteredKPointMesh':
+ prop = self.kg.create_node(
+ f'{main_id}_{out["label"]}', UNSAFEASMO.GammaCenteredKPointMesh,
+ label=out["label"],
+ )
+ elif base == 'MonkhorstPackKPointMesh':
+ prop = self.kg.create_node(
+ f'{main_id}_{out["label"]}', UNSAFEASMO.MonkhorstPackKPointMesh,
+ label=out["label"],
+ )
+ elif base == 'KPointMesh':
+ prop = self.kg.create_node(
+ f'{main_id}_{out["label"]}', UNSAFEASMO.KPointMesh,
+ label=out["label"],
+ )
+ else:
+ prop = self.kg.create_node(
+ f'{main_id}_{out["label"]}', default_class,
+ label=out["label"],
+ )
+
+ self.kg.add((prop, UNSAFEASMO.hasValue, Literal(out["value"])))
+ if "unit" in out.keys():
+ unit = out["unit"]
+ self.kg.add(
+ (
+ prop,
+ UNSAFEASMO.hasUnit,
+ URIRef(f"http://qudt.org/vocab/unit/{unit}"),
+ )
+ )
+ return prop
+
def _add_inputs(self, job_dict, activity):
main_id = job_dict['id']
if "inputs" in job_dict.keys():
for inp in job_dict["inputs"]:
- prop = self.kg.create_node(
- f'{main_id}_{inp["label"]}', ASMO.InputParameter
- )
- self.kg.add((prop, RDFS.label, Literal(inp["label"])))
- self.kg.add((prop, ASMO.hasValue, Literal(inp["value"])))
- if "unit" in inp.keys():
- unit = inp["unit"]
- self.kg.add(
- (
- prop,
- ASMO.hasUnit,
- URIRef(f"http://qudt.org/vocab/unit/{unit}"),
- )
- )
- self.kg.add((activity, ASMO.hasInputParameter, prop))
+ prop = self._select_base_property(inp, main_id, ASMO.InputParameter)
+ self.kg.add((activity, UNSAFEASMO.hasInputParameter, prop))
def _add_outputs(self, job_dict, activity):
main_id = job_dict['id']
if "outputs" in job_dict.keys():
for out in job_dict["outputs"]:
- prop = self.kg.create_node(
- f'{main_id}_{out["label"]}', CMSO.CalculatedProperty
- )
- self.kg.add((prop, RDFS.label, Literal(out["label"])))
- self.kg.add((prop, ASMO.hasValue, Literal(out["value"])))
- if "unit" in out.keys():
- unit = out["unit"]
- self.kg.add(
- (
- prop,
- ASMO.hasUnit,
- URIRef(f"http://qudt.org/vocab/unit/{unit}"),
- )
- )
- self.kg.add((prop, ASMO.wasCalculatedBy, activity))
+ #here we add the classes by property
+ #call func here
+ prop = self._select_base_property(out, main_id, CMSO.CalculatedProperty)
+ self.kg.add((prop, UNSAFEASMO.wasCalculatedBy, activity))
+
if out["associate_to_sample"]:
- self.kg.add((job_dict['sample']['final'], CMSO.hasCalculatedProperty, prop))
+ self.kg.add((job_dict['sample']['final'], UNSAFECMSO.hasCalculatedProperty, prop))
def _add_software(self, job_dict, method):
# finally add software
@@ -357,44 +424,6 @@ def _add_software(self, job_dict, method):
def _add_dft(self, job_dict, method, activity):
main_id = job_dict['id']
-
- # add temperature if needed
- if job_dict["encut"] is not None:
- encut = self.kg.create_node(
- f"{main_id}_energy_cutoff", ASMO.InputParameter
- )
- self.kg.add(
- (encut, RDFS.label, Literal("energy_cutoff", datatype=XSD.string))
- )
- self.kg.add((activity, ASMO.hasInputParameter, encut))
- self.kg.add(
- (
- encut,
- ASMO.hasValue,
- Literal(float(job_dict["encut"]), datatype=XSD.float),
- )
- )
- self.kg.add(
- (encut, ASMO.hasUnit, URIRef("http://qudt.org/vocab/unit/EV"))
- )
-
- if job_dict["kpoint_grid"] is not None:
- kpoint = self.kg.create_node(
- f"{main_id}_kpoint", ASMO.InputParameter
- )
- mesh_name = "K_point_"+job_dict["kpoint_type"]
- self.kg.add(
- (kpoint, RDFS.label, Literal(mesh_name, datatype=XSD.string))
- )
- self.kg.add((activity, ASMO.hasInputParameter, kpoint))
- self.kg.add(
- (
- kpoint,
- ASMO.hasValue,
- Literal(job_dict["kpoint_grid"], datatype=XSD.string),
- )
- )
-
if job_dict["xc_functional"] is not None:
if job_dict["xc_functional"] in ['PBE', 'GGA']:
self.kg.add((method, MDO.hasXCFunctional, MDO.GGA))
@@ -409,45 +438,6 @@ def _add_md(self, job_dict, activity):
(activity, ASMO.hasStatisticalEnsemble, getattr(ASMO, job_dict["ensemble"]))
)
- # add temperature if needed
- if job_dict["temperature"] is not None:
- temperature = self.kg.create_node(
- f"{main_id}_temperature", ASMO.InputParameter
- )
- self.kg.add(
- (temperature, RDFS.label, Literal("temperature", datatype=XSD.string))
- )
- self.kg.add((activity, ASMO.hasInputParameter, temperature))
- self.kg.add(
- (
- temperature,
- ASMO.hasValue,
- Literal(job_dict["temperature"], datatype=XSD.float),
- )
- )
- self.kg.add(
- (temperature, ASMO.hasUnit, URIRef("http://qudt.org/vocab/unit/K"))
- )
-
- if job_dict["pressure"] is not None:
- pressure = self.kg.create_node(
- f"{main_id}_pressure", ASMO.InputParameter
- )
- self.kg.add(
- (pressure, RDFS.label, Literal("pressure", datatype=XSD.string))
- )
- self.kg.add((activity, ASMO.hasInputParameter, pressure))
- self.kg.add(
- (
- pressure,
- ASMO.hasValue,
- Literal(job_dict["pressure"], datatype=XSD.float),
- )
- )
- self.kg.add(
- (pressure, ASMO.hasUnit, URIRef("http://qudt.org/vocab/unit/GigaPA"))
- )
-
# potentials need to be mapped
potential = URIRef(f"{main_id}_potential")
if "meam" in job_dict["potential"]["type"]:
diff --git a/environment-workflows.yml b/environment-workflows.yml
index e7a8cf4..c84d6e0 100644
--- a/environment-workflows.yml
+++ b/environment-workflows.yml
@@ -1,4 +1,4 @@
-name: workflow-rdf-v0.2
+name: workflow-rdf
channels:
- conda-forge
dependencies:
diff --git a/examples/01_getting_started.ipynb b/examples/01_getting_started.ipynb
index 6b9fee7..7f82f55 100644
--- a/examples/01_getting_started.ipynb
+++ b/examples/01_getting_started.ipynb
@@ -100,7 +100,7 @@
},
{
"cell_type": "code",
- "execution_count": 21,
+ "execution_count": 4,
"id": "79772707-5981-4ae5-8131-a7ef8455858c",
"metadata": {
"tags": []
@@ -112,2268 +112,884 @@
"\n",
"\n",
- "\n",
"\n",
- "