void SaveOptPdb(char szName[]) { int i; for(i=0; i<n_Phi; i++) { Mol.QueryDihedral(IdxDihSelect[i]); Mol.Edit_Dihedral(IdxDihSelect[i], Phi_To_Set_Scan[i]); } Mol.SavePdb(szName); }
void MM_Fixed_1D_Scan(void) { int i, Phi, Count; RestoreCoordinates(); for(i=0; i<n_Phi; i++) { Mol.QueryDihedral(IdxDihSelect[i]); Mol.Edit_Dihedral(IdxDihSelect[i], Phi_To_Set[i]); } Count = 0; for(Phi=-180; Phi<=180; Phi+=BIN_SIZE) { // 1D scan for this rotamer Phi_To_Set[Active_Phi] = Phi*1.0; Mol.QueryDihedral(IdxDihSelect[Active_Phi]); Mol.Edit_Dihedral(IdxDihSelect[Active_Phi], Phi_To_Set[Active_Phi]); E_Phi[Count] = Mol.Cal_E(0); Count++; } return; }
void Output_Gaussian_File(void) { FILE *fOut, *fIn; int i, nAtom, IdxScan; char szNameGjf[256], szCmd[256], szName_Output[256]; Determine_QM_Scan_Part(); nAtom = Mol.nAtom; for(IdxScan=0; IdxScan<n_QM_Part; IdxScan++) { Mol.QueryDihedral(IdxDihSelect[Active_Phi]); Mol.Edit_Dihedral(IdxDihSelect[Active_Phi], Phi_QM_Start[IdxScan]); sprintf(szNameGjf, "qm-scan-%d-%d.gjf", Active_Phi+1, IdxScan+1); fOut = fopen(szNameGjf, "w"); fprintf(fOut, "%s", szQM_Level_1D_Scan_Cmd); for(i=0; i<nAtom; i++) { // fprintf(fOut, "%c %9.5lf %9.5lf %9.5lf\n", Mol.AtomName[i][0], Mol.x[i], Mol.y[i], Mol.z[i]); fprintf(fOut, "%s %9.5lf %9.5lf %9.5lf\n", szElemName[i], Mol.x[i], Mol.y[i], Mol.z[i]); } fprintf(fOut, "\n"); for(i=0; i<n_Phi; i++) { if(i == Active_Phi) { fprintf(fOut, "%s", szQM_Scan[IdxScan]); } else { fprintf(fOut, "%d %d %d %d F\n", DihList[i][0]+1, DihList[i][1]+1, DihList[i][2]+1, DihList[i][3]+1); } } fprintf(fOut, "\n"); fclose(fOut); sprintf(szName_Output, "qm-1d-phi-%d-p%d.out", Active_Phi+1, IdxScan+1); sprintf(szCmd, "%s < %s > %s", szExe_G09, szNameGjf, szName_Output); fIn = fopen(szName_Output, "r"); if(fIn == NULL) { system(szCmd); } else { fclose(fIn); } Extract_Coord_E(szName_Output, Active_Phi, IdxScan); } }
int main(int argc, char **argv) { int i; FILE *fOut; char szName[256]; fFile_Run_Log = fopen("qm-1d-scan.log", "w"); // MPI_Init(&argc, &argv); // MPI_Comm_rank(MPI_COMM_WORLD, &ProgID); // MPI_Comm_size(MPI_COMM_WORLD, &nProc); Get_EXE_Path("G09_EXE_PATH", szExe_G09); n_Bins = 360/BIN_SIZE+1; ForceField.ReadForceField(szForceFiled); Mol.ReadPSF(szXpsfFile, 0); Get_Netcharge_From_Xpsf(); Setup_QM_Level(); ReadElementList(); Mol.AssignForceFieldParameters(&ForceField); Mol.ReadCRD(szCrdFile); BackupCoordinates(); Read_Soft_DihedralList(); for(Active_Phi=0; Active_Phi<n_Phi; Active_Phi++) { RestoreCoordinates(); for(i=0; i<n_Phi; i++) { Phi_To_Set[i] = Mol.QueryDihedral(IdxDihSelect[i]); Mol.Edit_Dihedral(IdxDihSelect[i], Phi_To_Set[i]); } MM_Fixed_1D_Scan(); E_Barrier_Lowest = Get_Barrier(E_Phi, n_Bins, E_Min, Phi_Save); E_Min_Save = E_Min; E_Min_Org = E_Min + E_RANGE; memcpy(E_Scan, E_Phi, sizeof(double)*n_Bins); memcpy(Phi_To_Set_Scan, Phi_To_Set, sizeof(double)*n_Phi); Phi_To_Set_Scan[Active_Phi] = Phi_Save; sprintf(szName, "ini-%d.dat", Active_Phi+1); fOut = fopen(szName, "w"); for(i=0; i<n_Bins; i++) { fprintf(fOut, "%5d %8.5E\n", -180+i*BIN_SIZE, E_Scan[i]-E_Min); } fclose(fOut); sprintf(szName, "ini-%d.pdb", Active_Phi+1); SaveOptPdb(szName); n_State_List[Active_Phi] = 1; Enumerate_Dihedrals(0); n_State_List[Active_Phi] = n_State_List_Save[Active_Phi]; sprintf(szName, "end-%d.dat", Active_Phi+1); fOut = fopen(szName, "w"); for(i=0; i<n_Bins; i++) { fprintf(fOut, "%5d %8.5E\n", -180+i*BIN_SIZE, E_Scan[i]-E_Min_Save); } fclose(fOut); sprintf(szName, "end-%d.pdb", Active_Phi+1); SaveOptPdb(szName); sprintf(szName, "phi-%d.dat", Active_Phi+1); fOut = fopen(szName, "w"); for(i=0; i<n_Phi; i++) { fprintf(fOut, "%lf\n", Phi_To_Set_Scan[i]); } fclose(fOut); Output_Gaussian_File(); } Reorganize_QM_1D_Scan_Data(); fclose(fFile_Run_Log); // MPI_Barrier(MPI_COMM_WORLD); // MPI_Finalize(); return 0; }
int main(int argc, char **argv) { int i; FILE *fOut; char szName[256], *szEnv; // SetEnvironmentVariable(szGAUSS_SCRDIR, "c:\\1"); fFile_Run_Log = fopen("qm-1d-scan.log", "w"); szEnv = getenv(szGAUSS_SCRDIR); if (szEnv == NULL) { Quit_With_Error_Msg("Environment variable $GAUSS_SCRDIR is NOT set.\nQuit\n"); } strcpy(szGAUSS_SCRDIR_Base, szEnv); Get_EXE_Path("G09_EXE_PATH", szExe_G09); n_Bins = 360/BIN_SIZE+1; ForceField.ReadForceField(szForceFiled); Mol.ReadPSF(szXpsfFile, 0); Get_Netcharge_From_Xpsf(); Setup_QM_Level(); ReadElementList(); Mol.AssignForceFieldParameters(&ForceField); Mol.ReadCRD(szCrdFile); BackupCoordinates(); Read_Soft_DihedralList(); nJob = nJobDone = 0; for(Active_Phi=0; Active_Phi<n_Phi; Active_Phi++) { RestoreCoordinates(); for(i=0; i<n_Phi; i++) { Phi_To_Set[i] = Mol.QueryDihedral(IdxDihSelect[i]); Mol.Edit_Dihedral(IdxDihSelect[i], Phi_To_Set[i]); } MM_Fixed_1D_Scan(); E_Barrier_Lowest = Get_Barrier(E_Phi, n_Bins, E_Min, Phi_Save); E_Min_Save = E_Min; E_Min_Org = E_Min + E_RANGE; memcpy(E_Scan, E_Phi, sizeof(double)*n_Bins); memcpy(Phi_To_Set_Scan, Phi_To_Set, sizeof(double)*n_Phi); Phi_To_Set_Scan[Active_Phi] = Phi_Save; sprintf(szName, "ini-%d.dat", Active_Phi+1); fOut = fopen(szName, "w"); for(i=0; i<n_Bins; i++) { fprintf(fOut, "%5d %8.5E\n", -180+i*BIN_SIZE, E_Scan[i]-E_Min); } fclose(fOut); sprintf(szName, "ini-%d.pdb", Active_Phi+1); SaveOptPdb(szName); n_State_List[Active_Phi] = 1; Enumerate_Dihedrals(0); n_State_List[Active_Phi] = n_State_List_Save[Active_Phi]; sprintf(szName, "end-%d.dat", Active_Phi+1); fOut = fopen(szName, "w"); for(i=0; i<n_Bins; i++) { fprintf(fOut, "%5d %8.5E\n", -180+i*BIN_SIZE, E_Scan[i]-E_Min_Save); } fclose(fOut); sprintf(szName, "end-%d.pdb", Active_Phi+1); SaveOptPdb(szName); sprintf(szName, "phi-%d.dat", Active_Phi+1); fOut = fopen(szName, "w"); for(i=0; i<n_Phi; i++) { fprintf(fOut, "%lf\n", Phi_To_Set_Scan[i]); } fclose(fOut); Output_Gaussian_File(); } if(nJob > 0) { RunAllJobs(); Exatract_All_Info_QM_1D_Scan(); Reorganize_QM_1D_Scan_Data(); } fclose(fFile_Run_Log); return 0; }