// LMOD reverse communication external minimization package. // Written by Istvan Kolossvary. #include "xmin_opt.h" #include "lmod_opt.h" // M A I N PROGRAM to carry out LMOD simulation on a molecule: struct xmin_opt xo; struct lmod_opt lo; molecule mol; int natm; float energy; int lig_start[dynamic], lig_end[dynamic], lig_cent[dynamic]; float x[dynamic], g[dynamic], conflib[dynamic], x_ref[dynamic], lmod_traj[dynamic]; float tr_min[dynamic], tr_max[dynamic], rot_min[dynamic], rot_max[dynamic]; float glob_min_energy; point dummy; float ene, grms; int i, max_nof_pdb_files; string fname, sys_command; int ier, mytaskid, numtasks; xmin_opt_init(xo); // set up defaults mol = getpdb("1lgu.lig.1.pdb"); readparm(mol, "1lgu.lig.1.top"); natm = mol.natoms; allocate x[3 * natm]; allocate g[3 * natm]; allocate x_ref[3 * natm]; getxyz("1lgu.lig.1.min1.x", natm, x); mm_options("ntpr=9999,gb=1,kappa=0.10395,rgbmax=40.,cut=60.0,diel=C "); mme_init(mol, NULL, "::ZZZ", dummy, NULL); lmod_opt_init(lo, xo); // set up defaults // Conf search: lo.niter = 2; lo.nconf = 10; lo.minim_grms = 0.01; lo.nmod = 10; lo.kmod = 5; lo.nrotran_dof = 6; lo.energy_window = 50.0; lo.eig_recalc = lo.niter + 1; lo.ndim_arnoldi = 50; lo.lmod_restart = 20; lo.n_best_struct = 10; lo.mc_option = 2; lo.rtemp = 3.0; lo.lmod_step_size_min = 2.0; lo.lmod_step_size_max = 5.0; lo.nof_lmod_steps = 0; lo.lmod_relax_grms = 1.0; lo.nlig = 1; lo.random_seed = 0; lo.print_level = 2; allocate conflib[lo.nconf * 3 * natm]; allocate lmod_traj[(lo.niter + 1) * 3 * natm]; allocate tr_min[lo.nlig]; allocate tr_max[lo.nlig]; allocate rot_min[lo.nlig]; allocate rot_max[lo.nlig]; allocate lig_start[lo.nlig]; allocate lig_end[lo.nlig]; allocate lig_cent[lo.nlig]; tr_min[1] = 0.1; tr_max[1] = 1.0; rot_min[1] = 30.0; rot_max[1] = 180.0; lig_start[1] = 2602; lig_end[1] = 2615; lig_cent[1] = 0; setmol_from_xyz(mol, NULL, x); // load minimized coords into mol setxyz_from_mol(mol, NULL, x_ref); // save minimized coords in x_ref putpdb(argv[2] + ".min.pdb", mol); putxyz(argv[2] + ".min.x", mol.natoms, x_ref); // tether central benzene ring to automatically align conformations: mm_options("wcons=200.0,ntpr=9999 "); mme_init(mol, NULL, ":1-75,125-162:", x_ref, NULL); ene = mme(x, g, 1); if( mytaskid == 0 ) printf(" frozen minimized energy = %12.3lf\n", ene); glob_min_energy = lmod(natm, x, g, ene, conflib, lmod_traj, lig_start, lig_end, lig_cent, tr_min, tr_max, rot_min, rot_max, xo, lo); if (mytaskid == 0) { printf(" Glob. min. E = %12.3lf kcal/mol\n", glob_min_energy); printf(" Time in LMOD = %12.3lf CPU sec\n", lo.lmod_time); printf(" Time in NAB and libs = %12.3lf CPU sec\n", lo.aux_time); } // Re-minimize structures with no restraints and save them xmin_opt_init(xo); // set up defaults mme_init(mol, NULL, "::ZZZ", dummy, NULL); xo.maxiter = 10000; xo.grms_tol = 0.01; xo.method = 2; xo.m_lbfgs = 3; xo.print_level = 0; if (mytaskid == 0) printf("\n Unfrozen minimized energies:\n"); mm_options("ntpr=100 "); max_nof_pdb_files = lo.nconf; if (max_nof_pdb_files > lo.nconf) max_nof_pdb_files = lo.nconf; for (i = 1; i <= max_nof_pdb_files; i = i + 1) { setmol_from_xyz(mol, NULL, conflib[(i - 1) * 3 * natm + 1]); // read i-th conf setxyz_from_mol(mol, NULL, x); // load it to x[] ene = xmin(natm, x, g, ene, grms, xo); // re-minimize setmol_from_xyz(mol, NULL, x); // load x[] into mol if( mytaskid == 0 ) printf(" conf %3d E = %12.3lf (%12.3lf)\n", i, ene, grms); fname = sprintf("vanco_lmod_dock%04d.pdb", i); putpdb(fname, mol, "-brook"); // save conf in pdb file } if (mytaskid == 0) { // Load the individual pdb files into a single, multi-pdb file system("touch vanco_lmod_dock_conf.pdb"); for (i = 1; i <= max_nof_pdb_files; i = i + 1) { sys_command = sprintf("echo 'MODEL%8d' >> vanco_lmod_dock_conf.pdb", i); system(sys_command); sys_command = sprintf ("cat 'vanco_lmod_dock%04d.pdb' >> vanco_lmod_dock_conf.pdb", i); system(sys_command); system("echo 'ENDMDL' >> vanco_lmod_dock_conf.pdb"); } } // E N D MAIN