This is a modified fork. Forked from haritan/Automatic-RVP and modified in 2026 by Karl Lyu. Changes to
src/clustering.py,src/pade.pyandsrc/rvp.pyare described in Modifications in this fork below and in the commit history. The original code is by Idan Haritan and Yochai Safrai; this fork remains under GPL v3.0.
Automatic RVP is a python based code designed to automatically calculate resonances energy and width using a single energy level stabilization graph as input.
The code identifies the flat region of the stabilization graph, calculates the Pade approximant for different sections in that region, and then estimates the corresponding resonance energy and width from each Pade approximant. Later, the code uses a data clustering algorithm to evaluate the mean value of the resonance energy and width based on the results collected.
The final output of the code is the mean resonance energy and width alongside information on the clustering result, and statistical data such as standard deviations. Yet, the code also provides the following data:
- The stable region found.
- The resonance energy and width from each Pade approximant.
- The input data for the clustering algorithm.
Therefore, the code is also modular, and can be broken into 3 different segments, that may run individually, as follows:
- Stabilization - Identifies a flat region in a stabilization graph.
- Pade - Calculates Pade approximant for different sections in an input and estimates the corresponding resonance energy and width from each Pade approximant.
- Clustering - Finds a cluster of resonance energy and width based on an input data.
# Using pip
pip install automatic-rvpThe examples below are short usage examples with default parameters. More detailed examples with inputs and outputs can be found in the example folder. Additionally, a list of available parameters can be found in the wiki.
Save a single energy level stabilization data in a txt file ('file_name.txt'). In this file, create two columns separated by tab or space. Save the alpha values in the first column, and the corresponding energy values in the second column (see example input file in the example folder).
Calculate resonance energy and width using :
from rvp import auto_rvp
auto_rvp(input_file='file_name.txt')Save a single energy level stabilization data in a txt file ('file_name.txt'). In this file, create two columns separated by tab or space. Save the alpha values in the first column, and the corresponding energy values in the second column (see example input file in the example folder).
Identify the stable region using:
from stabilization import run_stabilization
run_stabilization(input_file='file_name.txt')Save selected data in a txt file ('file_name.txt'). In this file, create two columns separated by tab or space. Save the alpha values in the first column, and the corresponding energy values in the second column (see example input file in the example folder).
Calculate Pade approximant for different sections in the input file and estimate the corresponding resonance energy and width from each Pade approximant using:
from pade import run_pade
run_pade(input_file='file_name.txt')Save a selected data in a csv file ('file_name.csv'). In this file, create five columns separated by commas. Save the real energy values of the resonance in the first column, the imaginary energy values in the second column, the corresponding alpha values in the third column, the corresponding theta values in the fourth column and the corresponding error values in the fifth column (see example input file in the example folder).
Find a cluster of resonance energy and width using:
from clustering import run_clustering
run_clustering(input_file='file_name')- 1.0.3
- 1.0.0
- First version
This project is based on Non-Hermitian quantum mechanics theory described in: Moiseyev, N. Non-Hermitian Quantum Mechanics; Cambridge University Press: Cambridge, U.K., 2011.
The RVP method itself is explained in details in: Landau, A., Haritan, I., Kapralova-Zdanska, P. R., & Moiseyev, N. (2016). Atomic and molecular complex resonances from real eigenvalues using standard (hermitian) electronic structure calculations. The Journal of Physical Chemistry A, 120(19), 3098-3108.
Modified in 2026 by Karl Lyu, relative to upstream v1.0.3:
-
src/pade.py— the Pade root filter now keeps roots with a negative imaginary part (imag < 0) rather than roots withtheta > 0, selecting physical resonances directly. -
src/clustering.py— divergent Pade roots are rejected before clustering, using a median/MAD robust-sigma threshold (1.4826 * MAD) applied as a union over the real and imaginary parts. The median and MAD are used for their 50% breakdown point: a handful of divergent roots is enough to inflate the standard deviation by orders of magnitude, so a scale estimator built from the outliers cannot be used to find them.min_samplesis also floored at 1 so small inputs do not degenerate. -
src/rvp.py— newoutlier_sigmaparameter (default6.0) plumbed throughauto_rvpandrun_clustering. Set it to0orNoneto restore the upstream behaviour.
The rejection count is reported in output.dat and the rejected rows are written to
rejected_outliers.csv.
Idan Haritan – idan.haritan@gmail.com
Yochai Safrai - yochai.safrai@gmail.com
https://github.com/haritan/Automatic-RVP
This project is licensed under the GPL v3.0 License - see the LICENSE file for details.
