|
|
**INFO**
|
|
|
|
|
|
For the **Springer Materials** classification you have to run `classify4m_SM` code and as an argument you give the formula of your interest. It classifies your material on basis of our most recent **Springer Materials** database. The output of the code before normalization was given as follows:
|
|
|
For the **Springer Materials classification** one shall run `classify4m_SM` code and give as an argument formula of the interest.
|
|
|
The program classifies your material on basis of our most recent **Springer Materials** database. The output of the code for examplar compound (before the normalization) is presented below:
|
|
|
|
|
|
command:
|
|
|
|
|
|
`python classify4me_SM_fun.py MgNd`
|
... | ... | @@ -9,7 +11,7 @@ command: |
|
|
[example_SM_classification__MgNd.pdf](/uploads/c5b4f21c162eeb396e06993af0faf427/example_SM_classification__MgNd.pdf)
|
|
|
|
|
|
|
|
|
Now after normalization you will get:
|
|
|
Now after the normalization the result is presented here:
|
|
|
|
|
|
`python classify4me_SM_normalizer.py MgNd`
|
|
|
|
... | ... | @@ -17,53 +19,131 @@ Now after normalization you will get: |
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------------------
|
|
|
For the normalization reasons the backend part given bellow was added in the code:
|
|
|
|
|
|
|
|
|
|
|
|
### NORMALIZATION ###
|
|
|
#For the normalization json.dump was replaced with the loop below
|
|
|
#json.dump({"section_springer_material":list(res.values())}, sys.stdout, indent=2, sort_keys=True, ensure_ascii=False)
|
|
|
for mat in res.values():
|
|
|
matS=backend.openSection("section_springer_material")
|
|
|
for cl in mat.get("section_springer_classification",[]):
|
|
|
clS = backend.openSection("section_springer_classification")
|
|
|
if "springer_classification" in cl:
|
|
|
backend.addValue("springer_classification",cl["springer_classification"])
|
|
|
if "springer_number_of_classification_reference_per_material" in cl:
|
|
|
backend.addValue("springer_number_of_classification_reference_per_material",cl["springer_number_of_classification_reference_per_material"])
|
|
|
backend.closeSection("section_springer_classification",clS)
|
|
|
for cl in mat.get("section_springer_compound_class",[]):
|
|
|
clS = backend.openSection("section_springer_compound_class")
|
|
|
if "springer_compound_class" in cl:
|
|
|
backend.addValue("springer_compound_class",cl["springer_compound_class"])
|
|
|
if "springer_number_of_compound_class_reference_per_material" in cl:
|
|
|
backend.addValue("springer_number_of_compound_class_reference_per_material",cl["springer_number_of_compound_class_reference_per_material"])
|
|
|
backend.closeSection("section_springer_compound_class",clS)
|
|
|
for cl in mat.get("section_springer_id",[]):
|
|
|
clS = backend.openSection("section_springer_id")
|
|
|
if "springer_id" in cl:
|
|
|
backend.addValue("springer_id",cl["springer_id"])
|
|
|
if "springer_url" in cl:
|
|
|
backend.addValue("springer_url",cl["springer_url"])
|
|
|
backend.closeSection("section_springer_id",clS)
|
|
|
for ref in cl.get("section_springer_references",[]):
|
|
|
refS = backend.openSection("section_springer_references")
|
|
|
if "springer_reference" in ref:
|
|
|
backend.addValue("springer_reference",ref["springer_reference"])
|
|
|
backend.closeSection("section_springer_references",refS)
|
|
|
if "springer_formula" in mat:
|
|
|
backend.addValue("springer_formula",mat["springer_formula"])
|
|
|
|
|
|
if "springer_space_group_number" in mat:
|
|
|
backend.addValue("springer_space_group_number",mat["springer_space_group_number"])
|
|
|
|
|
|
|
|
|
backend.closeSection("section_springer_material",matS)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
For the normalization reasons the backend part given bellow was added in the code together with scala parts listed on the bottom of the page:
|
|
|
|
|
|
> #For the normalization json.dump was replaced with the loop below
|
|
|
> ```
|
|
|
> #json.dump({"section_springer_material":list(res.values())}, sys.stdout, indent=2, sort_keys=True, ensure_ascii=False)
|
|
|
> for mat in res.values():
|
|
|
> matS=backend.openSection("section_springer_material")
|
|
|
> for cl in mat.get("section_springer_classification",[]):
|
|
|
> clS = backend.openSection("section_springer_classification")
|
|
|
> if "springer_classification" in cl:
|
|
|
> backend.addValue("springer_classification",cl["springer_classification"])
|
|
|
> if "springer_number_of_classification_reference_per_material" in cl:
|
|
|
> backend.addValue("springer_number_of_classification_reference_per_material",cl["springer_number_of_classification_reference_per_material"])
|
|
|
> backend.closeSection("section_springer_classification",clS)
|
|
|
> for cl in mat.get("section_springer_compound_class",[]):
|
|
|
> clS = backend.openSection("section_springer_compound_class")
|
|
|
> if "springer_compound_class" in cl:
|
|
|
> backend.addValue("springer_compound_class",cl["springer_compound_class"])
|
|
|
> if "springer_number_of_compound_class_reference_per_material" in cl:
|
|
|
> backend.addValue("springer_number_of_compound_class_reference_per_material",cl["springer_number_of_compound_class_reference_per_material"])
|
|
|
> backend.closeSection("section_springer_compound_class",clS)
|
|
|
> for cl in mat.get("section_springer_id",[]):
|
|
|
> clS = backend.openSection("section_springer_id")
|
|
|
> if "springer_id" in cl:
|
|
|
> backend.addValue("springer_id",cl["springer_id"])
|
|
|
> if "springer_url" in cl:
|
|
|
> backend.addValue("springer_url",cl["springer_url"])
|
|
|
> backend.closeSection("section_springer_id",clS)
|
|
|
> for ref in cl.get("section_springer_references",[]):
|
|
|
> refS = backend.openSection("section_springer_references")
|
|
|
> if "springer_reference" in ref:
|
|
|
> backend.addValue("springer_reference",ref["springer_reference"])
|
|
|
> backend.closeSection("section_springer_references",refS)
|
|
|
> if "springer_formula" in mat:
|
|
|
> backend.addValue("springer_formula",mat["springer_formula"])
|
|
|
>
|
|
|
> if "springer_space_group_number" in mat:
|
|
|
> backend.addValue("springer_space_group_number",mat["springer_space_group_number"])
|
|
|
>
|
|
|
>
|
|
|
> backend.closeSection("section_springer_material",matS)
|
|
|
> ```
|
|
|
|
|
|
|
|
|
**SCALA PART**
|
|
|
|
|
|
|
|
|
Added file `SpringerNormalizer.scala`
|
|
|
in:
|
|
|
`normalizer-springer/src/main/scala/eu/nomad_lab/normalizers`
|
|
|
|
|
|
contents:
|
|
|
|
|
|
|
|
|
> ```
|
|
|
> package eu.nomad_lab.normalizers
|
|
|
> import eu.{ nomad_lab => lab }
|
|
|
> import eu.nomad_lab.DefaultPythonInterpreter
|
|
|
> import org.{ json4s => jn }
|
|
|
> import scala.collection.breakOut
|
|
|
> import eu.nomad_lab.normalize.ExternalNormalizerGenerator
|
|
|
> import eu.nomad_lab.meta
|
|
|
> import eu.nomad_lab.query
|
|
|
> object SpringerNormalizer extends ExternalNormalizerGenerator(
|
|
|
> name = "SpringerNormalizer",
|
|
|
> info = jn.JObject(
|
|
|
> ("name" -> jn.JString("SpringerNormalizer")) ::
|
|
|
> ("normalizerId" -> jn.JString("SpringerNormalizer" + lab.SpringerVersionInfo.version)) ::
|
|
|
> ("versionInfo" -> jn.JObject(
|
|
|
> ("nomadCoreVersion" -> jn.JObject(lab.NomadCoreVersionInfo.toMap.map {
|
|
|
> case (k, v) => k -> jn.JString(v.toString)
|
|
|
> }(breakOut): List[(String, jn.JString)])) ::
|
|
|
> (lab.SpringerVersionInfo.toMap.map {
|
|
|
> case (key, value) =>
|
|
|
> (key -> jn.JString(value.toString))
|
|
|
> }(breakOut): List[(String, jn.JString)])
|
|
|
> )) :: Nil
|
|
|
> ),
|
|
|
> context = "calcuation_context",
|
|
|
> filter = query.CompiledQuery(query.QueryExpression("program_name = \"FHI-aims\""), meta.KnownMetaInfoEnvs.publicMeta),
|
|
|
> cmd = Seq(DefaultPythonInterpreter.pythonExe(), "${envDir}/normalizers/fhi-aims-basis/normalizer/normalizer-fhi-aims-basis/base_comparison.py",
|
|
|
> "${contextUri}", "${archivePath}"),
|
|
|
> resList = Seq(
|
|
|
> "normalizer-springer/classify4me_SM_normalizer.py",
|
|
|
> "normalizer-springer/SM_all08.db",
|
|
|
> "nomad_meta_info/public.nomadmetainfo.json",
|
|
|
> "nomad_meta_info/common.nomadmetainfo.json",
|
|
|
> "nomad_meta_info/meta_types.nomadmetainfo.json",
|
|
|
> "nomad_meta_info/stats.nomadmetainfo.json"
|
|
|
> ) ++ DefaultPythonInterpreter.commonFiles(),
|
|
|
> dirMap = Map(
|
|
|
> "normalizer-springer" -> "normalizers/springer/normalizer/normalizer-springer",
|
|
|
> "nomad_meta_info" -> "nomad-meta-info/meta_info/nomad_meta_info",
|
|
|
> "python" -> "python-common/common/python/nomadcore"
|
|
|
> ) ++ DefaultPythonInterpreter.commonDirMapping(),
|
|
|
> metaInfoEnv = lab.meta.KnownMetaInfoEnvs.common
|
|
|
> )
|
|
|
> ```
|
|
|
|
|
|
|
|
|
and scala binding file in
|
|
|
`normalizer-springer/src/test/scala/eu/nomad_lab/normalizers`
|
|
|
|
|
|
contents:
|
|
|
|
|
|
>
|
|
|
> ```
|
|
|
> package eu.nomad_lab.normalizers
|
|
|
> import eu.nomad_lab.{ parsers, DefaultPythonInterpreter }
|
|
|
> import org.scalacheck.Properties
|
|
|
> import org.specs2.mutable.Specification
|
|
|
> import org.{ json4s => jn }
|
|
|
> object SpringerNormalizerSpec extends Specification {
|
|
|
> }
|
|
|
```
|
|
|
|
|
|
|
|
|
Also was added **SpringerNormalizer ** in
|
|
|
|
|
|
`normalize/src/main/scala/eu/nomad_lab/normalize/AllNormalizers.scala`
|
|
|
|
|
|
|
|
|
|