FAIRmat-NFDI / nomad-perovskite-solar-cells-database

A NOMAD plugin containing the schema for the Perovskite Solar Cell Database.
Apache License 2.0
2 stars 0 forks source link

Extended information about ions #4

Closed Pepe-Marquez closed 5 months ago

Pepe-Marquez commented 7 months ago

We want to extend the information about the ions used in the absorber layer in the perovskite database entries with the information that @Jesperkemist. These are my current thoughts.

def normalize(self, archive, logger: None) -> None:
            super().normalize(archive, logger)
            from rdkit import Chem
            from rdkit.Chem import AllChem
            from nomad.normalizing.common import nomad_atoms_from_ase_atoms
            from nomad.normalizing.topology import add_system, add_system_info
            from nomad.atomutils import Formula

            from ase.io import read
            if self.smile:
                # generate the 3D structure from the SMILE
                ase_atoms = optimize_molecule(self.smile)
                atoms = nomad_atoms_from_ase_atoms(ase_atoms)
                # let's plug this into the results section in the archive
                if not archive.results.material:
                    archive.results.material = Material()
                system = System(atoms=atoms, system_id='results/material/topology/0', label='original') # populate additional quantities here
                add_system_info(system, None)
                archive.results.material.topology = [system]
                # Let's also add the formula information and augment it with the Formula class
                if ase_atoms is not None:
                    formula = Formula(ase_atoms.get_chemical_formula())
                    formula.populate(archive.results.material.topology)

Should populate results.material.topology with the created system as a flat list: first cation --> results.material.topology.0 second_cation --> results.material.topology.1