5.3.11. tleap#
12-6 parameters
1#!/bin/bash
2# Prepare topology/coordinate files with normal 12-6 Lennard-Jones parameters.
3# For protein, nucleic acid, and ion-containing systems.
4
5set -euo pipefail
6
7usage() {
8 cat <<EOF
9Usage: $(basename "$0") system.pdb
10
11Environment overrides:
12 OUT_PREFIX Output prefix (default: step3_pbcsetup)
13 WATER_BOX Water box model (default: TIP3PBOX)
14 BUFFER Solvent buffer distance (default: 12.0)
15 CLOSENESS Solvent closeness parameter (default: 0.8)
16EOF
17}
18
19if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
20 usage
21 exit 0
22fi
23
24if [ "$#" -ne 1 ]; then
25 echo "ERROR: Requires exactly one input PDB file." >&2
26 usage >&2
27 exit 1
28fi
29
30SYS=$1
31OUT_PREFIX=${OUT_PREFIX:-step3_pbcsetup}
32WATER_BOX=${WATER_BOX:-TIP3PBOX}
33BUFFER=${BUFFER:-12.0}
34CLOSENESS=${CLOSENESS:-0.8}
35
36if [ ! -f "$SYS" ]; then
37 echo "ERROR: Input PDB file not found: $SYS" >&2
38 exit 1
39fi
40
41if ! command -v tleap >/dev/null 2>&1; then
42 echo "ERROR: tleap was not found. Load AmberTools before running this script." >&2
43 exit 1
44fi
45
46tleap -f - <<_EOF
47source leaprc.protein.ff14SB
48source leaprc.DNA.OL15
49source leaprc.RNA.OL3
50source leaprc.water.tip3p
51
52sys = loadpdb ${SYS}
53
54savepdb sys ${OUT_PREFIX}.pdb
55charge sys
56solvatebox sys ${WATER_BOX} ${BUFFER} iso ${CLOSENESS}
57addions sys Na+ 0
58addions sys Cl- 0
59
60saveamberparm sys ${OUT_PREFIX}.parm7 ${OUT_PREFIX}.rst7
61savepdb sys ${OUT_PREFIX}_wat.pdb
62
63quit
64_EOF
12-6-4 parameters
1#!/bin/bash
2# Prepare topology/coordinate files with 12-6-4 Lennard-Jones ion parameters.
3# For protein, nucleic acid, and ion-containing systems.
4
5set -euo pipefail
6
7usage() {
8 cat <<EOF
9Usage: $(basename "$0") system.pdb
10
11Environment overrides:
12 OUT_PREFIX Output prefix (default: step3_pbcsetup)
13 WATER_BOX Water box model (default: TIP3PBOX)
14 BUFFER Solvent buffer distance (default: 12.0)
15 CLOSENESS Solvent closeness parameter (default: 0.8)
16 ION_FRCMOD 12-6-4 ion frcmod file (default: frcmod.ions234lm_1264_tip3p)
17EOF
18}
19
20if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
21 usage
22 exit 0
23fi
24
25if [ "$#" -ne 1 ]; then
26 echo "ERROR: Requires exactly one input PDB file." >&2
27 usage >&2
28 exit 1
29fi
30
31SYS=$1
32OUT_PREFIX=${OUT_PREFIX:-step3_pbcsetup}
33WATER_BOX=${WATER_BOX:-TIP3PBOX}
34BUFFER=${BUFFER:-12.0}
35CLOSENESS=${CLOSENESS:-0.8}
36ION_FRCMOD=${ION_FRCMOD:-frcmod.ions234lm_1264_tip3p}
37
38if [ ! -f "$SYS" ]; then
39 echo "ERROR: Input PDB file not found: $SYS" >&2
40 exit 1
41fi
42
43if [ ! -f "$ION_FRCMOD" ]; then
44 echo "ERROR: 12-6-4 ion frcmod file not found: $ION_FRCMOD" >&2
45 exit 1
46fi
47
48if ! command -v tleap >/dev/null 2>&1; then
49 echo "ERROR: tleap was not found. Load AmberTools before running this script." >&2
50 exit 1
51fi
52
53tleap -f - <<_EOF
54source leaprc.protein.ff14SB
55source leaprc.DNA.OL15
56source leaprc.RNA.OL3
57source leaprc.water.tip3p
58loadamberparams ${ION_FRCMOD}
59
60sys = loadpdb ${SYS}
61
62savepdb sys ${OUT_PREFIX}.pdb
63charge sys
64solvatebox sys ${WATER_BOX} ${BUFFER} iso ${CLOSENESS}
65addions sys Na+ 0
66addions sys Cl- 0
67
68saveamberparm sys ${OUT_PREFIX}.parm7 ${OUT_PREFIX}.rst7
69savepdb sys ${OUT_PREFIX}_wat.pdb
70
71quit
72_EOF
tleap with small-molecule
1#!/bin/bash
2# Build standalone topology/coordinate files for a custom ligand.
3
4set -euo pipefail
5
6usage() {
7 cat <<EOF
8Usage: $(basename "$0") ligand[.mol2]
9
10Environment overrides:
11 OUT_PREFIX Output prefix (default: ligand stem)
12EOF
13}
14
15if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
16 usage
17 exit 0
18fi
19
20if [ "$#" -ne 1 ]; then
21 echo "ERROR: Requires exactly one ligand MOL2 file or ligand name." >&2
22 usage >&2
23 exit 1
24fi
25
26ligand=$1
27case "$ligand" in
28 *.mol2)
29 mol2_file=$ligand
30 ;;
31 *.*)
32 stem=${ligand%.*}
33 mol2_file="${stem}.mol2"
34 ;;
35 *)
36 mol2_file="${ligand}.mol2"
37 ;;
38esac
39
40stem=${mol2_file%.mol2}
41frcmod_file="${stem}.frcmod"
42OUT_PREFIX=${OUT_PREFIX:-$stem}
43
44if [ ! -f "$mol2_file" ]; then
45 echo "ERROR: Ligand MOL2 file not found: $mol2_file" >&2
46 exit 1
47fi
48
49if [ ! -f "$frcmod_file" ]; then
50 echo "ERROR: Ligand frcmod file not found: $frcmod_file" >&2
51 echo "Run parmchk2 before this script." >&2
52 exit 1
53fi
54
55if ! command -v tleap >/dev/null 2>&1; then
56 echo "ERROR: tleap was not found. Load AmberTools before running this script." >&2
57 exit 1
58fi
59
60tleap -f - <<_EOF
61source leaprc.protein.ff14SB
62source leaprc.water.tip3p
63source leaprc.gaff2
64
65loadamberparams ${frcmod_file}
66LIG = loadmol2 ${mol2_file}
67
68check LIG
69saveoff LIG ${OUT_PREFIX}.lib
70saveamberparm LIG ${OUT_PREFIX}.parm7 ${OUT_PREFIX}.rst7
71
72quit
73_EOF
if PDB has waterbox already then you can set the box size
1#!/bin/bash
2# Build a system from explicit components and assign a custom box size.
3
4set -euo pipefail
5
6usage() {
7 cat <<EOF
8Usage: $(basename "$0")
9
10Environment overrides:
11 PROTEIN Protein PDB file (default: protein.pdb)
12 LIGAND Ligand stem or MOL2 file (default: lig)
13 ION Ion PDB file (default: ion.pdb)
14 WATER Water PDB file (default: water.pdb)
15 BOX_SIZE Box dimensions (default: 82.0 82.0 82.0)
16 OUT_PREFIX Output prefix (default: step3_pbcsetup)
17EOF
18}
19
20if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
21 usage
22 exit 0
23fi
24
25if [ "$#" -ne 0 ]; then
26 echo "ERROR: This script uses environment variables for inputs; pass no positional arguments." >&2
27 usage >&2
28 exit 1
29fi
30
31PROTEIN=${PROTEIN:-protein.pdb}
32LIGAND=${LIGAND:-lig}
33ION=${ION:-ion.pdb}
34WATER=${WATER:-water.pdb}
35BOX_SIZE=${BOX_SIZE:-82.0 82.0 82.0}
36OUT_PREFIX=${OUT_PREFIX:-step3_pbcsetup}
37
38case "$LIGAND" in
39 *.mol2)
40 mol2_file=$LIGAND
41 ;;
42 *.*)
43 stem=${LIGAND%.*}
44 mol2_file="${stem}.mol2"
45 ;;
46 *)
47 mol2_file="${LIGAND}.mol2"
48 ;;
49esac
50
51stem=${mol2_file%.mol2}
52frcmod_file="${stem}.frcmod"
53lib_file="${stem}.lib"
54
55for required_file in "$PROTEIN" "$ION" "$WATER" "$mol2_file" "$frcmod_file" "$lib_file"; do
56 if [ ! -f "$required_file" ]; then
57 echo "ERROR: Required file not found: $required_file" >&2
58 exit 1
59 fi
60done
61
62if ! command -v tleap >/dev/null 2>&1; then
63 echo "ERROR: tleap was not found. Load AmberTools before running this script." >&2
64 exit 1
65fi
66
67tleap -f - <<_EOF
68source leaprc.protein.ff14SB
69source leaprc.water.tip3p
70source leaprc.gaff2
71
72loadamberparams ${frcmod_file}
73loadoff ${lib_file}
74
75PROTEIN = loadpdb ${PROTEIN}
76LIG = loadmol2 ${mol2_file}
77ION = loadpdb ${ION}
78WAT = loadpdb ${WATER}
79
80SYS = combine { PROTEIN LIG ION WAT }
81
82set SYS box { ${BOX_SIZE} }
83check SYS
84
85savepdb SYS ${OUT_PREFIX}.pdb
86saveamberparm SYS ${OUT_PREFIX}.parm7 ${OUT_PREFIX}.rst7
87
88quit
89_EOF