Skip to content

Commit

Permalink
Merge pull request #157 from issp-center-dev/update_anacont_spm
Browse files Browse the repository at this point in the history
update dcore_anacont spm
  • Loading branch information
yomichi authored Jan 23, 2025
2 parents 47fea2a + ec4fb3f commit 1066a5f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
4 changes: 2 additions & 2 deletions doc/analytic_continuation/spm.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ n_tau = 101
n_tail = 5
n_sv = 30
lambda = 1e-5
solver = ECOS
solver = CLARABEL

[post.anacont.spm.solver]
max_iters{int} = 100
max_iter{int} = 100
13 changes: 11 additions & 2 deletions doc/reference/input.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,26 @@ This block includes parameters that are solely used by ``dcore_anacont``.
[post.anacont.pade] block
---------------------------

This block includes parameters that are solely used by ``dcore_anacont``.
This block includes parameters that are solely used by ``dcore_anacont`` when ``solver = pade`` in ``[post.anacont]``.

.. include:: post.anacont.pade_desc.txt

[post.anacont.spm] block
---------------------------

This block includes parameters that are solely used by ``dcore_anacont``.
This block includes parameters that are solely used by ``dcore_anacont`` when ``solver = spm`` in ``[post.anacont]``.

.. include:: post.anacont.spm_desc.txt

[post.anacont.spm.solver] block
---------------------------

This block includes parameters that are solely used by ``dcore_anacont`` when ``solver = spm`` in ``[post.anacont]``.

The parameters in this block are passed to cvxpy's ``solve`` function.
Note that ``solver`` and ``verbose_opt`` in ``[post.anacont.spm]`` are used for the ``solver`` and ``verbose`` arguments of ``solve``, respectively, so don't specify them here.
See `cvxpy's solver documentation <https://www.cvxpy.org/tutorial/solvers/index.html>`_ for details.

[post.spectrum] block
-----------------------

Expand Down
2 changes: 1 addition & 1 deletion src/dcore/anacont/spm.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def _solveProblem(

prob = cp.Problem(objective, constraints)
if solver == "":
_ = prob.solve(verbose=verbose)
_ = prob.solve(verbose=verbose, **solver_opts)
else:
_ = prob.solve(verbose=verbose, solver=solver, **solver_opts)
gf_tau_fit = np.dot(U, np.dot(Smat, rho_prime.value))
Expand Down
10 changes: 7 additions & 3 deletions src/dcore/program_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def create_parser(target_sections=None):
Create a parser for all program options of DCore
"""
if target_sections is None:
parser = TypedParser(['mpi', 'model', 'pre', 'system', 'impurity_solver', 'control', 'post', 'post.anacont', 'post.anacont.pade', 'post.anacont.spm', 'post.anacont.spm.solver', 'post.spectrum', 'post.check', 'bse', 'vertex', 'sparse_bse'])
parser = TypedParser(['mpi', 'model', 'pre', 'system', 'impurity_solver', 'control', 'post', 'post.anacont', 'post.anacont.pade', 'post.anacont.spm', 'post.anacont.spm.solver' 'post.spectrum', 'post.check', 'bse', 'vertex', 'sparse_bse'])
else:
parser = TypedParser(target_sections)

Expand Down Expand Up @@ -133,7 +133,7 @@ def create_parser(target_sections=None):
parser.add_option("post.check", "omega_check", float, 0, "Maximum frequency for dcore_check. If not specified, a fixed number of Matsubara points are taken.")

# [post.anacont]
parser.add_option("post.anacont", "solver", str, "pade", "Algorithm for analytic continuation (pade or spm)")
parser.add_option("post.anacont", "solver", str, "algorithm", "Algorithm for analytic continuation")
parser.add_option("post.anacont", "omega_min", float, -1, "Minimum value of real frequency")
parser.add_option("post.anacont", "omega_max", float, 1, "Max value of real frequency")
parser.add_option("post.anacont", "Nomega", int, 100, "Number of real frequencies")
Expand All @@ -152,10 +152,14 @@ def create_parser(target_sections=None):
parser.add_option("post.anacont.spm", "n_tail", int, 10, "number of matsubara points for tail-fitting")
parser.add_option("post.anacont.spm", "n_sv", int, 50, "number of singular values to be used")
parser.add_option("post.anacont.spm", "lambda", float, 1e-5, "coefficient of L1 regularization")
parser.add_option("post.anacont.spm", "solver", str, "", "solver to be used")
parser.add_option("post.anacont.spm", "solver", str, "", "cvxpy solver for solving spm. Empty string means default solver of cvxpy.")
parser.add_option("post.anacont.spm", "verbose_opt", bool, False, "show optimization progress")
parser.add_option("post.anacont.spm", "show_fit", bool, False, "plot result of tail-fitting")

# [post.anacont.spm.solver]
# Nothing to add here
# All parameters are passed to cvxpy solver

# [post.spectrum]

parser.add_option("post.spectrum", "nk_line", int, 8, "Number of *k* along each line")
Expand Down

0 comments on commit 1066a5f

Please sign in to comment.