phbuilder 1.3__tar.gz → 1.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. {phbuilder-1.3 → phbuilder-1.5}/PKG-INFO +157 -158
  2. {phbuilder-1.3 → phbuilder-1.5}/README.md +146 -154
  3. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/__init__.py +6 -1
  4. phbuilder-1.5/phbuilder/calibration.py +69 -0
  5. phbuilder-1.5/phbuilder/ffield/README.md +13 -0
  6. phbuilder-1.5/phbuilder/ffield/amber14sb-lambdagrouptypes.dat +73 -0
  7. phbuilder-1.5/phbuilder/ffield/amber14sb-residuetypes.dat +217 -0
  8. phbuilder-1.5/phbuilder/ffield/amber14sb_mod.ff/aminoacids.c.tdb +1 -0
  9. phbuilder-1.5/phbuilder/ffield/amber14sb_mod.ff/aminoacids.hdb +566 -0
  10. phbuilder-1.5/phbuilder/ffield/amber14sb_mod.ff/aminoacids.n.tdb +1 -0
  11. phbuilder-1.5/phbuilder/ffield/amber14sb_mod.ff/aminoacids.r2b +32 -0
  12. phbuilder-1.5/phbuilder/ffield/amber14sb_mod.ff/aminoacids.rtp +3988 -0
  13. phbuilder-1.5/phbuilder/ffield/amber14sb_mod.ff/atomtypes.atp +376 -0
  14. phbuilder-1.5/phbuilder/ffield/amber14sb_mod.ff/ffbonded.itp +1404 -0
  15. phbuilder-1.5/phbuilder/ffield/amber14sb_mod.ff/ffnonbonded.itp +380 -0
  16. phbuilder-1.5/phbuilder/ffield/amber14sb_mod.ff/forcefield.doc +16 -0
  17. phbuilder-1.5/phbuilder/ffield/amber14sb_mod.ff/forcefield.itp +23 -0
  18. phbuilder-1.5/phbuilder/ffield/amber14sb_mod.ff/ions.itp +572 -0
  19. phbuilder-1.5/phbuilder/ffield/amber14sb_mod.ff/tip3p.itp +34 -0
  20. phbuilder-1.5/phbuilder/ffield/amber14sb_mod.ff/watermodels.dat +1 -0
  21. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/merged.c.tdb +1 -1
  22. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/merged.hdb +5 -0
  23. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/merged.rtp +31 -0
  24. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/lambdagrouptypes.dat +8 -0
  25. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/residuetypes.dat +1 -0
  26. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/mdp.py +52 -26
  27. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/parsecmdline.py +46 -25
  28. phbuilder-1.5/phbuilder/phbuilder.py +1072 -0
  29. phbuilder-1.5/phbuilder/pka.py +31 -0
  30. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/sanitize.py +31 -57
  31. phbuilder-1.5/phbuilder/structure.py +402 -0
  32. phbuilder-1.5/phbuilder/termini.py +22 -0
  33. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/user.py +39 -28
  34. {phbuilder-1.3 → phbuilder-1.5}/phbuilder.egg-info/PKG-INFO +157 -158
  35. phbuilder-1.5/phbuilder.egg-info/SOURCES.txt +122 -0
  36. phbuilder-1.5/phbuilder.egg-info/requires.txt +12 -0
  37. {phbuilder-1.3 → phbuilder-1.5}/phbuilder.egg-info/top_level.txt +0 -1
  38. phbuilder-1.5/pyproject.toml +14 -0
  39. {phbuilder-1.3 → phbuilder-1.5}/setup.cfg +13 -4
  40. phbuilder-1.5/tests/test_configuration.py +74 -0
  41. phbuilder-1.5/tests/test_genparams.py +89 -0
  42. phbuilder-1.5/tests/test_gentopol.py +50 -0
  43. phbuilder-1.5/tests/test_neutralize.py +102 -0
  44. phbuilder-1.5/tests/test_sanitize.py +44 -0
  45. phbuilder-1.5/tests/test_scripts.py +244 -0
  46. phbuilder-1.5/tests/test_solvent_cleanup.py +36 -0
  47. phbuilder-1.5/tests/test_structure.py +90 -0
  48. phbuilder-1.5/tests/test_termini.py +51 -0
  49. phbuilder-1.5/tests/test_workflow.py +139 -0
  50. phbuilder-1.3/phbuilder/ffield/README.md +0 -14
  51. phbuilder-1.3/phbuilder/phbuilder.py +0 -1467
  52. phbuilder-1.3/phbuilder/structure.py +0 -334
  53. phbuilder-1.3/phbuilder.egg-info/SOURCES.txt +0 -52
  54. phbuilder-1.3/phbuilder.egg-info/requires.txt +0 -4
  55. phbuilder-1.3/pyproject.toml +0 -8
  56. phbuilder-1.3/tests/__init__.py +0 -0
  57. phbuilder-1.3/tests/test_genparams.py +0 -46
  58. phbuilder-1.3/tests/test_gentopol.py +0 -32
  59. phbuilder-1.3/tests/test_neutralize.py +0 -18
  60. phbuilder-1.3/tests/testutils.py +0 -47
  61. {phbuilder-1.3 → phbuilder-1.5}/LICENSE +0 -0
  62. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/atomtypes.atp +0 -0
  63. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/cmap.itp +0 -0
  64. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/ffbonded.itp +0 -0
  65. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/ffnonbonded.itp +0 -0
  66. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/forcefield.doc +0 -0
  67. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/forcefield.itp +0 -0
  68. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/gb.itp +0 -0
  69. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/ions.itp +0 -0
  70. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/merged.arn +0 -0
  71. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/merged.n.tdb +0 -0
  72. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/merged.r2b +0 -0
  73. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/merged.vsd +0 -0
  74. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/nbfix.itp +0 -0
  75. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/old_c36_cmap.itp +0 -0
  76. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/popc.itp +0 -0
  77. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/spc.itp +0 -0
  78. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/spce.itp +0 -0
  79. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/tip3p.itp +0 -0
  80. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/tip4p.itp +0 -0
  81. {phbuilder-1.3 → phbuilder-1.5}/phbuilder/ffield/charmm36-mar2019-cphmd.ff/watermodels.dat +0 -0
  82. {phbuilder-1.3 → phbuilder-1.5}/phbuilder.egg-info/dependency_links.txt +0 -0
  83. {phbuilder-1.3 → phbuilder-1.5}/phbuilder.egg-info/entry_points.txt +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: phbuilder
3
- Version: 1.3
3
+ Version: 1.5
4
4
  Summary: System builder for constant-pH simulations in GROMACS.
5
5
  Home-page: https://gitlab.com/gromacs-constantph/phbuilder
6
6
  Author: Anton Jansen
@@ -17,9 +17,16 @@ Requires-Python: >=3.8
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
19
  Requires-Dist: argcomplete>=3.1.1
20
- Requires-Dist: configparser>=6.0.0
21
- Requires-Dist: sympy>=1.12
22
20
  Requires-Dist: numpy
21
+ Provides-Extra: analysis
22
+ Requires-Dist: matplotlib; extra == "analysis"
23
+ Requires-Dist: MDAnalysis; extra == "analysis"
24
+ Provides-Extra: test
25
+ Requires-Dist: pytest; extra == "test"
26
+ Requires-Dist: pytest-cov; extra == "test"
27
+ Requires-Dist: matplotlib; extra == "test"
28
+ Requires-Dist: MDAnalysis; extra == "test"
29
+ Dynamic: license-file
23
30
 
24
31
  <div style="width: 830px">
25
32
 
@@ -43,6 +50,9 @@ For the publication associated with phbuilder, please see:
43
50
  * [phbuilder: A Tool for Efficiently Setting up Constant pH Molecular Dynamics Simulations in GROMACS](https://pubs.acs.org/doi/full/10.1021/acs.jcim.3c01313).
44
51
  * For examples of CpHMD simulation set up with phbuilder, have a look at the publication's [simulation input files](https://zenodo.org/doi/10.5281/zenodo.10468944).
45
52
 
53
+ For the cysteine implementation, please see:
54
+ * [Implementation and Validation of Titratable Cysteine in GROMACS-Based Constant-pH Molecular Dynamics](https://pubs.acs.org/doi/full/10.1021/acs.jctc.6c00640).
55
+
46
56
  # Table of contents
47
57
 
48
58
  1. [Installation](#installation)
@@ -51,52 +61,33 @@ For the publication associated with phbuilder, please see:
51
61
  4. [Performing Titrations](#performing-titrations)
52
62
  5. [Performing Parameterizations](#performing-parameterizations)
53
63
  6. [Running CpHMD simulations on HPC resources](#running-cphmd-simulations-on-hpc-resources)
54
- 7. [Synopsis `phbuilder gentopol`](#synopsis-phbuilder-gentopol)
55
- 8. [Synopsis `phbuilder neutralize`](#synopsis-phbuilder-neutralize)
56
- 9. [Synopsis `phbuilder genparams`](#synopsis-phbuilder-genparams)
57
- 10. [Tips, Tricks, and FAQ](#tips-tricks-and-faq)
64
+ 7. [Command-line reference](#command-line-reference)
65
+ 8. [Troubleshooting and analysis](#troubleshooting-and-analysis)
66
+ 9. [Testing](#testing)
58
67
 
59
68
  # Installation
60
69
 
61
- 1. To enable GPU acceleration, make sure you first install [CUDA](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#pre-installation-actions).
62
-
63
- 2. Download the [gromacs-constantph](https://gitlab.com/gromacs-constantph/constantph/) beta.
64
-
65
- 3. Build and install using the instructions [here](https://manual.gromacs.org/current/install-guide/index.html). Suggested CMake command:
66
- ```
67
- cmake .. -DGMX_BUILD_OWN_FFTW=ON -DGMX_GPU=CUDA -DGMX_USE_RDTSCP=ON -DCMAKE_INSTALL_PREFIX=/usr/local/gromacs_constantph
68
- ```
69
-
70
- NOTE: if you run into compilation issues, GCC 10.2 and CUDA 11.2.1 have been proven to work.
70
+ Build the [constant-pH GROMACS fork](https://gitlab.com/gromacs-constantph/constantph/) using its source tree. The commands below build a CPU-only installation for setup and small simulations.
71
71
 
72
- NOTE: running `make check` will give multiple failures. This is to be expected for the CpHMD beta. It is recommended to skip `make check`.
73
-
74
- NOTE: it is the responsibility of the user to make sure the GROMACS constant-pH install is correctly sourced / loaded in the user environment when running phbuilder. `gentopol` and `genparams` will probably work with a normal GROMACS install as well, but the constant-pH install MUST be active in order for `neutralize` to work correctly.
75
-
76
- 4. Install phbuilder:
77
- ```
78
- pip install phbuilder
79
- ```
72
+ ```sh
73
+ cmake -S gromacs-constantph -B build -DGMX_GPU=OFF -DGMX_BUILD_OWN_FFTW=ON
74
+ cmake --build build --parallel
75
+ cmake --install build --prefix "$HOME/.local/opt/gromacs-constantph"
76
+ source "$HOME/.local/opt/gromacs-constantph/bin/GMXRC"
77
+ gmx cphmd -h
78
+ ```
80
79
 
81
- NOTE: Python 3.8 or newer is required.
80
+ For an Apple Silicon CPU build without an OpenMP toolchain, configure with `-DGMX_OPENMP=OFF`. Use the [fork manual](https://gitlab.com/gromacs-constantph/constantph/-/tree/main/manual) for engine-specific settings. Keep the fork on `PATH` when running `neutralize` and when preprocessing or running CpHMD.
82
81
 
83
- 5. phbuilder has [argcomplete](https://pypi.org/project/argcomplete/) functionality. To make sure this works, run:
84
- ```
85
- activate-global-python-argcomplete --user
86
- ```
87
- once and reload your terminal.
82
+ Install the released package with `python -m pip install phbuilder`. To work from this checkout, run `python -m pip install -e '.[analysis]'` from the repository root. The core CLI requires Python 3.8 or later. The analysis extra installs MDAnalysis and Matplotlib for the repository scripts. For optional shell completion, run `activate-global-python-argcomplete --user` and restart your shell.
88
83
 
89
84
  # Description
90
85
 
91
86
  phbuilder is a command line tool that automates setting up constant-pH (CpHMD) simulations in [GROMACS](https://www.gromacs.org/). phbuilder consists of three (sub)tools: `gentopol`, `neutralize`, and `genparams`. Each tool fulfills a specific function in the setup process. `gentopol` allows you to select which residues to make titratable and which initial lambda (protonation) state they should have. `gentopol` also (re)generates the system topology using the modified CHARMM36m CpHMD force field ([why?](https://pubs.acs.org/doi/full/10.1021/acs.jctc.2c00517)). `neutralize` adds the appropriate number of ions and buffer particles to ensure a net-neutral simulation, and `genparams` generates the CpHMD-specific `.mdp` and `.ndx` files. Functionality for setting up titration and parameterization is also provided with the help of included stand-alone Python scripts.
92
87
 
93
- Out of the box, phbuilder comes with the force field and CpHMD topology parameters required for setting up titratable Asp, Glu, Arg, Lys, and His residues in CHARMM36m. The force field modifications and parameterization for Asp, Glu, Lys, and His are described in our previous GROMACS CpHMD publications, while the (single-site) parameterization for Arg is described in the phbuilder paper. The modified force field, together with the global phbuilder parameter file `lambdagrouptypes.dat` are placed in the Python package directory
94
-
95
- ```
96
- /path/to/python3.xx/site-packages/phbuilder/ffield/
97
- ```
88
+ The default CHARMM36m profile supports Asp, Glu, Arg, Lys, His and selected Cys residues. The optional AMBER ff14SB profile covers Asp, Glu, His, Lys, Tyr and selected Cys with TIP3P water. Add `--force-field amber14sb` to **each** of `gentopol`, `neutralize` and `genparams` in the same system directory. The Amber profile uses the benchmark nonbonded settings for freshly generated MDPs. Use a separate working directory for each force field. [Parameter provenance](phbuilder/ffield/README.md) · [ff14SB benchmark](https://doi.org/10.1021/acs.jctc.6c00678) · [GitLab #39](https://gitlab.com/gromacs-constantph/phbuilder/-/issues/39)
98
89
 
99
- upon installation. By default, phbuilder copies and uses the force field and `lambdagrouptypes.dat` file from this location to the relevant working directory. It is strongly recommended to not modify these default files. Instead, if you wants to set up CpHMD simulations using a modified force field or `lambdagrouptypes.dat` file (e.g. when parameterizing a new lambdagrouptype), you can simply place modified versions of these files in your working directory, and the local files will override the default ones.
90
+ For a custom force field, pass `--lambda-types /path/to/lambdagrouptypes.dat` to all three commands, or put `lambdagrouptypes.dat` in the command's working directory. Each command prints the resolved parameter-file path, force field and water model. Set the force field `name` and `water` in `[ FORCEFIELD ]`. Put the matching `.ff` directory and `residuetypes.dat` in the working directory or specify their paths in the config. For each titratable group, list atoms in the **same order** as every charge array. An optional `[ MDP ]` section sets standard GROMACS defaults for newly generated MDPs. [GitLab #38](https://gitlab.com/gromacs-constantph/phbuilder/-/issues/38)
100
91
 
101
92
  # Basic Workflow
102
93
 
@@ -106,13 +97,14 @@ This is an important step, and it applies especially to structures that are stra
106
97
  * Make sure your structure adheres to the proper [PDB format](https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html), only contains one MODEL, does not contain alternate location indicators, does not miss atoms or residues, etc.
107
98
  * Basically, if you cannot use your structure to successfully set up normal MD simulations with GROMACS, you should first make sure this works before continuing.
108
99
  * It is also important that your molecules(s) containing the titratable groups are *at the top* of the structure file. So first the titratable protein(s), and only then solvent, ions, lipids, etc.
109
- * Furthermore, it is recommended that every (non-ion / water) molecule has a chain identifier. If you have only one chain you can simply set everything to A.
100
+ * Give each peptide chain a one-character PDB ID in column 22 and put a `TER` record after each chain. For large assemblies, nonconsecutive chains can reuse IDs with explicit `TER` boundaries. A two-character ID shifts the residue-number columns and causes a format error. Keep the chain order when editing coordinates and `phrecord.dat`. [GitLab #49](https://gitlab.com/gromacs-constantph/phbuilder/-/issues/49)
101
+ * Use the residue name `CYST` for titratable cysteine. [cysteine_preparation.py](scripts/cysteine_preparation.py) renames selected residues and can exclude pairs close enough to form a disulfide. With `--all`, the script keeps detected pairs as ordinary cysteines.
110
102
 
111
103
  ### 2. Make sure that topologies are available for all moleculetypes present in your structure file.
112
104
 
113
105
  phbuilder cannot provide topology information for non-standard residue types (those not present in `residuetypes.dat`). In such cases, the user has two options:
114
106
 
115
- 1. **Make sure you have a separate `.itp` file.** If `gentopol` detects any non-standard residue types, it will ask the user to provide a path to the corresponding `.itp` file(s). Internally, phbuilder splits the input structure file into a standard and a non-standard part, and only run `gmx pdb2gmx` on the standard part. Note that despite providing a separate `.itp` file, you might still have to make additions to the force field. This possibly includes new atom, bond, pair, angle, and dihedral types not present in the standard force field, but present in the provided topology.
107
+ 1. **Make sure you have a separate `.itp` file.** If `gentopol` detects any non-standard residue types, it will ask the user to provide a path to the corresponding `.itp` file(s). phbuilder runs `gmx pdb2gmx` on the standard residues and appends the remaining molecules with their supplied topology. PDB ligands can use `HETATM` records. Include all ligand atoms, including hydrogens, in topology order. Note that despite providing a separate `.itp` file, you might still have to make additions to the force field. This possibly includes new atom, bond, pair, angle, and dihedral types not present in the standard force field, but present in the provided topology.
116
108
 
117
109
  2. **Add the non-standard residue type to the force field.** This will require making additions in the `residuetypes.dat`, `merged.rtp`, and possibly `merged.hdb` files. This will likely be more involved compared to the first option, but the advantage is that `gmx pdb2gmx` will be able to process your full structure.
118
110
 
@@ -128,21 +120,20 @@ Manually choose which residues to make titratable and in which initial state, an
128
120
 
129
121
  ```
130
122
  phbuilder gentopol -f input.pdb
131
- ```
123
+ ```
132
124
 
133
- If you don't want to manually set initial lambda values, you can use the `-ph <ph>` flag to have `gentopol` automatically choose the appropriate initial lambda values, based on the criterion: pH > pKa means start deprotonated, else start protonated.
125
+ Use `-ph` to choose starting states from the configured reference pKa values. For single-site groups, state 0 is protonated and state 1 is deprotonated. Use `-groups "ASPT GLUT"` to restrict which residue types are made titratable. The command below overrides one residue and chooses the other initial states automatically.
134
126
 
135
- ```
136
- phbuilder gentopol -f input.pdb -ph <ph>
127
+ ```sh
128
+ phbuilder gentopol -f input.pdb -ph 7.4 --state 'A:42=3'
137
129
  ```
138
130
 
139
- Furthermore, if you only want certain residue types to be made titratable, you can use the `-groups` flag. For example:
131
+ Use `_:42` for a blank chain, `A:42B` for insertion code B, and `A:42#2` for the second occurrence of a repeated identifier. Initial states are saved in `phrecord.dat`. Set them before neutralizing. If you change a state afterward, run `neutralize` again using the original solvated coordinates and their matching topology, then regenerate the MDPs. Keep a copy of the solvated topology if you plan to compare several initial states.
140
132
 
141
- ```
142
- phbuilder gentopol -f input.pdb -groups "ASPT GLUT"
143
- ```
133
+ In the default `pdb2gmx` prompts, enter `y` to create a proposed disulfide or `n` to keep that pair reduced. For unattended standard inputs, `--pdb2gmx run --disulfides auto` uses GROMACS's automatic bond selection. `--pdb2gmx skip` writes the renamed structure and state record for a manual topology workflow.
134
+
135
+ For a fixed-pH run, the protonated histidine reference is the simulation pH. This makes its pH-dependent energy offset zero. A `genparams -ph 7.4` run writes 7.4 for that reference and leaves the two neutral-state pKa values in the parameter file as configured. The shipped CHARMM36m and Amber parameters start histidine in the protonated state at pH 4 and in a neutral tautomer at pH 7.4 unless overridden. [GitLab #43](https://gitlab.com/gromacs-constantph/phbuilder/-/issues/43)
144
136
 
145
- only considers aspartate and glutamate residues for setting up the CpHMD simulation.
146
137
  ### 4. Add a periodic box and solvent (if not already present).
147
138
 
148
139
  Periodic box (see [gmx editconf](https://manual.gromacs.org/documentation/current/onlinehelp/gmx-editconf.html)):
@@ -159,15 +150,23 @@ gmx solvate -cp box.pdb -p topol.top -o solvated.pdb
159
150
 
160
151
  ### 5. (Optional) Remove incorrectly placed water molecules.
161
152
 
162
- `gmx solvate` is a relatively basic program and will by default add solvent simply based on the van der Waals radii of the solute. This can lead to water molecules being generated in locations where there should not be any (e.g. in hydrophobic pockets in your protein). It is good practice to check for this, and if this occurs in your system, we recommend you to utilize the included [clean_after_solvate.py](scripts/clean_after_solvate.py) script to clean up your system.
153
+ Inspect solvent near buried pockets or membranes. [clean_after_solvate.py](scripts/clean_after_solvate.py) removes water using positions and residue identities. Pass the matching input topology and keep the two cleaned outputs together.
154
+
155
+ ```sh
156
+ python /path/to/phbuilder/scripts/clean_after_solvate.py \
157
+ -f solvated.pdb -p topol.top -o cleaned.pdb --output-top cleaned.top
158
+ phbuilder neutralize -f cleaned.pdb -p cleaned.top
159
+ ```
160
+
161
+ The default output names are `solvated_updated.gro` and `topol_updated.top`. Use PDB output to retain chain boundaries and insertion codes. The cleaner reports how many water molecules it removed. [GitLab #35](https://gitlab.com/gromacs-constantph/phbuilder/-/issues/35) · [GitLab #42](https://gitlab.com/gromacs-constantph/phbuilder/-/issues/42)
163
162
 
164
163
  ### 6. Use `phbuilder neutralize` to ensure a net-neutral simulation system.
165
164
 
166
165
  `phbuilder neutralize` performs two tasks: it adds ions to ensure a net-neutral system at $t = 0$, and it adds buffer particles in order to maintain a net-neutral system at $t > 0$.
167
166
 
168
- Adding ions to obtain a net-neutral simulation system at $t = 0$ is not as trivial as it may first seem. When setting up a CpHMD simulation, The titratable residues in the *structure* file are always in their most protonated state as we need all titratable hydrogen atoms to be present, but the *topology* (the actual charges of the titratable residues at $t = 0$) depend on the initial lambda values, which are set during the `gentopol` step and are provided to GROMACS in the `.mdp` files.
167
+ Adding ions to obtain a net-neutral simulation system at $t = 0$ is not as trivial as it may first seem. When setting up a CpHMD simulation, the titratable residues in the *structure* file are always in their most protonated state as we need all titratable hydrogen atoms to be present, but the *topology* (the actual charges of the titratable residues at $t = 0$) depend on the initial lambda values, which are set during the `gentopol` step and are provided to GROMACS in the `.mdp` files.
169
168
 
170
- Adding buffers to maintain a net neutral system at $t > 0$ comes down to the number of buffers to be added, which depends on the number of titratable sites in the system. Each buffer particle can absorb up to $\pm0.5$ charge, which means one needs at most $2N_{\text{sites}}$ buffer particles, although you can often get away with significantly less. The amount of charge that is required to be 'absorbed' from the titratable groups is distributed evenly over all buffer particles, so if we have $-10$ charge to 'absorb' and 100 buffer particles, each buffer particle would take on a $+0.1$ charge in order to keep the system neutral (see below).
169
+ Adding buffers to maintain a net neutral system at $t > 0$ comes down to the number of buffers to be added, which depends on the number of titratable sites in the system. Each buffer particle can absorb up to $\pm0.5$ charge, and the default target is $2N_{\text{sites}}+1$ buffers. The number required for a particular system depends on its charge fluctuations. The amount of charge that is required to be 'absorbed' from the titratable groups is distributed evenly over all buffer particles, so if we have $-10$ charge to 'absorb' and 100 buffer particles, each buffer particle would take on a $+0.1$ charge in order to keep the system neutral (see below).
171
170
 
172
171
  <p align="center">
173
172
  <img src="figures/neutral.png" width="400"/>
@@ -185,16 +184,24 @@ Alternatively, if you want a specific ion concentration (mol/L) and/or a specifi
185
184
  phbuilder neutralize -f solvated.pdb -conc 0.15 -nbufs 20
186
185
  ```
187
186
 
188
- NOTE: `phbuilder neutralize` neutralizes the system by <i>adding</i> ions to the input structure, not by removing or rebalancing existing ones. This implies the final ion concentration in your output files will never be lower than the ion concentration in your input file. For this reason, you should not add any ions to your system when embedding membrane systems with e.g. CHARMM-GUI but rather let phbuilder take care of this.
187
+ The command adds ions and buffers. It retains any already present, and `-nbufs` specifies the desired total. Omit `-conc` to keep the existing salt pairs and add only counterions as needed. With `-conc`, phbuilder estimates the number of salt pairs using the input water count.
188
+
189
+ Use `-solname TIP3` for a solvent named `TIP3` in both files. If the coordinates label water as `HOH` and the topology lists molecule type `SOL`, specify both names.
190
+
191
+ ```sh
192
+ phbuilder neutralize -f cleaned.pdb -p cleaned.top -solname HOH -solmol SOL
193
+ ```
194
+
195
+ The solvent must occupy a contiguous block in the coordinates and appear once under `[ molecules ]` with the matching count. The command reports missing solvent, topology/count mismatches, and residual charge. If ion replacement exhausts suitable solvent, check the box and the minimum replacement distance `-rmin` in nm. The measured charge comes from `grompp` using the CpHMD endpoint charges in the generated MDP and the saved lambda states. [GitLab #44](https://gitlab.com/gromacs-constantph/phbuilder/-/issues/44) · [GitLab #42](https://gitlab.com/gromacs-constantph/phbuilder/-/issues/42) · [GitLab #38](https://gitlab.com/gromacs-constantph/phbuilder/-/issues/38)
189
196
 
190
197
  ### 7. Use `phbuilder genparams` to generate the `.mdp` and `.ndx` files required for CpHMD.
191
198
 
192
199
  At this point, if everything went correctly both your structure and topology file(s) should be completed and constitute a net-neutral system when running CpHMD. What is now left is the actual simulation part: energy minimization, equilibration and production using the correct CpHMD parameters.
193
200
 
194
- Generate the `.mdp` files for EM/EQ/MD, including the CpHMD parameters for a specific simulation pH:
201
+ Generate the `.mdp` files for minimization, equilibration and production, including the CpHMD parameters for a specific simulation pH:
195
202
 
196
203
  ```
197
- phbuilder genparams -f phneutral.pdb -ph 4.0
204
+ phbuilder genparams -f phneutral.pdb -ph 4.0
198
205
  ```
199
206
 
200
207
  By default, the following files will be written:
@@ -204,11 +211,11 @@ By default, the following files will be written:
204
211
  * `MD.mdp`
205
212
  * `index.ndx`
206
213
 
207
- NOTE: If you previously used the auto feature (`-ph` flag) for `gentopol`, the pH you specify for `genparams` should be equal to this.
214
+ `genparams` also writes `lambdareference.dat`. Use `-mdp` to preserve standard parameters in a custom production MDP and refresh its CpHMD keys. Use `-ndx` to add the generated lambda groups to an existing index while keeping other groups. When comparing pH values, confirm that the initial states used for neutralization still match `phrecord.dat`.
208
215
 
209
- ### 8. Check the generated files and modify parameters specific to your system as required.
216
+ ### 8. Check the generated files and modify parameters specific to your system as required.
210
217
 
211
- The `.mdp` files generated by `genparams` are generic files for CHARMM36m. They should work for basic simulations, but for advanced stuff like semi-isotropic pressure coupling for membranes, pull code, AWH, more gradual equilibration, etc. you should modify these generic files accordingly. Also note that by default no position restraints are used for the protein during NVT and NPT coupling.
218
+ The generated `.mdp` files are starting points. CpHMD production requires the leapfrog `integrator = md` in this fork. With other integrators, such as `sd`, the fork can set initial charges but does not advance the lambda coordinates. Steepest descent remains suitable for minimization. They should work for basic simulations, but for advanced stuff like semi-isotropic pressure coupling for membranes, pull code, AWH, more gradual equilibration, etc. you should modify these generic files accordingly. Also note that by default no position restraints are used for the protein during NVT and NPT coupling.
212
219
 
213
220
  ### 9. Perform equilibration.
214
221
 
@@ -238,20 +245,54 @@ gmx grompp -f MD.mdp -c NPT.pdb -p topol.top -n index.ndx -o MD.tpr
238
245
  gmx mdrun -v -deffnm MD -c MD.pdb -x MD.xtc -npme 0
239
246
  ```
240
247
 
241
- ### 11. Extract the trajectories of the lambda-coordinates.
248
+ Append to the original run when restarting from a checkpoint.
249
+
250
+ ```sh
251
+ gmx mdrun -deffnm MD -cpi MD.cpt -append
252
+ ```
253
+
254
+ Keep the original output files alongside the checkpoint. This fork can produce unreadable later EDR parts with `-noappend`. For lambda analysis use the appended EDR; the issue also affects `gmx energy` for those parts. [GitLab #37](https://gitlab.com/gromacs-constantph/phbuilder/-/issues/37) · [Fork manual](https://gitlab.com/gromacs-constantph/constantph/-/blob/main/manual/constantph_usage.md)
255
+
256
+ ### 11. Extract the lambda trajectories.
242
257
 
243
258
  After the CpHMD simulation is completed one can extract the $\lambda$-coordinate trajectories from the `.edr` file in the form of readable `.xvg` files using the following command:
244
259
 
245
260
  ```
246
- gmx cphmd -s MD.tpr -e MD.edr -numplot 1
261
+ gmx cphmd -s MD.tpr -e MD.edr -o lambda.xvg -numplot 1
247
262
  ```
248
263
 
264
+ The filenames match `lambdareference.dat` when you use `-o lambda.xvg -numplot 1`. Each data row contains the time and one lambda coordinate. For CHARMM36m `HSPT` and AMBER `HIPT`, the three consecutive coordinates are constrained to sum to one.
265
+
266
+ | Coordinate within a histidine site | CHARMM36m / Amber state | Interpretation |
267
+ | --- | --- | --- |
268
+ | 1 | HSP / HIP | Both ring nitrogens are protonated |
269
+ | 2 | HSE / HIE | Proton on Nε |
270
+ | 3 | HSD / HID | Proton on Nδ |
271
+
272
+ A row with `0.04 0.91 0.05` across the three aligned time series is HSE/HIE. A row with `0.55 0.40 0.05` is intermediate. For endpoint populations, count each state when its lambda is greater than 0.8, divide by the number of assigned frames, and report the excluded fraction. For example, 30 HSP, 50 HSE, 10 HSD and 10 intermediate frames give 33%, 56% and 11% of assigned frames, with 10% excluded. Report sampling uncertainty across independent replicas. [CpHMD trajectory analysis](https://doi.org/10.1021/acs.jctc.2c00516) · [GitLab #48](https://gitlab.com/gromacs-constantph/phbuilder/-/issues/48)
273
+
274
+ ## Titrate a CHARMM36m chain terminus
275
+
276
+ Explicit terminal sites use the `NH3T` and `COOHT` patches and the charge tables and correction coefficients from the published CHARMM36m terminal reference runs. Specify the chain, residue number, endpoint (0 protonated, 1 deprotonated), and reference pKa. The example below requests an N terminus at A:1 and a C terminus at A:42. Use the pKa values appropriate for your reference compounds.
277
+
278
+ ```bash
279
+ ends=(--terminal 'N:A:1=0@8.0' --terminal 'C:A:42=1@4.0')
280
+ phbuilder gentopol -f input.pdb -ph 7 "${ends[@]}"
281
+ # Select NH3T and COOHT for the requested ends in the GROMACS menus.
282
+ gmx editconf -f phprocessed.pdb -o box.pdb -bt cubic -d 1.5
283
+ gmx solvate -cp box.pdb -p topol.top -o solvated.pdb
284
+ phbuilder neutralize -f solvated.pdb "${ends[@]}"
285
+ phbuilder genparams -f phneutral.pdb -ph 7 "${ends[@]}"
286
+ ```
287
+
288
+ Box and solvate the prepared structure before neutralization. Repeat the same selectors in all three commands. Keep the structure in PDB format and use one reference pKa per terminal type. The N-terminal table requires the standard `N H1 H2 H3 CA HA` atom set, which excludes glycine and proline N termini. The C-terminal table requires `C OT1 OT2 HT2` from `COOHT`. The site is an additional lambda group on the same residue as any titratable side chain. [Reference inputs](https://doi.org/10.1021/acs.jctc.2c00517.s001) · [GitLab #29](https://gitlab.com/gromacs-constantph/phbuilder/-/issues/29)
289
+
249
290
  # Performing titrations
250
291
 
251
- Performing a computational titration is helpful for determining the pKa shifts of titratable sites. After steps 1 to 9 of the basic workflow have been completed, one can use the included [create_titration.py](scripts/create_titration.py) to setup a titration. For example, the command:
292
+ Performing a computational titration is helpful for determining the pKa shifts of titratable sites. After steps 1 to 9 of the basic workflow have been completed, one can use the included [create_titration.py](scripts/create_titration.py) to set up a titration. For example, the command:
252
293
 
253
294
  ```
254
- create_titration.py -f MD.mdp -c NPT.pdb -p topol.top -n index.ndx -pH 1:10:1 -nr 2
295
+ python /path/to/phbuilder/scripts/create_titration.py -f MD.mdp -c NPT.pdb -p topol.top -n index.ndx -pH 1:10:1 -nr 2
255
296
  ```
256
297
 
257
298
  creates directories corresponding to pH 1 to 9, with each subdirectory containing two replicates (each containing the appropriate input files for `gmx mdrun`).
@@ -262,7 +303,7 @@ The minor change is at step 7. When parameters are generated, `phbuilder genpara
262
303
  phbuilder genparams -f phneutral.pdb -ph 4.0 -titr
263
304
  ```
264
305
 
265
- This will set the pH value to the string "ph", as well as all pH-dependent terms for pKa values in multisite groups (e.g. $\lambda_1$ of histidine). Those pH-dependent strings will be read by `create_titration.py` and modified according to the pH value for a particular somulation. Note however that a pH value is still required to be passed as input to `phbuilder genparams`. Minimization and equilibration files will be generated for this provided pH.
306
+ This will set the pH value to the string "ph", as well as all pH-dependent terms for pKa values in multisite groups (e.g. $\lambda_1$ of histidine). Those pH-dependent strings will be read by `create_titration.py` and modified according to the pH value for a particular simulation. Note however that a pH value is still required to be passed as input to `phbuilder genparams`. Minimization and equilibration files will be generated for this provided pH.
266
307
 
267
308
  # Performing parameterizations
268
309
 
@@ -274,13 +315,7 @@ NOTE: the structure for the arginine tripeptide may be found [here](figures/arg_
274
315
 
275
316
  ### 1. Prepare your working directory.
276
317
 
277
- By default, phbuilder uses/copies `lambdagrouptypes.dat`, `residuetypes.dat`, and `charmm36-mar2019-cphmd.ff` from
278
-
279
- ```
280
- /path/to/python3.11/site-packages/phbuilder/ffield/
281
- ```
282
-
283
- to your working directory whenever used. To parameterize arginine, we will have to use modified versions of these files. Since it is not recommended to modify the default ones, we suggest placing copies in your working directory (either manually or by simply running `phbuilder gentopol` once). The files in your working directory will then override the default ones.
318
+ Copy the selected profile's `lambdagrouptypes.dat` from [the bundled parameter data](phbuilder/ffield) into your working directory before editing it. Use the same file throughout setup. `gentopol` copies the packaged force field and residue table into the working directory when local copies are absent.
284
319
 
285
320
  ### 2. Modify `lambdagrouptypes.dat`.
286
321
 
@@ -304,7 +339,7 @@ dvdl_1 = 0.0
304
339
 
305
340
  [ BUF ]
306
341
  range = -0.50 0.50
307
- dvdl = 823.85 -2457.8 2172.2 -144.05 -1289 576.74
342
+ dvdl = 823.85 -2457.8 2172.2 -144.05 -1289 576.74
308
343
  ```
309
344
 
310
345
  Here, it can be seen that `ARGT` will be used as the name for the titratable arginine. One can also see which atoms are to be made titratable, and which charge they should have in which protonation state. Finally, notice that `dvdl_1` is set to zero, as this is the parameter we are going to obtain during the parameterization.
@@ -315,7 +350,7 @@ As mentioned earlier, phbuilder cannot provide topology information for non-stan
315
350
 
316
351
  **Option 1 : Make sure you have a separate `.itp` file for the titratable ligand.**
317
352
 
318
- If `gentopol` detects any non-standard residue types, it will ask the user to provide a path to the corresponding `.itp` file. Internally, phbuilder splits the input structure file into a standard and a non-standard part, and only run `gmx pdb2gmx` on the standard part. If this option is chosen, it is crucial that the input `.pdb` and `.itp` files correspond to the *most protonated state* of the non-standard residue type (i.e. with all hydrogens present). Note that despite providing a separate `.itp` file, you might still have to make additions to the force field. This possibly includes new atom, bond, pair, angle, and dihedral types not present in the standard force field, but present in the provided topology.
353
+ If `gentopol` detects any non-standard residue types, it will ask the user to provide a path to the corresponding `.itp` file. phbuilder runs `gmx pdb2gmx` on the standard residues and appends the remaining molecules with their supplied topology. PDB ligands can use `HETATM` records. Include all ligand atoms, including hydrogens, in topology order. If this option is chosen, it is crucial that the input `.pdb` and `.itp` files correspond to the *most protonated state* of the non-standard residue type (i.e. with all hydrogens present). Note that despite providing a separate `.itp` file, you might still have to make additions to the force field. This possibly includes new atom, bond, pair, angle, and dihedral types not present in the standard force field, but present in the provided topology.
319
354
 
320
355
  In your provided `.itp` file, the names in the [ atoms ] section should reflect the titratable name of the residue:
321
356
 
@@ -362,7 +397,7 @@ etc.
362
397
  Third, make sure an entry for `ARGT` exists in the `charmm36-mar2019-cphmd.ff/merged.hdb`. One can do this by simply copying and pasting the entry for `ARG` and changing the name to `ARGT`:
363
398
 
364
399
  ```
365
- ARGT 8
400
+ ARGT 8
366
401
  1 1 HN N -C CA
367
402
  1 5 HA CA N C CB
368
403
  2 6 HB CB CG CA
@@ -407,7 +442,7 @@ will position restrain only atom 19. Position restraining during the parameteriz
407
442
  ### 5. Perform solvation and neutralization to obtain a net-neutral simulation system.
408
443
 
409
444
  * When performing the neutralization step, we want to add only one buffer particle, and we want the buffer to be at least 1.5 nm away from the tripeptide. We therefore set the `-nbufs 1` and `-rmin 1.5` flags.
410
- * To prevent finite-size effects for small simulation boxes, we recommend using a simulation box of at least 5 nm cubed for the paramterization and replica simulations.
445
+ * To prevent finite-size effects for small simulation boxes, we recommend using a simulation box of at least 5 nm cubed for the parameterization and replica simulations.
411
446
  * The effects of ionic strength on the parameterization should be limited, but we nonetheless recommend adding at least a few ions to the parameterization system and replicates, e.g. by setting `-conc 0.15` (physiological NaCl concentration).
412
447
  * For more information on the effects of box size and ionic strength on the parameterization, please refer to the [best practices paper](https://pubs.acs.org/doi/full/10.1021/acs.jctc.2c00517).
413
448
 
@@ -425,7 +460,7 @@ This can be done by setting the `-cal` flag:
425
460
  phbuilder genparams -f phneutral.pdb -ph 4.0 -cal
426
461
  ```
427
462
 
428
- We set pH = 4.0 only because `-ph` is a required parameter for `gentopol`. The actual value we supply doesn't matter as $V_{\text{pH}}$ is never computed during parameterization (explained below).
463
+ We set pH = 4.0 because `-ph` is required by `genparams`. The actual value we supply doesn't matter as $V_{\text{pH}}$ is never computed during parameterization (explained below).
429
464
 
430
465
  Setting the `-cal` flag will do a number of things. Most importantly, it will set
431
466
 
@@ -439,10 +474,10 @@ Setting `-cal` also adds `define = -DPOSRES -DPOSRES_BUF` to the `.mdp` files as
439
474
 
440
475
  ### 7. Perform basic workflow steps 8-9 (check generic `.mdp` files and perform EQ).
441
476
 
442
- ### 8. Use the included [create_parameterization.py](scripts/create_parameterization.py) to setup the parameterization runs.
477
+ ### 8. Use the included [create_parameterization.py](scripts/create_parameterization.py) to set up the parameterization runs.
443
478
 
444
479
  ```
445
- create_parameterization.py -f MD.mdp -c NPT.pdb -r NPT.pdb -p topol.top -n index.ndx
480
+ python /path/to/phbuilder/scripts/create_parameterization.py -f MD.mdp -c NPT.pdb -r NPT.pdb -p topol.top -n index.ndx
446
481
  ```
447
482
 
448
483
  creates directories corresponding to different $\lambda$-values, each containing a `.tpr` run input file for `gmx mdrun`.
@@ -456,7 +491,7 @@ The 2-step parameterization protocol assumes that first, short parameterization
456
491
  After the parameterization simulations are completed, running the command
457
492
 
458
493
  ```
459
- gmx cphmd -s run.tpr -e run.edr -dvdl --coordinate no
494
+ gmx cphmd -s run.tpr -e run.edr -o cphmd.xvg -dvdl -nocoordinate
460
495
  ```
461
496
 
462
497
  will yield a file `cphmd-dvdl-1-2.xvg` for which the second column contains the **dVdl** values of parameterized group. This should be done for each of the 13 parameterization simulations.
@@ -466,16 +501,16 @@ will yield a file `cphmd-dvdl-1-2.xvg` for which the second column contains the
466
501
  To get the initial guess for dVdl coefficients, `fit_parameterization.py` needs to be run in the parameterization mode:
467
502
 
468
503
  ```
469
- fit_parameterization.py -f MD.mdp -m p -g ARGT
504
+ python /path/to/phbuilder/scripts/fit_parameterization.py -f MD.mdp -m p -g ARGT
470
505
  ```
471
506
 
472
- As an output, `fit_parameterization.py` gives a file where and updated entry for `lambdagrouptypes.dat` and the `.mdp` files are provided.
507
+ As an output, `fit_parameterization.py` writes an updated group entry for `lambdagrouptypes.dat` and a matching MDP block.
473
508
 
474
509
  ### 12. Perform replicates to test the obtained dVdl coefficients.
475
510
 
476
- At this point, if everything went correctly, you have obtained an initial guess for the **dVdl** of your new titratable ligand. This concludes step one of the two-step parameterization protocol.
511
+ At this point, if everything went correctly, you have obtained an initial guess for the **dVdl** of your new titratable ligand. This concludes step one of the two-step parameterization protocol.
477
512
 
478
- It is now time to test how the **dVdl** coefficients perform, and whether the second Boltzmann-reweighting step is required. For this, you can set up regular CpHMD simulations of the ligand in a box of water using the basic workflow.
513
+ It is now time to test how the **dVdl** coefficients perform, and whether the second Boltzmann-reweighting step is required. For this, you can set up regular CpHMD simulations of the ligand in a box of water using the basic workflow.
479
514
 
480
515
  * You should not reuse simulation files from the parameterization but rather start from scratch following the basic workflow (but with the updated `lambdagrouptypes.dat`).
481
516
  * When setting up the replicates, be sure that pH = ligand pKa and that `-dwpE 0` is specified for `genparams`.
@@ -486,10 +521,10 @@ When plotting the resulting $\lambda$-trajectories as a histogram, one should ob
486
521
 
487
522
  ### 13. If necessary, use inverse-Boltzmann to refine the parameterization.
488
523
 
489
- If the distribution are not flat, we will have to update the dVdl coefficients by adding the correction which should flatten the distribution. The correction for dVdl is computed as the derivative of $U(\lambda)$, where $U$ is the Boltzmann inversion of the distribution $p(\lambda)$: $U = -R T \log(p)$. To get this correction `fit_parameterization.py` needs to be run in reweighting mode:
524
+ If the distributions are not flat, we will have to update the dVdl coefficients by adding the correction which should flatten the distribution. The correction for dVdl is computed as the derivative of $U(\lambda)$, where $U$ is the Boltzmann inversion of the distribution $p(\lambda)$: $U = -R T \log(p)$. To get this correction `fit_parameterization.py` needs to be run in reweighting mode:
490
525
 
491
526
  ```
492
- python fit_parameterization.py -f MD.mdp -m s -g ARGT
527
+ python /path/to/phbuilder/scripts/fit_parameterization.py -f MD.mdp -m s -g ARGT
493
528
  ```
494
529
 
495
530
  NOTE: To prevent issues, make sure your replica directories follow the naming format `s_1`, `s_2`, ..., `s_10`.
@@ -504,6 +539,22 @@ The reweighting can be repeated several times, but usually one repetition is eno
504
539
 
505
540
  Figure: The initial guess for the **dVdl** coefficients for ARGT yields replicates for which the distributions are consistent but not flat (left). Upon performing the inverse-Boltzmann refinement and rerunning the replicates, the distributions are now both consistent and flat (right).
506
541
 
542
+ ## Parameterize a coupled multisite group
543
+
544
+ Use a capped Ala–His–Ala peptide with one `HSPT` site and one buffer as a reference case. Prepare and equilibrate it at the protonated starting endpoint and generate a calibration MDP with `genparams -cal`. Supply all three state charge tables and their reference pKa values in `lambdagrouptypes.dat`. The shared artificial state is described in the methods paper. Run the fixed-lambda windows and extract all site derivatives and the buffer derivative for each window.
545
+
546
+ ```sh
547
+ python /path/to/phbuilder/scripts/create_parameterization.py \
548
+ -f MD.mdp -c NPT.pdb -r NPT.pdb -p topol.top -n index.ndx --multisite --step 0.05
549
+ # Run gmx mdrun -s run.tpr -deffnm run in each r_* directory. Then, in each directory:
550
+ gmx cphmd -s run.tpr -e run.edr -o cphmd.xvg -dvdl -nocoordinate -numplot 4
551
+ # Back in the directory containing MD.mdp:
552
+ python /path/to/phbuilder/scripts/fit_parameterization.py \
553
+ -f MD.mdp -m p -g HSPT -fo 8 --discard 1000
554
+ ```
555
+
556
+ The window generator fixes the site coordinates on `sum(lambda) = 1` and adjusts the buffer lambda to keep the starting charge constant. The fitter uses the site derivatives to recover one common potential and writes a coefficient row for each physical state. The printed RMSE measures agreement with the input windows. To validate the fit, compare derivative residuals on independent windows or replicas with their sampling uncertainty, then check that an independent histidine titration reproduces the reference microstate populations and pKa values. The `--discard` argument counts saved frames. Multisite fitting supports two or three coordinates, and inverse-Boltzmann refinement is available for single-site fits. [Fit method and validation targets](https://doi.org/10.1021/acs.jctc.2c00516) · [Polynomial fitting supplement](https://doi.org/10.1021/acs.jctc.2c00516.s003) · [GitLab #11](https://gitlab.com/gromacs-constantph/phbuilder/-/issues/11)
557
+
507
558
  # Running CpHMD simulations on HPC resources
508
559
 
509
560
  To run CpHMD simulations on a cluster you will likely have to compile the CpHMD beta yourself. For this we suggest the following slurm script (modify as needed):
@@ -548,94 +599,42 @@ gmx mdrun -deffnm MD -x MD.xtc -npme 0 -nt $SLURM_JOB_CPUS_PER_NODE
548
599
 
549
600
  This is assuming you have the gromacs-constantph beta located in your home `~` directory.
550
601
 
551
- # Synopsis `phbuilder gentopol`
602
+ # Command-line reference
552
603
 
553
- ```
554
- phbuilder gentopol [-h] -f FILE [-o OUTPUT] [-ph PH] [-v]
604
+ ```sh
605
+ phbuilder gentopol --help
606
+ phbuilder neutralize --help
607
+ phbuilder genparams --help
555
608
  ```
556
609
 
557
- ### DESCRIPTION
610
+ The flags printed by each subcommand are authoritative. The [basic workflow](#basic-workflow) shows how to pass the outputs between commands.
558
611
 
559
- Allows you to select which residues to make titratable and which initial lambda (protonation) state they should have. Also (re)generates the system topology using the modified CHARMM36m force field. If you don't want to manually set initial lambda values, you can use the -ph flag to have gentopol automatically choose the appropriate initial lambda values, based on the criterion: pH > pKa means start deprotonated, else start protonated.
612
+ # Troubleshooting and analysis
560
613
 
561
- ### LIMITATIONS
614
+ ## Unexpected charge or exhausted solvent
562
615
 
563
- * It is important that your protein(s)/molecule(s) containing the titratable groups is *at the top* of your structure file. So first the titratable protein(s), and only then solvent, ions, lipids, etc.
616
+ The charge in a static topology can differ from the CpHMD charge measured by `neutralize`. Check which `lambdagrouptypes.dat` file was loaded, how its charges map to its ordered atom list, and the initial states in `phrecord.dat`. Avoid using `-ignw` to bypass a mismatch in the atom names or counts. For water insertion failures, compare the water count and name in the coordinates and topology, then inspect `builder.log` for the GROMACS diagnostic. [GitLab #38](https://gitlab.com/gromacs-constantph/phbuilder/-/issues/38)
564
617
 
565
- OPTIONS
618
+ ## A bound ligand stays protonated
566
619
 
567
- | Flag____ | Description |
568
- |--------------|----------------|
569
- | `-f` | [\<.pdb/.gro>] (required) <br /> Specify input structure file. |
570
- | `-o` | [\<.pdb/.gro>] (phprocessed.pdb) <br /> Specify output structure file. |
571
- | `-ph` | [\<float>] <br /> Specify intended simulation pH. Will be used together with the reference pKas of the titratable sites to auto set the initial lambdas. |
572
- | `-groups` | [\<str>] <br /> Specify which titratable residue types to consider. Example: "ASPT GLUT" will only consider Asp and Glu residues for CpHMD. |
573
- | `-v` | (no) <br /> Be more verbose. |
620
+ Compare matched ligand-in-water and bound-ligand simulations with the same force field, lambda parameters, and pH. Start independent replicas at both endpoints, repeat the neutralization for each starting state, and compare endpoint populations, transition counts and convergence. Sparse transitions can obscure a physical shift in pKa. If you vary the barrier to diagnose sampling, track that change separately from the comparison at the production barrier. [GitLab #41](https://gitlab.com/gromacs-constantph/phbuilder/-/issues/41)
574
621
 
575
- # Synopsis `phbuilder neutralize`
622
+ ## Binding-energy analysis and gmxMMPBSA
576
623
 
577
- ```
578
- phbuilder neutralize [-h] -f FILE [-p TOPOL] [-o OUTPUT] [-solname SOLNAME] [-pname PNAME] [-nname NNAME] [-conc CONC] [-nbufs NBUFS] [-rmin RMIN] [-ignw] [-v]
579
- ```
580
-
581
- ### DESCRIPTION
582
-
583
- Adds the appropriate number of ions to ensure a net-neutral system at t=0, and adds buffer particles in order to maintain a net-neutral system at t>0. The system charge a t=0 depends on the chosen initial lambda (protonation) states. At t>0, protonation states can change dynamically, meaning the resulting charge difference needs to be 'absorbed' by buffer particles. Each buffer particle can absorb up to ±0.5 charge, and charge is distributed evenly across all buffers (-10 system charge and 100 BUF implies every BUF +0.1).
624
+ phbuilder has no direct interface for sending dynamically titrating trajectories to gmxMMPBSA. Use CpHMD populations to choose representative protonation states, then prepare consistent fixed-state complex, receptor and ligand inputs. Evaluate each state with the same analysis protocol. As a validation experiment, compare what the analysis reports for a fixed endpoint and a CpHMD endpoint with that same state before interpreting intermediate-lambda frames or pH-dependent energy decompositions. The reported pH trend in GitLab remains unexplained. [GitLab #31](https://gitlab.com/gromacs-constantph/phbuilder/-/issues/31) · [GitLab #45](https://gitlab.com/gromacs-constantph/phbuilder/-/issues/45)
584
625
 
585
- ### LIMITATIONS
626
+ ## Carrying lambda coordinates between equilibration stages
586
627
 
587
- * phbuilder neutralize only keeps track of one type of positive (default NA), and one type of negative (default CL) ion. If you have either no ions or only NA and CL in your input structure, things should work. If you have or want to use a different type, you can use the `-pname` and `-nname` options (see below). If you have or want multiple different types of ions in your system, phbuilder is not guaranteed to work.
588
- * Similar to [gmx genion](https://manual.gromacs.org/current/onlinehelp/gmx-genion.html), phbuilder neutralize neutralizes the system by *adding* ions to the input structure, not by removing or rebalancing existing ones. This implies the ion concentration in your output files cannot and will not be lower than the ion concentration in your input file.
628
+ [EQ_smart.py](scripts/EQ_smart.py) reads the last frame of the previous EDR and writes its lambda values into the next MDP. Use the same atom collections and ordering for both stages. Treat a lambda coordinate outside the fork's accepted range as a reason to inspect the parameterization, equilibration and buffer capacity.
589
629
 
590
- ### OPTIONS
630
+ # Testing
591
631
 
592
- | Flag_______ | Description |
593
- |--------------|----------------|
594
- | `-f` | [\<.pdb/.gro>] (required) <br /> Specify input structure file. |
595
- | `-p` | [\<.top>] (topol.top) <br /> Specify input topology file. |
596
- | `-o` | [\<.pdb/.gro>] (phneutral.pdb) <br /> Specify output structure file. |
597
- | `-solname` | [\<str>] (SOL) <br /> Specify solvent name (of which to replace molecules with ions and buffers). |
598
- | `-pname` | [\<str>] (NA) <br /> Specify name of positive ion to use. |
599
- | `-nname` | [\<str>] (CL) <br /> Specify name of negative ion to use. |
600
- | `-conc` | [\<float>] (0.0) <br /> Specify ion concentration in mol/L. Note: uses solvent volume for calculating the required number of ions, not the periodic box volume as gmx genion does. |
601
- | `-nbufs` | [\<int>] <br /> Specify number of buffer particles to add. If not set, $N_{\text{buf}} = 2N_{\text{sites}} + 1$. This ensures enough buffer particles will always be added, although you can likely get away with much less for larger systems. The GROMACS CpHMD beta MUST be sourced/loaded for neutralize to work correctly. |
602
- | `-rmin` | [\<float>] (0.6) <br /> Set the minimum distance the ions and buffers should be placed from the solute.
603
- | `-ignw` | (no) <br /> Ignore all gmx grompp warnings. |
604
- | `-v` | (no) <br /> Be more verbose. |
632
+ Run these commands from the repository root.
605
633
 
606
- # Synopsis `phbuilder genparams`
607
-
608
- ```
609
- phbuilder genparams [-h] -f FILE -ph PH [-mdp MDP] [-ndx NDX] [-nstout NSTOUT] [-dwpE DWPE] [-inter] [-titr] [-cal] [-v]
634
+ ```sh
635
+ python -m pip install -e '.[test]'
636
+ python -m pytest -m 'not integration'
637
+ PHBUILDER_GMX=/path/to/gmx python -m pytest --require-gromacs
610
638
  ```
611
639
 
612
- ### DESCRIPTION
613
-
614
- Generates the CpHMD-specific `.mdp` and `.ndx` files. Will write generic EM.mdp EQ.mdp, and MD.mdp files for CHARMM36m and append the CpHMD parameters at the bottom. genparams requires the existence of a phrecord.dat file, which contains the initial lambda values and is created during the gentopol step. Note: if you previously used the auto feature (`-ph` flag) for gentopol, the pH you specify for genparams should reflect this.
615
-
616
- ### OPTIONS
617
-
618
- | Flag______ | Description |
619
- |--------------|----------------|
620
- | `-f` | [\<.pdb/.gro>] (required) <br /> Specify input structure file. |
621
- | `-ph` | [\<float>] (required) <br /> Specify simulation pH. |
622
- | `-mdp` | [\<.mdp>] (MD.mdp) <br /> Specify `.mdp` file for the constant-pH parameters to be appended to. If the specified file does not exist, the `.mdp` file will be generated from scratch. Note that this only applies to production (MD), for energy minimization (EM) and equilibration (NVT/NPT), the .mdp files will be generated from scratch regardless. |
623
- | `-ndx` | [\<.idx>] (index.ndx) <br /> Specify `.ndx` file to append the CpHMD index groups to. If not set or the specified file does not exist, a generic `index.ndx` will be created first. |
624
- | `-nstout` | [\<int>] (500) <br /> Specify lambda coordinate output frequency. 500 is large enough for subsequent frames to be uncoupled (with a $dt = 0.002$).
625
- | `-dwpE` | [\<float>] (7.5) <br /> Specify default height of bias potential barrier (kJ/mol).
626
- | `-inter` | (no) <br /> Interactively set the height of the bias potential barrier (kJ/mol) for every titratable site.
627
- | `-titr` | (no) <br /> Prepare files for running titrations with CpHMD: forces pH to be set to "ph" and ph-dependent pKa values to be written to MD.mdp as string. The `create_titration.py` script will further modify those entries according to the currently set ph. |
628
- | `-cal` | (no) <br /> Run CpHMD simulation in calibration mode: forces on the lambda coordinates are computed, but their positions won't be updated. This is only used for parameterization purposes. |
629
- | `-v` | (no) <br /> Be more verbose. |
630
-
631
- # Tips, Tricks, and FAQ
632
-
633
- * One can use the experimental [EQ_smart.py](scripts/EQ_smart.py) to perform a more sound CpHMD equilibration. When using this script, the lambda coordinates from the last frame of an equilibration step are extracted from the `.edr` file and inserted in the `.mdp` file for the next equilibration step.
634
-
635
- **Q : Where are the default `charmm36-mar2019-cphmd.ff` and `lambdagrouptypes.dat` files located?**
636
-
637
- A : To find out, run a `phbuilder` command with the `-v` flag. The path to the default files will be provided as extra user output.
638
-
639
- **Q : What does `Condition: (lambdaCoordinate.x < 1.15 && lambdaCoordinate.x > -0.15) Lambda coordinate left the range for which it has been parametrised. Check your input parameters` mean?**
640
-
641
- A : If you receive this error, it means one or more of your lambda coordinates moved outside the acceptable [-0.15, 1.15] range. Since V_wall (part of V_bias), which is applied to keep the lambda coordinate in the [0, 1] range, rises very steeply outside [0, 1], it means forces on the lambda coordinate were unacceptably high. This can happen if 1) your dV/dl coefficients / parameterization is incorrect, 2) your system wasn't properly equilibrated (try EQ_smart.py), 3) you didn't added enough buffer particles (forcing the buffer coordinate out of range).
640
+ The suite also detects `gmx-cph` or a CpHMD-capable `gmx` on `PATH`. Unit tests cover parameter parsing, files and setup scripts. The integration suite runs topology generation, solvent and buffer insertion, terminal sites, fixed-lambda calibration, and short simulations with checkpoint restart and lambda extraction.