### Setup Parameterization Runs with create_parameterization.py Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Execute the create_parameterization.py script to set up directories and generate .tpr files for parameterization runs based on provided MD.mdp, PDB, and topology files. ```bash create_parameterization.py -f MD.mdp -c NPT.pdb -r NPT.pdb -p topol.top -n index.ndx ``` -------------------------------- ### Install phbuilder using pip Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Install the phbuilder package using pip. Python 3.8 or newer is required. Ensure your Python environment is set up correctly. ```bash pip install phbuilder ``` -------------------------------- ### Setup Computational Titration with create_titration.py Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Use the `create_titration.py` script to set up directories and input files for performing computational titrations. This script requires the main MD `.mdp` file, system PDB, topology, index file, and a pH range specification. ```bash create_titration.py -f MD.mdp -c NPT.pdb -p topol.top -n index.ndx -pH 1:10:1 -nr 2 ``` -------------------------------- ### Generate CpHMD Topology with Automatic Protonation Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Use `phbuilder gentopol` with the `-ph` flag to automatically set initial lambda values based on pH and pKa. This simplifies setup when manual selection is not desired. ```bash phbuilder gentopol -f input.pdb -ph ``` -------------------------------- ### Position Restraints in topol.top Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md The generated topol.top file should include position restraints for specific atoms, typically the ligand's heavy atoms. This example shows how to restrain only atom 19. ```text ; Include Position restraint file #ifdef POSRES #include "posre.itp" #endif ``` ```text [ position_restraints ] ; i funct fcx fcy fcz 19 1 1000 1000 1000 ``` -------------------------------- ### phbuilder Force Field and Parameter Location Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md This path indicates where phbuilder installs its modified CHARMM36m force field and CpHMD topology parameters. Local files in the working directory will override these defaults. ```bash /path/to/python3.xx/site-packages/phbuilder/ffield/ ``` -------------------------------- ### Generate CpHMD Topology for Specific Residue Groups Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Use `phbuilder gentopol` with the `-groups` flag to specify which residue types should be made titratable. This allows for targeted CpHMD setup. ```bash phbuilder gentopol -f input.pdb -groups "ASPT GLUT" ``` -------------------------------- ### Build GROMACS with CUDA Support Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md This CMake command is used to build GROMACS with CUDA GPU acceleration enabled. Ensure CUDA is installed prior to running this command. It also enables FFTW and RDTSCP for performance. ```bash cmake .. -DGMX_BUILD_OWN_FFTW=ON -DGMX_GPU=CUDA -DGMX_USE_RDTSCP=ON -DCMAKE_INSTALL_PREFIX=/usr/local/gromacs_constantph ``` -------------------------------- ### Set up dV/dλ Parameterization Runs Source: https://context7.com/gromacs-constantph/phbuilder/llms.txt Uses the `create_parameterization.py` script to set up directories for parameterizing new titratable group types. It creates directories for each λ-point and prepares `.tpr` files. ```bash # Create 13 parameterization directories for ARGT at fixed lambda values create_parameterization.py \ -f MD.mdp \ -c NPT.pdb \ -r NPT.pdb \ -p topol.top \ -n index.ndx # Custom output prefix and GROMACS path create_parameterization.py \ -f MD.mdp -c NPT.pdb -r NPT.pdb \ -p topol.top -n index.ndx \ -o param -gmx /usr/local/gromacs_constantph/bin/gmx # Resulting directory structure: # r_-0.10_1.10/MD.mdp <- initial-lambda for titratable = -0.10, BUF = 1.10 # r_-0.10_1.10/run.tpr # r_0.00_1.00/run.tpr ``` -------------------------------- ### Set up Computational Titration Directories Source: https://context7.com/gromacs-constantph/phbuilder/llms.txt Uses the `create_titration.py` script to generate simulation directories for various pH values. It copies and modifies `.mdp` files and prepares `.tpr` files using `gmx grompp`. ```bash # Create pH 1–9 (step 1) with 2 replicas each create_titration.py \ -f MD.mdp \ -c NPT.pdb \ -p topol.top \ -n index.ndx \ -pH 1:10:1 \ -nr 2 # Provide a reference structure for position restraints create_titration.py \ -f MD.mdp -c NPT.pdb -r NPT.pdb \ -p topol.top -n index.ndx \ -pH 4:9:0.5 -nr 3 # Specify a non-default output prefix and GROMACS path create_titration.py \ -f MD.mdp -c NPT.pdb -p topol.top -n index.ndx \ -pH "{4.0,5.0,6.0,7.0}" -nr 5 \ -o titration -gmx /usr/local/gromacs_constantph/bin/gmx # Resulting directory structure: # pH_1.00/r_1/MD.mdp <- pH token replaced with 1.00 # pH_1.00/r_1/run.tpr # pH_1.00/r_2/MD.mdp # pH_1.00/r_2/run.tpr # pH_2.00/r_1/MD.mdp # ... # Run all replicas with mdrun in-place create_titration.py \ -f MD.mdp -c NPT.pdb -p topol.top -n index.ndx \ -pH 1:10:1 -nr 2 \ -rc "gmx mdrun -v -deffnm MD -c MD.pdb -x MD.xtc -npme 0" ``` -------------------------------- ### Solvation and Neutralization with Gromacs and phbuilder Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Perform solvation and neutralization steps to create a net-neutral simulation system. Use gmx editconf for box creation, gmx solvate for adding solvent, and phbuilder neutralize for adding buffer particles and ions. ```bash gmx editconf -f phprocessed.pdb -o box.pdb -bt cubic -d 2.0 gmx solvate -cp box.pdb -p topol.top -o solvated.pdb phbuilder neutralize -f solvated.pdb -nbufs 1 -rmin 1.5 -conc 0.15 ``` -------------------------------- ### NPT Equilibration with GROMACS Source: https://context7.com/gromacs-constantph/phbuilder/llms.txt Use 'gmx grompp' to prepare the simulation input and 'gmx mdrun' to perform the NPT equilibration. Ensure correct MDP file, topology, and index files are provided. ```bash gmx grompp -f NPT.mdp -c NVT.pdb -p topol.top -n index.ndx -o NPT.tpr ``` ```bash gmx mdrun -v -deffnm NPT -c NPT.pdb -npme 0 ``` -------------------------------- ### Fit Parameterization Coefficients with fit_parameterization.py Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Run this script in parameterization mode to obtain an initial guess for dVdl coefficients. It updates lambdagrouptypes.dat and .mdp files. ```python fit_parameterization.py -f MD.mdp -m p -g ARGT ``` -------------------------------- ### Refine Parameters with fit_parameterization.py (Reweighting Mode) Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Use this command in reweighting mode to compute corrections for dVdl coefficients if distributions are not flat. Ensure replica directories follow the 's_1', 's_2', ... naming format. ```python python fit_parameterization.py -f MD.mdp -m s -g ARGT ``` -------------------------------- ### Generate CpHMD Topology with phbuilder Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Run phbuilder gentopol to create the CpHMD topology. Ensure the initial lambda is set to the most protonated state and configure pdb2gmx flags as needed. ```bash phbuilder gentopol -f arg_tript.pdb ``` -------------------------------- ### Fit dV/dλ coefficients using fit_parameterization.py Source: https://context7.com/gromacs-constantph/phbuilder/llms.txt Standalone script for fitting dV/dλ coefficients. Use parameterization mode (`-m p`) for initial fits or reweighting mode (`-m s`) for correcting systematic errors. Requires GROMACS `.mdp` and `.edr` files. ```bash # Mode 1: Initial polynomial fit from parameterization runs (default order 5) fit_parameterization.py \ -f MD.mdp \ -m p \ -g ARGT ``` ```bash # Mode 1: Higher-order fit with custom prefix and output fit_parameterization.py \ -f MD.mdp -m p -g ARGT \ -i r -fo 7 -o argt_params.dat ``` ```bash # Mode 2: Inverse-Boltzmann reweighting from 10 replicate simulations # (expects directories s_1/, s_2/, ..., s_10/ each containing # cphmd-coord-1-2.xvg) fit_parameterization.py \ -f MD.mdp \ -m s \ -g ARGT \ -nr 10 ``` ```bash # Mode 2: Custom prefix and order fit_parameterization.py \ -f MD.mdp -m s -g ARGT \ -i my_replicas -nr 5 -fo 6 ``` -------------------------------- ### Full phbuilder CpHMD simulation workflow Source: https://context7.com/gromacs-constantph/phbuilder/llms.txt A complete pipeline script for setting up a GROMACS constant-pH simulation from a raw PDB structure. It automates topology preparation, solvation, neutralization, parameter generation, and simulation steps. ```bash #!/bin/bash # Complete phbuilder workflow for a protein at pH 4.0 source /usr/local/gromacs_constantph/bin/GMXRC # Step 1 — Prepare CpHMD topology (auto-assign protonation states) phbuilder gentopol -f protein.pdb -ph 4.0 # → phprocessed.pdb, topol.top, phrecord.dat, charmm36-mar2019-cphmd.ff/ # Step 2 — Build periodic box and solvate gmx editconf -f phprocessed.pdb -o box.pdb -bt cubic -d 1.5 gmx solvate -cp box.pdb -p topol.top -o solvated.pdb # Step 3 — Neutralize with ions and buffer particles (0.15 M NaCl) phbuilder neutralize -f solvated.pdb -conc 0.15 # → phneutral.pdb, updated topol.top # Step 4 — Generate CpHMD .mdp and .ndx files for production at pH 4.0 phbuilder genparams -f phneutral.pdb -ph 4.0 # → EM.mdp, NVT.mdp, NPT.mdp, MD.mdp, index.ndx # Step 5 — Energy minimization gmx grompp -f EM.mdp -c phneutral.pdb -p topol.top -n index.ndx -o EM.tpr -maxwarn 1 gmx mdrun -v -deffnm EM -c EM.pdb -npme 0 # Step 6 — NVT equilibration gmx grompp -f NVT.mdp -c EM.pdb -p topol.top -n index.ndx -o NVT.tpr gmx mdrun -v -deffnm NVT -c NVT.pdb -npme 0 # Step 6b — (optional) inject final lambdas before NPT python EQ_smart.py NVT NPT ``` -------------------------------- ### Generate .mdp Files in Calibration Mode with phbuilder Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Use phbuilder genparams with the -cal flag to generate .mdp files for parameterization. This sets lambda-dynamics-calibration to 'yes' and defines POSRES flags. ```bash phbuilder genparams -f phneutral.pdb -ph 4.0 -cal ``` -------------------------------- ### Parameterizing Custom Ligands with phbuilder Source: https://context7.com/gromacs-constantph/phbuilder/llms.txt This workflow is for adding custom titratable ligands. It involves modifying 'lambdagrouptypes.dat', sampling dV/dλ, fitting coefficients, and refining with inverse-Boltzmann reweighting. ```bash create_parameterization.py ``` ```bash fit_parameterization.py -m p ``` ```bash fit_parameterization.py -m s ``` -------------------------------- ### Generate Topology with phbuilder gentopol Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Use this command to select titratable residues and set their initial protonation states. It regenerates the system topology using the modified CHARMM36m force field. The -ph flag can automatically set initial lambda values based on pH and pKa. ```bash phbuilder gentopol [-h] -f FILE [-o OUTPUT] [-ph PH] [-v] ``` -------------------------------- ### Load Titratable Group Parameters from File Source: https://context7.com/gromacs-constantph/phbuilder/llms.txt Shows how to parse the `lambdagrouptypes.dat` file to load force field parameters for titratable groups. The parameters include charges, pKa values, and dV/dλ coefficients. ```ini # lambdagrouptypes.dat — example showing ASPT entry and BUF [ GROMACS ] path = /usr/local/gromacs_constantph [ FORCEFIELD ] name = charmm36-mar2019-cphmd.ff water = tip3p [ ASPT ] incl = ASP ASPH atoms = CB HB1 HB2 CG OD1 OD2 HD2 qqA = -0.18 0.09 0.09 0.62 -0.76 -0.76 0.44 pKa_1 = 3.65 qqB_1 = -0.28 0.09 0.09 0.62 -0.76 -0.76 0.00 dvdl_1 = 24.685 -109.72 204.27 -187.68 75.472 -7.2018 [ GLUT ] incl = GLU GLUH atoms = CG HG1 HG2 CD OE1 OE2 HE2 qqA = -0.21 0.09 0.09 0.62 -0.76 -0.76 0.44 pKa_1 = 4.25 qqB_1 = -0.28 0.09 0.09 0.62 -0.76 -0.76 0.00 dvdl_1 = 12.0 -64.0 125.0 -115.0 46.0 -5.0 [ HSPT ] incl = HIS HISD HISE atoms = CB HB1 HB2 CG ND1 HD1 CD2 HD2 CE1 HE1 NE2 HE2 qqA = ... pKa_1 = 6.6 pKa_2 = ph ; will be substituted with simulation pH (multistate) qqB_1 = ... qqB_2 = ... dvdl_1 = ... dvdl_2 = ... [ BUF ] range = -0.50 0.50 dvdl = 823.85 -2457.8 2172.2 -144.05 -1289 576.74 ``` -------------------------------- ### Add Periodic Box with gmx editconf Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Add a periodic box to your system using `gmx editconf`. This is a necessary step before solvation. ```bash gmx editconf -f phprocessed.pdb -o box.pdb -bt cubic -d 1.5 ``` -------------------------------- ### Write generic GROMACS .mdp files with gen_mdp() Source: https://context7.com/gromacs-constantph/phbuilder/llms.txt This internal Python function writes complete GROMACS .mdp files for various simulation types (EM, NVT, NPT, MD). Calibration mode activates position restraints. Ensure correct simulation type and parameters like time step and number of steps are provided. ```python from phbuilder.mdp import gen_mdp # Write an energy minimisation .mdp (5000 steps, no coordinate output) gen_mdp(Type='EM', nsteps=5000, nstxout=0) ``` ```python # Write NVT equilibration .mdp (500 ps at dt=0.002 ps) gen_mdp(Type='NVT', nsteps=250000, nstxout=5000) ``` ```python # Write NPT equilibration .mdp with position restraints (calibration) gen_mdp(Type='NPT', nsteps=250000, nstxout=5000, posRes=True) ``` ```python # Write production .mdp (100 ns) gen_mdp(Type='MD', nsteps=50000000, nstxout=25000) ``` -------------------------------- ### Solvate System with gmx solvate Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Solvate the system using `gmx solvate`. This command adds solvent molecules around the solute in the periodic box. ```bash gmx solvate -cp box.pdb -p topol.top -o solvated.pdb ``` -------------------------------- ### Compile and Run CpHMD on HPC with Slurm Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md This Slurm script details the process of compiling the CpHMD beta on an HPC node and then running GROMACS simulations. Ensure modules and paths are correctly set for your environment. ```bash #!/bin/bash #SBATCH --time=2-00:00:00 #SBATCH --nodes=1 #SBATCH -p #SBATCH --job-name= #SBATCH --mail-user= #SBATCH --mail-type=ALL #SBATCH -G 1 # LOAD MODULES module load cmake/latest module load gcc/7.4 module load cuda/10.2 # COMPILE GROMACS CPHMD CODE ON NODE SCRATCH simdir="$PWD" builddir="/scratch/$USER/$SLURM_JOBID/build" mkdir -p "$builddir" cd "$builddir" cp ~/gromacs-constantph . CC=gcc-7 CXX=g++-7 cmake ./gromacs-constantph -DGMX_USE_RDTSCP=ON -DCMAKE_INSTALL_PREFIX=${PWD}/.. -DGMX_BUILD_OWN_FFTW=ON -DGMX_GPU=CUDA make -j 12 make install -j 12 cd .. source ${PWD}/bin/GMXRC # RUN SIMULATION cd "$simdir" gmx grompp -f MD.mdp -c NPT.pdb -p topol.top -n index.ndx -o MD.tpr gmx mdrun -deffnm MD -x MD.xtc -npme 0 -nt $SLURM_JOB_CPUS_PER_NODE ``` -------------------------------- ### Neutralize System with phbuilder neutralize Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Use `phbuilder neutralize` to add ions for net-neutrality at t=0 and buffer particles to maintain neutrality for t>0. This is a crucial step for CpHMD simulations. ```bash phbuilder neutralize -f solvated.pdb ``` -------------------------------- ### Generate CpHMD Parameters with phbuilder Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Use `phbuilder genparams` to create the necessary `.mdp` and `.ndx` files for CpHMD simulations. Specify the input PDB file and the target pH. This command generates default files for energy minimization, NVT, NPT, and MD, along with an index file. ```bash phbuilder genparams -f phneutral.pdb -ph 4.0 ``` -------------------------------- ### Neutralize System with Specific Ion Concentration and Buffers Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Use `phbuilder neutralize` with `-conc` and `-nbufs` flags to specify the desired ion concentration and number of buffer particles for system neutralization. ```bash phbuilder neutralize -f solvated.pdb -conc 0.15 -nbufs 20 ``` -------------------------------- ### Generate Titration Parameters with phbuilder Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md When setting up for titrations, use the `-titr` option with `phbuilder genparams`. This flags the pH value as a string 'ph' and sets up pH-dependent parameters, which are then utilized by `create_titration.py`. ```bash phbuilder genparams -f phneutral.pdb -ph 4.0 -titr ``` -------------------------------- ### Production CpHMD Simulation with GROMACS Source: https://context7.com/gromacs-constantph/phbuilder/llms.txt Prepare the production run input with 'gmx grompp' and execute the simulation using 'gmx mdrun'. The '-x' flag outputs the trajectory file. ```bash gmx grompp -f MD.mdp -c NPT.pdb -p topol.top -n index.ndx -o MD.tpr ``` ```bash gmx mdrun -v -deffnm MD -c MD.pdb -x MD.xtc -npme 0 ``` -------------------------------- ### Generate CpHMD Topology with phbuilder Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Use `phbuilder gentopol` to (re)generate the CpHMD topology. Manually choose titratable residues and their initial protonation states. ```bash phbuilder gentopol -f input.pdb ``` -------------------------------- ### Generate CpHMD .mdp and .ndx files with phbuilder genparams Source: https://context7.com/gromacs-constantph/phbuilder/llms.txt Generates CpHMD-specific GROMACS parameters and MDP files. Use standard usage for typical production runs, or specify custom MDP files and existing index files. Options allow for changing lambda output frequency, bias barrier height, and interactive residue-specific bias settings. Supports titration and calibration modes. ```bash # Standard usage — generate all .mdp files for production at pH 7.0 phbuilder genparams -f phneutral.pdb -ph 7.0 ``` ```bash # Use an existing hand-crafted MD.mdp (only the CpHMD block is appended) phbuilder genparams -f phneutral.pdb -ph 7.0 -mdp custom_MD.mdp ``` ```bash # Append CpHMD index groups to an existing index file phbuilder genparams -f phneutral.pdb -ph 7.0 -ndx my_index.ndx ``` ```bash # Change lambda output frequency and bias barrier height phbuilder genparams -f phneutral.pdb -ph 4.0 -nstout 250 -dwpE 5.0 ``` ```bash # Set bias barrier interactively per residue phbuilder genparams -f phneutral.pdb -ph 7.0 -inter ``` ```bash # Titration mode — leave pH token as string "ph" for create_titration.py phbuilder genparams -f phneutral.pdb -ph 4.0 -titr ``` ```bash # Calibration mode — forces on λ are computed but positions not updated phbuilder genparams -f phneutral.pdb -ph 4.0 -cal ``` -------------------------------- ### Enable argcomplete for phbuilder Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Enable shell tab-completion for phbuilder using argcomplete. This command should be run once per user. Reload your terminal after running this command for changes to take effect. ```bash activate-global-python-argcomplete --user ``` -------------------------------- ### Perform Equilibration with Gromacs Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md This script performs energy minimization and equilibration steps using Gromacs. It requires the generated `.mdp` files, topology, and index files. Ensure the GMXRC environment script is sourced before execution. ```bash #!/bin/bash source /usr/local/gromacs_constantph/bin/GMXRC gmx grompp -f EM.mdp -c phneutral.pdb -p topol.top -n index.ndx -o EM.tpr -maxwarn 1 gmx mdrun -v -deffnm EM -c EM.pdb -npme 0 gmx grompp -f NVT.mdp -c EM.pdb -p topol.top -n index.ndx -o NVT.tpr gmx mdrun -v -deffnm NVT -c NVT.pdb -npme 0 gmx grompp -f NPT.mdp -c NVT.pdb -p topol.top -n index.ndx -o NPT.tpr gmx mdrun -v -deffnm NPT -c NPT.pdb -npme 0 ``` -------------------------------- ### Add Ions and Buffer Particles with phbuilder neutralize Source: https://context7.com/gromacs-constantph/phbuilder/llms.txt Employ `phbuilder neutralize` to determine system charge at the CpHMD level, add ions for neutralization, and include virtual buffer particles for charge fluctuation absorption. This tool internally calls `gmx grompp` and `gmx genion`. Ensure the GROMACS CpHMD beta is sourced. ```bash # Minimal usage — auto-compute required ions and buffers phbuilder neutralize -f solvated.pdb ``` ```bash # Set a target NaCl concentration of 0.15 mol/L, place ions ≥1.2 nm from solute phbuilder neutralize -f solvated.pdb -conc 0.15 -rmin 1.2 ``` ```bash # Manually specify exactly 20 buffer particles phbuilder neutralize -f solvated.pdb -nbufs 20 ``` ```bash # Parameterization setup: one buffer, kept far from ligand phbuilder neutralize -f solvated.pdb -nbufs 1 -rmin 1.5 -conc 0.15 ``` ```bash # Use a non-standard solvent name and custom ion names phbuilder neutralize -f solvated.pdb -solname HOH -pname POT -nname CLA ``` ```bash # Ignore grompp warnings (useful when building non-standard systems) phbuilder neutralize -f solvated.pdb -ignw ``` -------------------------------- ### Neutralize System with phbuilder neutralize Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md This command adds ions and buffer particles to ensure a net-neutral system at t=0 and maintain neutrality at t>0. It handles charge absorption by buffer particles and supports custom ion types. Note that it only adds ions and does not reduce existing ion concentrations. ```bash phbuilder neutralize [-h] -f FILE [-p TOPOL] [-o OUTPUT] [-solname SOLNAME] [-pname PNAME] [-nname NNAME] [-conc CONC] [-nbufs NBUFS] [-rmin RMIN] [-ignw] [-v] ``` -------------------------------- ### Smart CpHMD equilibration continuation with EQ_smart.py Source: https://context7.com/gromacs-constantph/phbuilder/llms.txt Utility script to bridge equilibration stages by transferring final λ-coordinates. This prevents artificial charge jumps and is recommended for slowly-relaxing systems. Requires MDAnalysis to identify titratable residues. ```bash # Transfer final lambda values from NVT run into NPT.mdp python EQ_smart.py NVT NPT ``` ```bash # Transfer final lambda values from NPT run into MD.mdp python EQ_smart.py NPT MD ``` -------------------------------- ### Extract dV/dλ from simulation runs Source: https://context7.com/gromacs-constantph/phbuilder/llms.txt Iterates through simulation directories and uses `gmx cphmd` to extract dV/dλ values. Ensure you are in the correct project directory before running. ```bash for dir in r_*/; do (cd "$dir" && gmx cphmd -s run.tpr -e run.edr -dvdl --coordinate no) done ``` -------------------------------- ### Access and Modify PDB Structure Source: https://context7.com/gromacs-constantph/phbuilder/llms.txt Demonstrates accessing box dimensions, modifying residue names and properties, and writing back to a PDB file. Also shows loading a GRO file and counting residues. ```python box = pdb.d_box print(f"Box: {box.d_a:.2f} x {box.d_b:.2f} x {box.d_c:.2f} Å") # Box: 65.00 x 65.00 x 65.00 Å # Modify a residue name (e.g. rename ASP → ASPT for CpHMD) for residue in pdb.d_residues: if residue.d_resname == 'ASP': residue.d_resname = 'ASPT' residue.d_init = '1' # start deprotonated # Write back to PDB (also writes phrecord.dat) pdb.write('phprocessed.pdb') # Load a GRO file gro = Structure('system.gro', verbosity=2) # Count residues by name from collections import Counter counts = Counter(r.d_resname for r in gro.d_residues) print(counts) # Counter({'SOL': 8500, 'ASPT': 4, 'GLUT': 2, 'NA': 10, 'CL': 8, 'BUF': 13}) ``` -------------------------------- ### Generate Parameters with phbuilder genparams Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Generates CpHMD-specific .mdp and .ndx files for CHARMM36m. It appends CpHMD parameters to generic EM.mdp, EQ.mdp, and MD.mdp files. This command requires a phrecord.dat file, typically created by gentopol. ```bash phbuilder genparams [-h] -f FILE -ph PH [-mdp MDP] [-ndx NDX] [-nstout NSTOUT] [-dwpE DWPE] [-inter] [-titr] [-cal] [-v] ``` -------------------------------- ### Generate CpHMD Topology with phbuilder gentopol Source: https://context7.com/gromacs-constantph/phbuilder/llms.txt Use `phbuilder gentopol` to rename titratable residues, assign initial lambda states, and regenerate topologies for CpHMD simulations. The `-ph` flag enables automatic lambda assignment based on pH and pKa. Use `-groups` to specify which residue types are titratable. ```bash # Interactive mode — user chooses protonation state for each residue phbuilder gentopol -f input.pdb ``` ```bash # Automatic mode — initial lambdas set by pH vs pKa criterion phbuilder gentopol -f input.pdb -ph 4.0 ``` ```bash # Restrict to only Asp and Glu phbuilder gentopol -f input.pdb -ph 7.0 -groups "ASPT GLUT" ``` ```bash # Use a custom output file name and verbose output phbuilder gentopol -f input.pdb -ph 7.0 -o my_processed.pdb -v ``` ```bash # After gentopol, add a periodic box and solvate (standard GROMACS steps) gmx editconf -f phprocessed.pdb -o box.pdb -bt cubic -d 1.5 gmx solvate -cp box.pdb -p topol.top -o solvated.pdb ``` -------------------------------- ### MDP File Calibration Setting Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md When the -cal flag is used with phbuilder genparams, this setting is added to the .mdp files to enable force computation for lambda-coordinates during parameterization. ```text lambda-dynamics-calibration = yes ``` -------------------------------- ### Extracting Lambda-Coordinate Trajectories with GROMACS Source: https://context7.com/gromacs-constantph/phbuilder/llms.txt Use 'gmx cphmd' to extract lambda-coordinate trajectories from the simulation's energy file. This generates .xvg files, one for each titratable site or state. ```bash gmx cphmd -s MD.tpr -e MD.edr -numplot 1 ``` -------------------------------- ### Modify lambdagrouptypes.dat for Arginine Parameterization Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md This configuration snippet is for the lambdagrouptypes.dat file. It defines parameters for titratable arginine (ARGT), including its atoms, charges in different protonation states, and pKa. Note that dvdl_1 is set to zero for parameterization. ```ini [ GROMACS ] path = /usr/local/gromacs_constantph [ FORCEFIELD ] name = charmm36-mar2019-cphmd.ff water = tip3p [ ARGT ] incl = ARG atoms = CD NE HE CZ NH1 HH11 HH12 NH2 HH21 HH22 qqA = 0.20 -0.70 0.44 0.64 -0.80 0.46 0.46 -0.80 0.46 0.46 pKa_1 = 10.7 qqB_1 = -0.11 -0.54 0.36 0.59 -0.91 0.37 0.00 -0.60 0.33 0.33 dvdl_1 = 0.0 [ BUF ] range = -0.50 0.50 dvdl = 823.85 -2457.8 2172.2 -144.05 -1289 576.74 ``` -------------------------------- ### ARGT Entry in merged.rtp Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Create an entry for the titratable residue (e.g., ARGT) in the 'merged.rtp' file. This is typically done by copying an existing similar residue's entry (e.g., ARG) and modifying the name. The topology must correspond to the most protonated state. ```text [ ARGT ] ; titratable ARG [ atoms ] N NH1 -0.470 0 HN H 0.310 1 CA CT1 0.070 2 HA HB1 0.090 3 CB CT2 -0.180 4 etc. ``` -------------------------------- ### Perform CpHMD Production Simulation with Gromacs Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Execute the CpHMD production run using Gromacs. This script requires the `MD.mdp` file and the equilibrated system's checkpoint file. Ensure the GMXRC environment script is sourced. ```bash #!/bin/bash source /usr/local/gromacs_constantph/bin/GMXRC gmx grompp -f MD.mdp -c NPT.pdb -p topol.top -n index.ndx -o MD.tpr gmx mdrun -v -deffnm MD -c MD.pdb -x MD.xtc -npme 0 ``` -------------------------------- ### Phbuilder Default Configuration Path Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md This path indicates where phbuilder looks for default configuration files like lambdagrouptypes.dat and residuetypes.dat. Ensure your working directory has copies of these files to override defaults. ```text /path/to/python3.11/site-packages/phbuilder/ffield/ ``` -------------------------------- ### Extract dVdl Values with gmx cphmd Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Use this command after parameterization simulations to extract dVdl values. The output file contains dVdl values in the second column. ```bash gmx cphmd -s run.tpr -e run.edr -dvdl --coordinate no ``` -------------------------------- ### Atoms Section in Ligand .itp File Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md When providing a separate .itp file for a titratable ligand, the names in the [ atoms ] section should reflect the titratable name of the residue. Ensure correct atom type, residue number, residue name, atom name, charge, and mass are specified. ```text [ atoms ] ; nr type resnr residu atom cgnr charge mass 17 NH1 3 ARGT N 13 -0.47 14.007 etc. ``` -------------------------------- ### Parse and write coordinate files with Structure class Source: https://context7.com/gromacs-constantph/phbuilder/llms.txt The Structure class from phbuilder.structure parses .pdb and .gro files, representing the system as a list of Residue objects. It also handles reading and writing 'phrecord.dat' to maintain initial lambda values. Each Residue object stores atom names, coordinates, chain, and the d_init field for lambda records. ```python from phbuilder.structure import Structure, Residue # Load a PDB file (also reads phrecord.dat if present) pdb = Structure('input.pdb', verbosity=2) ``` ```python # Inspect residues for residue in pdb.d_residues: print(f"{residue.d_resname}-{residue.d_resid} chain {residue.d_chain} " f ``` -------------------------------- ### Add ARGT to residuetypes.dat Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md To make the topology of a new titratable residue type (e.g., ARGT) available, append its name and type (e.g., 'Protein') to the 'residuetypes.dat' file. ```text ARGT Protein ``` -------------------------------- ### ARGT Entry in merged.hdb Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md Ensure an entry for the titratable residue (e.g., ARGT) exists in the 'merged.hdb' file. Similar to 'merged.rtp', this can be done by copying and modifying an existing entry (e.g., for ARG). ```text ARGT 8 1 1 HN N -C CA 1 5 HA CA N C CB 2 6 HB CB CG CA 2 6 HG CG CD CB 2 6 HD CD NE CG 1 1 HE NE CD CZ 2 3 HH1 NH1 CZ NE 2 3 HH2 NH2 CZ NE ``` -------------------------------- ### Position Restraining Section in .itp File Source: https://gitlab.com/gromacs-constantph/phbuilder/-/blob/main/README.md A position restraining section should be included at the end of the .itp file for the titratable ligand, typically using an #ifdef POSRES directive to include 'posre.itp'. ```text #ifdef POSRES #include "posre.itp" #endif ``` -------------------------------- ### Access Parsed Lambda Types Programmatically Source: https://context7.com/gromacs-constantph/phbuilder/llms.txt Illustrates how to access the parsed `LambdaType` objects from the `phbuilder` instance to retrieve titratable group parameters. ```python # Access parsed lambda types programmatically (after phbuilder init) # (Shown here as pseudo-code illustrating the internal data structure) for lt in builder.ph_lambdaTypes: print(f"group={lt.d_groupname} incl={lt.d_incl} pKa={lt.d_pKa}") print(f" qqA={lt.d_qqA}") print(f" qqB={lt.d_qqB} dvdl={lt.d_dvdl}") # group=ASPT incl=['ASP', 'ASPH'] pKa=['3.65'] # qqA=[-0.18, 0.09, 0.09, 0.62, -0.76, -0.76, 0.44] # qqB=[[-0.28, 0.09, 0.09, 0.62, -0.76, -0.76, 0.0]] # dvdl=[[24.685, -109.72, 204.27, -187.68, 75.472, -7.2018]] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.