Skip to content

Nl restructuring#89

Merged
palful merged 30 commits intobug-fixesfrom
nl-restructuring
Mar 9, 2026
Merged

Nl restructuring#89
palful merged 30 commits intobug-fixesfrom
nl-restructuring

Conversation

@myrta
Copy link
Copy Markdown
Member

@myrta myrta commented Jan 8, 2026

I create the Xn_from_signal abstract python class and a set of derived classes for extracting nonlinear susceptibilities and conductivities from the macroscopic time-dependent polarization $P$ and current $J$.
This is the start for rationalizing the nl part which has grown following need. Code which initiallly was translated from fortran ypp, was copied to a new file and modified to add new functionalities since the structure was very similar. This change is an attempt to highlight/force that structure even though keeping a file for each functionality.
Documentation is drafted in in Xn_from_signal_doc.md

myrta and others added 21 commits December 8, 2025 17:42
…f multiple runs to extract response

	new file:   yambopy/nl/sin_analysis.py => class for analysis of multiple runs with monochromatic signal to extract response
	modified:   yambopy/__init__.py=> freqmix_analysis added
	new file:   yambopy/nl/freqmix_analysis.py=> analysis of two monochromatic signals (sum_frequencies)
	modified:   yambopy/nl/nl_analysis.py=> changes to further generalise
	modified:   yambopy/nl/sin_analysis.py=> changes as consequence of freqmix_analysis addition
	modified:   yambopy/nl/nl_analysis.py
	modified:   yambopy/nl/sin_analysis.py

changes result from debug on a test case.
	modified:   yambopy/nl/freqmix_analysis.py
Changed header of output files
	modified:   yambopy/nl/freqmix_analysis.py
	modified:   yambopy/nl/nl_analysis.py
	modified:   yambopy/nl/sin_analysis.py

Added an extra lstsq solver based on the scipy lstsq optimizer which takes initial values
	modified:   yambopy/nl/freqmix_analysis.py
	modified:   yambopy/nl/nl_analysis.py

coded the spike_correction function even though it is not used so far
	new file:   yambopy/nl/Xn_from_signal_diagrams.md

started a doc of the code suite for nl analysis ). use the md that can be then converted in whatevers
	new file:   yambopy/nl/pulse_analysis.py

Started the new class for pulse analysiss
	modified:   yambopy/nl/external_efield.py
	modified:   yambopy/nl/freqmix_analysis.py
	modified:   yambopy/nl/pulse_analysis.py
	modified:   yambopy/nl/sin_analysis.py
finished to code the pulse analysis and small chenges to the other files. pulse analysis to be tested.
	modified:   yambopy/nl/Xn_from_signal_diagrams.md

Added a brief theory section to the documentation
	deleted:    yambopy/nl/Xn_from_signal_diagrams.md
	new file:   yambopy/nl/Xn_from_signal_doc.md

First draft of documentation completed. Name of documentation file changed.
	modified:   yambopy/nl/Xn_from_signal_doc.md

Minor edits
minor edit: fixed crossed references
	modified:   yambopy/dbs/nldb.py
	modified:   yambopy/nl/external_efield.py
	modified:   yambopy/nl/freqmix_analysis.py
	modified:   yambopy/nl/nl_analysis.py
	modified:   yambopy/nl/pulse_analysis.py

Corrected small bugs and added minor features
Changed default for starting sampling time to T0 - sigma.
	modified:   yambopy/nl/sin_analysis.py

added run info at the end of output files
Added debug mode to hide comments
	modified:   yambopy/nl/sin_analysis.py
	modified:   yambopy/nl/sum_frequencies.py

Minor changes, corrections and additions
@myrta myrta requested a review from attacc January 8, 2026 17:11
@myrta myrta self-assigned this Jan 8, 2026
@myrta myrta added documentation Improvements or additions to documentation enhancement New feature or request labels Jan 8, 2026
@myrta myrta unassigned myrta Jan 8, 2026
@attacc
Copy link
Copy Markdown
Contributor

attacc commented Jan 8, 2026

I run tests, I think there a problem in the sign of Xhi^0, probably tests should be updated?
we have to discuss it

@palful
Copy link
Copy Markdown
Member

palful commented Jan 12, 2026

Hi all, for now, I would leave these developments out of the new pseudorelease 0.7.0, is that ok? Do you want this PR added to the bug-fixes branch or you are still actively working on it?

	modified:   yambopy/nl/freqmix_analysis.py
	modified:   yambopy/nl/nl_analysis.py
	modified:   yambopy/nl/pulse_analysis.py
	modified:   yambopy/nl/sin_analysis.py

Moved get_sampling as common method in nl_analysis.py and
created the abstract method set_sampling to get the specific range/sampling number
Copy link
Copy Markdown
Contributor

@attacc attacc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Branch tested and perfectly working.
It also fixes a but in the sum-frequency extrapolation

@palful palful changed the base branch from master to bug-fixes March 9, 2026 12:02
@palful
Copy link
Copy Markdown
Member

palful commented Mar 9, 2026

Dear all, thank you for all the developments! I am merging in the bug-fixes right now but between today and tomorrow it will enter in a new "release" both on master and the pip repository.

@palful palful merged commit f27c150 into bug-fixes Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants