Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run legacy Hubbard #270

Open
franappi11 opened this issue Oct 31, 2023 · 5 comments
Open

Run legacy Hubbard #270

franappi11 opened this issue Oct 31, 2023 · 5 comments

Comments

@franappi11
Copy link

Hi ipie developers,
I am trying to run the legacy example Hubbard model. What are the necessary steps to "resurrect" the code? It seems like the system name "Hubbard" in the input file has no correspondence and it looks the function write_xml_input, in the write integrals file, does not exist. Do you have any idea/guide on how to make possible to run the Hubbard model?
Sorry for the vague question and thank you for your help!

@fdmalone
Copy link
Collaborator

fdmalone commented Nov 1, 2023

Hi! Thanks for your interest, and it is by no means obvious how to do this.

You can currently run the legacy hubbard code by doing (for example)

/path/to/ipie/bin/ipie --legacy input.json 

where input.json is an appropriately formed json input file. Here is an example input file:

{
    "system": {
        "name": "Hubbard",
        "nx": 4,
        "ny": 4,
        "nup": 7,
        "ndown": 7,
        "U": 4
    },
    "qmc": {
        "dt": 0.005,
        "nwalkers": 50,
        "blocks": 1000,
        "nsteps": 10,
        "pop_control_freq": 5
    },
    "trial": {
        "name": "UHF"
    },
    "propagator": {
        "hubbard_stratonovich": "discrete"
    },
    "estimators": {}
}

There are two options for trial ("free_electron" and "UHF") (nx and ny are the dimensions of the square 2D lattice, and U is the hubbard U parameter.

Note one must do

BUILD_LEGACY_IPIE=TRUE; pip install -e.

in order to enable the legacy ipie features (which, in a somewhat entangled way depend on cythonized modules). This is all very convoluted but as of today legacy features are not supported (in the sense we won't typically actively develop them) until they are resurrected into mainline ipie.

I think the write_xml_input you're referring to is https://github.com/JoonhoLee-Group/ipie/blob/develop/ipie/legacy/examples/hubbard/02-write_integrals/write_ints.py. This script was written in order to write the integrals in a format that could be read by QMCPACK (afqmctools is a package contained within afqmctools). Apologies for this having zero documentation but I would lagely ignore this script.

@fdmalone
Copy link
Collaborator

fdmalone commented Nov 1, 2023

On the topic of resurrecting the Hubbard model, if you're eager then it would be a fantastic contribution. The steps would be roughly as follows:

  1. Move (copy) the legacy Hubbard hamiltonian https://github.com/JoonhoLee-Group/ipie/blob/develop/ipie/legacy/hamiltonians/hubbard.py to the mainline hamiltonian directory I think we would want to remove several tacked on features (pinning fields, chemical potential, fcidump, ...)
  2. The trial wavefunction for the Hubbard hamiltonian is just a single determinant (for the moment). The orbitals from UHF and the free electron trial should just be fed into this class. We would need some way to simplify this (maybe refactor these legacy classes as some utility functions).
  3. The discrete Hirsch Propagator should not derive from ContinuousBase. But live by itself. It should have the same interface as ContinousBase https://github.com/JoonhoLee-Group/ipie/blob/develop/ipie/propagation/continuous_base.py but I wouldn't worry about any inheritance for now. The main afqmc driver only requires a propagate_walker method to be defined. (this is called something slightly different here: https://github.com/JoonhoLee-Group/ipie/blob/develop/ipie/legacy/propagation/hubbard.py#L293)

As a first step I would target resurrecting the standard Hubbard model with single determinant trial wavefunctions (RHF/UHF not GHF) and the discrete propagator.

These are the main steps I think but there will likely be lots of little details. All the unit tests should copy over and pass as well as any integration tests.

@fdmalone
Copy link
Collaborator

fdmalone commented Nov 1, 2023

I will say, the easiest way to do this would likely to first build it up like https://github.com/JoonhoLee-Group/ipie/blob/develop/examples/08-custom_walker/run_afqmc.py (with the propagator also modified, but the walkers unmodified). I also forgot to add a point 4. above which would be the energy estimator.

@franappi11
Copy link
Author

@fdmalone thank you for your answers! I tried to follow the steps you described in your first answer, but I am getting the following error: "ModuleNotFoundError: No module named 'ipie.legacy.estimators.ueg_kernels'". About resurrecting the Hubbard model, I would like to contribute but I have just started a new job and I am pretty busy ( and I am also not the most skilled developer). Anyways, I would consider it as a side project, in the near future, in case I will contact you for more details!

@franappi11
Copy link
Author

Okay, after playing with setup.py file I think it is working now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants