Skip to content

Commit

Permalink
New ModelSystem schema
Browse files Browse the repository at this point in the history
  • Loading branch information
JosePizarro3 committed Dec 18, 2023
1 parent 9452d25 commit 09b9430
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions electronicparsers/wannier90/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
# New schema
from nomad.datamodel.metainfo.basesections import Program as BaseProgram
from nomad.datamodel.metainfo.computation import Computation
from nomad.datamodel.metainfo.computation.system import ModelSystem, Atoms as Atoms2, SystemGroups
from nomad.datamodel.metainfo.computation.system import ModelSystem, AtomicCell


re_n = r'[\n\r]'
Expand Down Expand Up @@ -220,7 +220,7 @@ def parse_system(self, sec_computation):
return

sec_atoms = sec_system.m_create(Atoms)
sec_atoms2 = sec_system2.m_create(Atoms2)
sec_atoms2 = sec_system2.m_create(AtomicCell)
if self.wout_parser.get('lattice_vectors', []):
lattice_vectors = np.vstack(self.wout_parser.get('lattice_vectors', [])[-3:])
sec_atoms.lattice_vectors = lattice_vectors * ureg.angstrom
Expand Down Expand Up @@ -352,8 +352,8 @@ def fract_cart_sites(sec_atoms, units, val):
def parse_winput2(self, sec_computation):
sec_run = sec_computation
try:
sec_system = sec_run.system[-1]
sec_atoms = sec_system.atoms[0]
sec_system = sec_run.model_system[-1]
sec_atoms = sec_system.atomic_cell[0]
except Exception:
self.logger.warning('Could not extract system.atoms and method sections for parsing win.')
return
Expand Down Expand Up @@ -388,10 +388,10 @@ def fract_cart_sites(sec_atoms, units, val):

# Populating AtomsGroup for projected atoms
for nat in range(len(projections)):
sec_atoms_group = sec_system.m_create(SystemGroups)
sec_atoms_group.type = 'projected_atom'
sec_atoms_group = sec_system.m_create(ModelSystem)
sec_atoms_group.type = 'active_atom'
# sec_atoms_group.index = 0 # Always first index (projection on a projection does not exist)
sec_atoms_group.is_molecule = False
# sec_atoms_group.is_molecule = False

# atom label always index=0
try:
Expand All @@ -405,10 +405,10 @@ def fract_cart_sites(sec_atoms, units, val):
sites = fract_cart_sites(sec_atoms, x_wannier90_units, val)
else: # atom label directly specified
sites = atom
sec_atoms_group.n_entities = len(sites) # always 1 (only one atom per proj)
sec_atoms_group.label = sites
sec_atoms_group.entity_indices = np.where([
x == sec_atoms_group.label for x in sec_atoms.labels])[0]
# sec_atoms_group.n_entities = len(sites) # always 1 (only one atom per proj)
sec_atoms_group.tree_label = sites
sec_atoms_group.atom_indices = np.where([
x == sec_atoms_group.tree_label for x in sec_atoms.labels])[0]
except Exception:
self.logger.warning('Error finding the atom labels for the projection from win.')

Expand Down

0 comments on commit 09b9430

Please sign in to comment.