--- "GMX2019\\do_x3dna.cpp" 2018-12-13 19:06:05.000000000 +0300 +++ "GMX2016\\do_x3dna.cpp" 2021-02-07 23:08:52.595919100 +0300 @@ -68,6 +68,12 @@ #include "../ExtractData.h" #include "do_x3dna.h" +#if GMX_NATIVE_WINDOWS +#define NULL_DEVICE "nul" +#else +#define NULL_DEVICE "/dev/null" +#endif + void CopyRightMsg() { const char *copyright[] = { @@ -1449,17 +1455,17 @@ dptr=getenv("X3DNA"); if (!gmx_fexist(dptr)) gmx_fatal(FARGS,"$X3DNA environment not found", dptr); - sprintf(find_pair_cmd,"$X3DNA/bin/find_pair %s %s %s",pdbfile, inpfile, bVerbose?"":"2> /dev/null"); + sprintf(find_pair_cmd,"%s/bin/find_pair %s %s %s", dptr, pdbfile, inpfile, bVerbose?"":"2> " NULL_DEVICE ); if (bVerbose) fprintf(stderr,"find_pair command='%s'\n",find_pair_cmd); //Creating variable for executing command of analyze from X3DNA if (bAnalyzeC_Option) - sprintf(analyze_cmd,"$X3DNA/bin/analyze -c %s %s", inpfile,bVerbose?"":"2> /dev/null"); + sprintf(analyze_cmd,"%s/bin/analyze -c %s %s", dptr, inpfile,bVerbose?"":"2> " NULL_DEVICE); else - sprintf(analyze_cmd,"$X3DNA/bin/analyze %s %s", inpfile,bVerbose?"":"2> /dev/null"); + sprintf(analyze_cmd,"%s/bin/analyze %s %s", dptr, inpfile,bVerbose?"":"2> " NULL_DEVICE); if (bVerbose) - fprintf(stderr,"find_pair command='%s'\n",analyze_cmd); + fprintf(stderr,"analyze command='%s'\n",analyze_cmd); //Reading first frame natoms=read_first_x(oenv,&status,ftp2fn(efTRX,NFILE,fnm),&t,&x,box); @@ -1473,8 +1479,10 @@ // Translate the frame to origin, fit (by rotating) it to reference structure // and translate again the frame to original position of reference structure - reset_x(nfit,ifit,top.atoms.nr,NULL,x,w_rls); - do_fit(natoms,w_rls,xref,x); + // reset_x(nfit,ifit,top.atoms.nr,NULL,x,w_rls); + reset_x(nfit, ifit, natoms, NULL, x, w_rls); + + do_fit(natoms,w_rls,xref,x); for (i = 0; (i < natoms); i++) rvec_inc(x[i], x_shift); } @@ -1554,33 +1562,39 @@ //*************************************************************************************** //START of Trajectory loop //*************************************************************************************** - do { - gmx_rmpbc(gpbc,natoms,box,x); + do { + gmx_rmpbc(gpbc, natoms, box, x); //Fitting the frame to reference structure - if (bFit) { - // Translate the frame to origin, fit (by rotating) it to reference structure - // and translate again the frame to original position of reference structure - reset_x(nfit,ifit,top.atoms.nr,NULL,x,w_rls); - do_fit(natoms,w_rls,xref,x); - for (i = 0; (i < natoms); i++) - rvec_inc(x[i], x_shift); + if (bFit) { + // Translate the frame to origin, fit (by rotating) it to reference structure + // and translate again the frame to original position of reference structure + // reset_x(nfit,ifit,top.atoms.nr,NULL,x,w_rls); + reset_x(nfit, ifit, natoms, NULL, x, w_rls); + do_fit(natoms, w_rls, xref, x); + for (i = 0; (i < natoms); i++) + rvec_inc(x[i], x_shift); } //tapein=gmx_ffopen(pdbfile,"w"); //write_pdbfile_indexed(tapein,NULL,atoms,x,ePBC,box,' ',-1,gnx,index,NULL,TRUE); - write_sto_conf_indexed(pdbfile, nullptr, &top.atoms, x, nullptr, ePBC, box, gnx, index); + write_sto_conf_indexed(pdbfile, nullptr, &top.atoms, x, nullptr, ePBC, box, gnx, index); //gmx_ffclose(tapein); //Executing program $X3DNA/bin/find_pair - if(!bRef) - if(0 != system(find_pair_cmd)) - gmx_fatal(FARGS,"Failed to execute command: %s",find_pair_cmd); - + if (!bRef) { + int i; + for (i = 0; i < 3 && 0 != system(find_pair_cmd); ++i); + if ( i>=3 ) + gmx_fatal(FARGS, "Failed to execute command: %s", find_pair_cmd); + } //Executing program $X3DNA/bin/analyze - if(0 != system(analyze_cmd)) - gmx_fatal(FARGS,"Failed to execute command: %s",analyze_cmd); - + { + int i; + for (i = 0; i < 3 && 0 != system(analyze_cmd); ++i); + if (i >= 3) + gmx_fatal(FARGS, "Failed to execute command: %s", analyze_cmd); + } write_time(t, f_cum_data); num_bp = add_data_to_files(x3dna_out_file, f_cum_data); fprintf(fnum_bp,"%12.7f %d \n",t, num_bp);