2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2012, The GROMACS development team,
6 * check out http://www.gromacs.org for more information.
7 * Copyright (c) 2012, by the GROMACS development team, led by
8 * David van der Spoel, Berk Hess, Erik Lindahl, and including many
9 * others, as listed in the AUTHORS file in the top-level source
10 * directory and at http://www.gromacs.org.
12 * GROMACS is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation; either version 2.1
15 * of the License, or (at your option) any later version.
17 * GROMACS is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with GROMACS; if not, see
24 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 * If you want to redistribute modifications to GROMACS, please
28 * consider that scientific software is very special. Version
29 * control is crucial - bugs must be traceable. We will be happy to
30 * consider code for inclusion in the official distribution, but
31 * derived work must not be called official GROMACS. Details are found
32 * in the README & COPYING files - if they are missing, get the
33 * official version at http://www.gromacs.org.
35 * To help us fund GROMACS development, we humbly ask that you cite
36 * the research papers on the package. Check out http://www.gromacs.org.
53 int gmx_membed(int argc,char *argv[])
55 const char *desc[] = {
56 "[TT]g_membed[tt] embeds a membrane protein into an equilibrated lipid bilayer at the position",
57 "and orientation specified by the user.[PAR]",
58 "SHORT MANUAL[BR]------------[BR]",
59 "The user should merge the structure files of the protein and membrane (+solvent), creating a",
60 "single structure file with the protein overlapping the membrane at the desired position and",
61 "orientation. The box size is taken from the membrane structure file. The corresponding topology",
62 "files should also be merged. Consecutively, create a [TT].tpr[tt] file (input for [TT]g_membed[tt]) from these files,"
63 "with the following options included in the [TT].mdp[tt] file.[BR]",
64 " - [TT]integrator = md[tt][BR]",
65 " - [TT]energygrp = Protein[tt] (or other group that you want to insert)[BR]",
66 " - [TT]freezegrps = Protein[tt][BR]",
67 " - [TT]freezedim = Y Y Y[tt][BR]",
68 " - [TT]energygrp_excl = Protein Protein[tt][BR]",
69 "The output is a structure file containing the protein embedded in the membrane. If a topology",
70 "file is provided, the number of lipid and ",
71 "solvent molecules will be updated to match the new structure file.[BR]",
72 "For a more extensive manual see Wolf et al, J Comp Chem 31 (2010) 2169-2174, Appendix.[PAR]",
73 "SHORT METHOD DESCRIPTION[BR]",
74 "------------------------[BR]",
75 "1. The protein is resized around its center of mass by a factor [TT]-xy[tt] in the xy-plane",
76 "(the membrane plane) and a factor [TT]-z[tt] in the [IT]z[it]-direction (if the size of the",
77 "protein in the z-direction is the same or smaller than the width of the membrane, a",
78 "[TT]-z[tt] value larger than 1 can prevent that the protein will be enveloped by the lipids).[BR]",
79 "2. All lipid and solvent molecules overlapping with the resized protein are removed. All",
80 "intraprotein interactions are turned off to prevent numerical issues for small values of [TT]-xy[tt]",
82 "3. One md step is performed.[BR]",
83 "4. The resize factor ([TT]-xy[tt] or [TT]-z[tt]) is incremented by a small amount ((1-xy)/nxy or (1-z)/nz) and the",
84 "protein is resized again around its center of mass. The resize factor for the xy-plane",
85 "is incremented first. The resize factor for the z-direction is not changed until the [TT]-xy[tt] factor",
86 "is 1 (thus after [TT]-nxy[tt] iterations).[BR]",
87 "5. Repeat step 3 and 4 until the protein reaches its original size ([TT]-nxy[tt] + [TT]-nz[tt] iterations).[BR]",
88 "For a more extensive method description see Wolf et al, J Comp Chem, 31 (2010) 2169-2174.[PAR]",
90 " - Protein can be any molecule you want to insert in the membrane.[BR]",
91 " - It is recommended to perform a short equilibration run after the embedding",
92 "(see Wolf et al, J Comp Chem 31 (2010) 2169-2174), to re-equilibrate the membrane. Clearly",
93 "protein equilibration might require longer.[PAR]"
96 { efTPX, "-f", "into_mem", ffREAD },
97 { efNDX, "-n", "index", ffOPTRD },
98 { efTOP, "-p", "topol", ffOPTRW },
99 { efTRN, "-o", NULL, ffWRITE },
100 { efXTC, "-x", NULL, ffOPTWR },
101 { efSTO, "-c", "membedded", ffWRITE },
102 { efEDR, "-e", "ener", ffWRITE },
103 { efDAT, "-dat", "membed", ffWRITE }
105 #define NFILE asize(fnm)
107 /* Command line options ! */
114 real probe_rad = 0.22;
118 gmx_bool bALLOW_ASYMMETRY=FALSE;
119 gmx_bool bStart=FALSE;
121 gmx_bool bVerbose=FALSE;
122 char *mdrun_path=NULL;
124 /* arguments relevant to OPENMM only*/
126 gmx_fatal(FARGS,"g_membed not implemented for openmm");
130 { "-xyinit", FALSE, etREAL, {&xy_fac},
131 "Resize factor for the protein in the xy dimension before starting embedding" },
132 { "-xyend", FALSE, etREAL, {&xy_max},
133 "Final resize factor in the xy dimension" },
134 { "-zinit", FALSE, etREAL, {&z_fac},
135 "Resize factor for the protein in the z dimension before starting embedding" },
136 { "-zend", FALSE, etREAL, {&z_max},
137 "Final resize faction in the z dimension" },
138 { "-nxy", FALSE, etINT, {&it_xy},
139 "Number of iteration for the xy dimension" },
140 { "-nz", FALSE, etINT, {&it_z},
141 "Number of iterations for the z dimension" },
142 { "-rad", FALSE, etREAL, {&probe_rad},
143 "Probe radius to check for overlap between the group to embed and the membrane"},
144 { "-pieces", FALSE, etINT, {&pieces},
145 "Perform piecewise resize. Select parts of the group to insert and resize these with respect to their own geometrical center." },
146 { "-asymmetry",FALSE, etBOOL,{&bALLOW_ASYMMETRY},
147 "Allow asymmetric insertion, i.e. the number of lipids removed from the upper and lower leaflet will not be checked." },
148 { "-ndiff" , FALSE, etINT, {&low_up_rm},
149 "Number of lipids that will additionally be removed from the lower (negative number) or upper (positive number) membrane leaflet." },
150 { "-maxwarn", FALSE, etINT, {&maxwarn},
151 "Maximum number of warning allowed" },
152 { "-start", FALSE, etBOOL, {&bStart},
153 "Call mdrun with membed options" },
154 { "-stepout", FALSE, etINT, {&nstepout},
155 "HIDDENFrequency of writing the remaining runtime" },
156 { "-v", FALSE, etBOOL,{&bVerbose},
157 "Be loud and noisy" },
158 { "-mdrun_path", FALSE, etSTR, {&mdrun_path},
159 "Path to the mdrun executable compiled with this g_membed version" }
164 char buf[256],buf2[64];
167 parse_common_args(&argc,argv,0, NFILE,fnm,asize(pa),pa,
168 asize(desc),desc,0,NULL, &oenv);
170 data_out = ffopen(opt2fn("-dat",NFILE,fnm),"w");
172 fprintf(data_out,"nxy = %d\nnz = %d\nxyinit = %f\nxyend = %f\nzinit = %f\nzend = %f\n"
173 "rad = %f\npieces = %d\nasymmetry = %s\nndiff = %d\nmaxwarn = %d\n",
174 it_xy,it_z,xy_fac,xy_max,z_fac,z_max,probe_rad,pieces,
175 bALLOW_ASYMMETRY ? "yes" : "no",low_up_rm,maxwarn);
179 sprintf(buf,"%s -s %s -membed %s -o %s -c %s -e %s -nt 1 -cpt -1",
180 (mdrun_path==NULL) ? "mdrun" : mdrun_path,
181 opt2fn("-f",NFILE,fnm),opt2fn("-dat",NFILE,fnm),opt2fn("-o",NFILE,fnm),
182 opt2fn("-c",NFILE,fnm),opt2fn("-e",NFILE,fnm));
184 if (opt2bSet("-n",NFILE,fnm))
186 sprintf(buf2," -mn %s",opt2fn("-n",NFILE,fnm));
190 if (opt2bSet("-x",NFILE,fnm))
192 sprintf(buf2," -x %s",opt2fn("-x",NFILE,fnm));
196 if (opt2bSet("-p",NFILE,fnm))
198 sprintf(buf2," -mp %s",opt2fn("-p",NFILE,fnm));
204 sprintf(buf2," -v -stepout %d",nstepout);
210 printf("Start run with:\n%s\n",buf);
211 bSucces = system(buf);
215 printf("You can membed your protein now by:\n%s\n",buf);
218 fprintf(stderr,"Please cite:\nWolf et al, J Comp Chem 31 (2010) 2169-2174.\n");