QRef
QRef is a new implementation of quantum refinement, based on the freely available Phenix and Orca software. It allows for refinement in both real and reciprocal space, using X-ray, XFEL, neutron, cryo-EM and micro-ED data. The actual refinement (geometry optimisation) is run by Phenix. Several overlapping or disjoint QM regions are allowed.

The method is described in "Quantum refinement in real and reciprocal space" by Kristoffer J. M. Lundgren, Octav Caldararu, Esko Oksanen and Ulf Ryde, IUCrJ, submitted.
The first application is published in H. Jiang, K. J. M. Lundgren & U. Ryde (2023) "Protonation of homocitrate and the E1 state of Fe-nitrogenase studied by QM/MM calculations", Inorg. Chem., 62, 19433-19445 ; DOI: 10.1021/acs.inorgchem.3c02329.

The program is freely available on GitHub: https://github.com/krlun/QRef.
Installation procedure is described there.

How to start a quantum-refinement job

The general procedure to set up a quantum refinement job consists of the following steps:

  1. phenix.fetch_pdb <pdb_code> --mtz
  2. Build a model.

  3. Prepare restraint files for unknown residues and ligands. The script qref_prep.py will tell you if there are any missing restraint files.

  4. Prepare syst1 files that define the QM regions.

  5. Run qref_prep.py <model>_sorted.pdb to generate qref.dat (a file containing settings for the QR interface), as well as PDB files describing the QM regions.

  6. Check that you have got the correct path to orca in file qref.dat
    Note that if you run Orca in parallel, it needs to be compiled with static linking
  7. The next step is to prepare input files for Orca.

  8. Enable Phenix and Orca, e.g. by (on Cosmos)
    source /lunarc/nobackup/projects/teobio/Bio/Qref/phenix-1.20.1-4487-qref/phenix_env.sh
  9. Now, you can start the quantum refinement. However, it is recommended to first create an empty file named qm.lock (this disables QR; touch qm.lock), then start a refinement so that an .eff file is obtained:
    phenix.refine <model>_sorted.pdb <model>.mtz
    The .eff file contains all the Phenix refinement settings for the current experimental data and model). Rename this file to phenix.params and edit it to make sure the following options are set:

  10. To run the quantum refinement job, delete the qm.lock file and then execute either phenix.refine phenix.params or phenix.real_space_refine phenix.params.
    If there is a need to restart the job with different settings for Phenix, make sure to delete the file settings.pickle.
    phenix.refine phenix.params --overwrite
    or
    phenix_real_space.refine phenix.params --overwrite
    If the job is run in parallel, you need to load modules for openMPI

    If you need to do a restart, do
    rm *.lock



Sample syst1 file

628-635 ! LYS A 83
2030 ! CYS A 257
2033-2036 ! CYS A 257
2700 ! THR A 335
2703-2707 ! THR A 335
2716-2720 ! PRO A 338
2723 ! PRO A 338
2724-2726 ! ARG A 339
2728-2747 ! ARG A 339
2921-2928 ! LYS A 361
3429-3437 ! HIS A 423
16809-16829 ! HCA A 501
16830-16846 ! 8P8 A 502
16847-16850 ! CO3 A 503

628 ! CD LYS A 83
2030 ! CA CYS A 257
2700 ! CA THR A 335
2705 ! CG THR A 335
2716 ! N PRO A 338
2720 ! CB PRO A 338
2726 ! C ARG A 339
2921 ! CD LYS A 361
3429 ! CB HIS A 423

Sample ORCA input file

! TPSS D4 DEF2-SV(P)
! ENGRAD
%PAL NPROCS 4 END
*pdbfile +1 1 qm_1_h.pdb


Input files


Where to find final results



Installation

A somewhat more hands-on description of the installation than described on GitHub.

  1. Download Phenix or make a copy of a existing installation of Phenix.
    If moving an already installed version, change the path in the phenix_env.sh file to the new location.
  2. Download QRef from GitHub (Code - Download zip).
  3. Move it to a proper directiory and
    unzip QRef-main.zip
  4. Alternatively get the link from GitHub (Code - Right-click Download zip - Copy Link) and then
    git clone <link>
  5. source path_to_phenix/phenix_env.sh
  6. Go to the QRef-main/modules directory
  7. cp -pr qref $PHENIX/modules
  8. cp cctbx/geometry_restraints/energies.py $PHENIX/modules//cctbx_project/cctbx/geometry_restraints
  9. cp cctbx_project/mmtbx/model/model.py $PHENIX/modules/cctbx_project/mmtbx/model
  10. Uncomment the line
    # if not os.path.exists('qm.lock') and (os.path.exists('xyz_reciprocal.lock') or os.path.exists('xyz.lock')):
    and comment out the next line (if not os.path.exists('qm.lock'):)
    in the file $PHENIX/modules/cctbx_project/cctbx/geometry_restraints/energies.py
  11. Add the line
    import os
    in the beginning of the file
    $PHENIX/modules/phenix/phenix/refinement/xyz_reciprocal_space.py
    Also add the two lines
          with open('xyz_reciprocal.lock', 'w'):
            pass
    before the line containing mmtbx.refinement.minimization.lbfgs
    and this line after it:
          os.remove('xyz_reciprocal.lock')
  12. Do similar changes in the file $PHENIX/modules/phenix/phenix/refinement/macro_cycle_real_space.py:
    Add the line
    import os
    in the beginning of the file.
    Add the two lines
        with open('xyz.lock', 'w'):
          pass

    before the lines containing either self.minimization_no_ncs() or self.minimization_ncs(), i.e. two places
    and this line after them:
        os.remove('xyz.lock')
  13. which cctbx.python
  14. Copy the answer of this command to the first line of the files
    path_to_Qref-main/scripts/qref_prep.py
    and sort_pdb.py
  15. Ensure that the path_to_Qref-main/scripts directory is in you PATH variable.
    export PATH=$PATH:
    path_to_Qref-main/scripts