Skip to content
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
d8f0e7b
nexus: first fix
jtkrogel Aug 27, 2026
9c87ea4
nexus: harden pwscf analyzer
jtkrogel Aug 28, 2026
14284b3
nexus: bind to results data member
jtkrogel Aug 28, 2026
9858d1b
nexus: convert to staticmethods
jtkrogel Aug 28, 2026
c358b49
nexus: restructure
jtkrogel Aug 28, 2026
bdd5990
nexus: consolidate logic and update usage
jtkrogel Aug 28, 2026
96d2383
nexus: style updates
jtkrogel Aug 28, 2026
b96a471
nexus: refactor 1
jtkrogel Aug 28, 2026
8eacde9
nexus: compaction, formatting, docstrings
jtkrogel Aug 28, 2026
5cfa44d
nexus: more style
jtkrogel Aug 28, 2026
97e691f
Merge remote-tracking branch 'main/develop' into nx_pwscf_analyzer_dev
jtkrogel Aug 28, 2026
698ae90
nexus: further extend pwscf analyzer
jtkrogel Aug 31, 2026
0a334a9
nexus: more quants and docs
jtkrogel Sep 1, 2026
83f56ea
nexus: expand xml data extraction
jtkrogel Sep 1, 2026
32bc2a1
nexus: extend propery queries
jtkrogel Sep 1, 2026
9da08a5
nexus: normalize docstrings
jtkrogel Sep 1, 2026
7f8c050
nexus: more docstring
jtkrogel Sep 1, 2026
6ee0380
nexus: add input/output tests
jtkrogel Sep 1, 2026
6da7f02
Merge remote-tracking branch 'main/develop' into nx_pwscf_analyzer_dev2
jtkrogel Sep 1, 2026
6dc0db6
nexus: pass over unused
jtkrogel Sep 1, 2026
99e6b96
nexus: style
jtkrogel Sep 1, 2026
0adbaf7
nexus: ruff
jtkrogel Sep 1, 2026
9cb8d74
nexus: small updates
jtkrogel Sep 1, 2026
a5276c7
nexus: cutback 1
jtkrogel Sep 1, 2026
c6e883a
nexus: cutback 2 and compatibility
jtkrogel Sep 1, 2026
4486a65
nexus: formatting
jtkrogel Sep 1, 2026
0a9b9f4
nexus: format
jtkrogel Sep 2, 2026
5246c5b
nexus: format
jtkrogel Sep 2, 2026
c71ba9c
nexus: reduce regex
jtkrogel Sep 2, 2026
b02ed3f
nexus: merge line iterations
jtkrogel Sep 2, 2026
b60b88f
nexus: shorten
jtkrogel Sep 2, 2026
240d2a5
Merge remote-tracking branch 'main/develop' into nx_pwscf_analyzer_dev2
jtkrogel Sep 2, 2026
fa85333
nexus: address review comments
jtkrogel Sep 2, 2026
cf61bde
Merge remote-tracking branch 'main/develop' into nx_pwscf_analyzer_dev2
jtkrogel Sep 2, 2026
3efe243
Merge branch 'develop' into nx_pwscf_analyzer_dev2
prckent Sep 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions docs/lab_excited.rst
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ following lines to get the exact location of VBM and CBM using
.. code-block:: python

p = band.load_analyzer_image()
print("VBM:\n{0}".format(p.bands.vbm))
print("CBM:\n{0}".format(p.bands.cbm))
print("VBM:\n{0}".format(p.results_out.bands.vbm))
print("CBM:\n{0}".format(p.results_out.bands.cbm))

Output must be the following:

Expand Down Expand Up @@ -303,8 +303,8 @@ lines to get the exact location of VBM and CBM using
.. code-block:: python

p = band.load_analyzer_image()
print("VBM:\n{0}".format(p.bands.vbm))
print("CBM:\n{0}".format(p.bands.cbm))
print("VBM:\n{0}".format(p.results_out.bands.vbm))
print("CBM:\n{0}".format(p.results_out.bands.cbm))

Output must be the following:

Expand Down Expand Up @@ -384,14 +384,14 @@ eigenvalues using their index numbers:

.. code-block:: python

>>> print p.bands.up[51] ## CBM, $\Delta$ ##
>>> print p.results_out.bands.up[51] ## CBM, $\Delta$ ##
eigs = [-3.2076 4.9221 7.5433 7.5433 17.1545 19.7598 28.3242 28.3242]
index = 51
kpoint_2pi_alat = [0. 0.1095605 0. ]
kpoint_rel = [0.3695652 0. 0.3695652]
occs = [1. 1. 1. 1. 0. 0. 0. 0.]
pol = up
>>> print p.bands.up[46] ## $\Delta'$ ##
>>> print p.results_out.bands.up[46] ## $\Delta'$ ##
eigs = [-4.0953 6.1376 7.9247 7.9247 17.1972 20.6393 27.3653 27.3653]
index = 46
kpoint_2pi_alat = [0. 0.0988193 0. ]
Expand Down Expand Up @@ -458,11 +458,11 @@ Alternatively, we can also read the band and twist indexes using PwscfAnalyzer a

p = nscf.load_analyzer_image()
print('band information')
print(p.bands.up)
print('twist 0 k-point:',p.bands.up[0].kpoint_rel)
print('twist 4 k-point:',p.bands.up[4].kpoint_rel)
print('twist 0 band 3 eigenvalue:',p.bands.up[0].eigs[3])
print('twist 4 band 4 eigenvalue:',p.bands.up[4].eigs[4])
print(p.results_out.bands.up)
print('twist 0 k-point:',p.results_out.bands.up[0].kpoint_rel)
print('twist 4 k-point:',p.results_out.bands.up[4].kpoint_rel)
print('twist 0 band 3 eigenvalue:',p.results_out.bands.up[0].eigs[3])
print('twist 4 band 4 eigenvalue:',p.results_out.bands.up[4].eigs[4])

Giving output:

Expand Down
8 changes: 4 additions & 4 deletions labs/lab5_excited_states/band.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@

p = band.load_analyzer_image()
p.plot_bandstructure()
print("VBM:\n{0}".format(p.bands.vbm))
print("CBM:\n{0}".format(p.bands.cbm))
print("VBM:\n{0}".format(p.results_out.bands.vbm))
print("CBM:\n{0}".format(p.results_out.bands.cbm))

#print("CBM, Delta")
#print(p.bands.up[51])
#print(p.results_out.bands.up[51])
#print("Delta prime")
#print(p.bands.up[46])
#print(p.results_out.bands.up[46])
10 changes: 5 additions & 5 deletions labs/lab5_excited_states/optical.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@
try:
p = nscf.load_analyzer_image()
print('band information')
print(p.bands.up)
print('twist 0 k-point:',p.bands.up[0].kpoint_rel)
print('twist 4 k-point:',p.bands.up[4].kpoint_rel)
print('twist 0 band 3 eigenvalue:',p.bands.up[0].eigs[3])
print('twist 4 band 4 eigenvalue:',p.bands.up[4].eigs[4])
print(p.results_out.bands.up)
print('twist 0 k-point:',p.results_out.bands.up[0].kpoint_rel)
print('twist 4 k-point:',p.results_out.bands.up[4].kpoint_rel)
print('twist 0 band 3 eigenvalue:',p.results_out.bands.up[0].eigs[3])
print('twist 4 band 4 eigenvalue:',p.results_out.bands.up[4].eigs[4])
except:
print('band information not found')

Expand Down
15 changes: 6 additions & 9 deletions nexus/nexus/examples/qmcpack/rsqmc_misc/excited/band.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#! /usr/bin/env python3

from nexus import settings,job,run_project
from nexus import generate_physical_system
from nexus import generate_pwscf

from nexus.structure import get_primitive_cell, get_kpath
from nexus import generate_physical_system, generate_pwscf, job, run_project, settings
from nexus.structure import get_kpath, get_primitive_cell

settings(
pseudo_dir = '../../pseudopotentials',
Expand Down Expand Up @@ -83,11 +80,11 @@

run_project()

if band.finished:
performed_runs = not settings.generate_only and not settings.status_only
if performed_runs and band.finished:
from nexus.pwscf_analyzer import PwscfAnalyzer
p = PwscfAnalyzer(band)
p.analyze()
p.plot_bandstructure()
print(f"VBM: {p.bands.vbm}")
print(f"CBM: {p.bands.cbm}")
print(f"VBM: {p.Evbm()}")
print(f"CBM: {p.Ecbm()}")
#end if
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#! /usr/bin/env python3

from nexus import settings
from nexus import generate_physical_system
from nexus import generate_pwscf,job
from nexus import run_project

from nexus import generate_physical_system, generate_pwscf, job, run_project, settings

# set global parameters of nexus
settings(
Expand Down Expand Up @@ -39,7 +35,7 @@
relax = generate_pwscf( # make each relax simulation
identifier = 'relax', # file prefix
# run directory
path = 'relax/kgrid_{0}{1}{2}'.format(*kgrid),
path = f'relax/kgrid_{kgrid[0]}{kgrid[1]}{kgrid[2]}',
job = job(cores=16), # will run with mpirun -np 16
input_type = 'relax', # this is a relax calculation
input_dft = 'pbe', # PBE functional
Expand Down Expand Up @@ -74,16 +70,17 @@
kgrid = supercell_kgrids[ik]
relax = relaxations[ik]
pa = relax.load_analyzer_image()
start_force = pa.tot_forces[0]
max_force = pa.tot_forces.max()
ncycles = len(pa.tot_forces)
print(f' {kgrid:10} {start_force:10} {max_force:10} {ncycles:8}')
forces = pa.forces('Ry/B')
total_force = (forces**2).sum(axis=(1,2))**0.5
start_force = total_force[0]
max_force = total_force.max()
ncycles = len(total_force)
kgrid_text = str(kgrid)
print(f' {kgrid_text:10} {start_force:10} {max_force:10} {ncycles:8}')
#end for
print()
print()
print('The final structure is:')
print()
print(list(pa.structures.values())[-1].positions)
print(pa.relaxed_structure('B').pos)
#end if


6 changes: 3 additions & 3 deletions nexus/nexus/pwscf.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def get_result(self,result_name,sim):
result.location = os.path.join(self.locdir,outdir,prefix+'.wfc1')
elif result_name=='structure':
pa = self.load_analyzer_image()
structs = pa.structures
structs = pa.results_out.relax_structures
struct = structs[len(structs)-1]
pos = struct.positions
atoms = struct.atoms
Expand Down Expand Up @@ -434,7 +434,7 @@ def fill_products(self):
analyzer = self.load_analyzer_image()
input = analyzer.input
if 'energy' in self.produces:
self.products.energy = analyzer.E
self.products.energy = analyzer.results_out.E
if 'charge_density' in self.produces:
outdir = input.control.outdir
path = os.path.join(self.locdir,outdir)
Expand All @@ -445,7 +445,7 @@ def fill_products(self):
self.products.orbitals = path
if 'structure' in self.produces:
pa = analyzer
structs = pa.structures
structs = pa.results_out.relax_structures
struct = deepcopy(structs[len(structs)-1])
pos = struct.positions
atoms = struct.atoms
Expand Down
Loading
Loading