Пример #1
0
int Read_Soft_DihedralList(void)
{
    FILE *fIn;
    int ReadItem;
    char szLine[256], *ReadLine, ErrorMsg[256], szFlag[256];

    n_Phi = 0;

    fIn = fopen(szPhiToScan, "r");

    while(1)	{
        if(feof(fIn))	{
            sprintf(ErrorMsg, "Fail to open file: %s\nQuit\n", szPhiToScan);
            Quit_With_Error_Msg(ErrorMsg);
        }
        ReadLine = fgets(szLine, 128, fIn);
        if(ReadLine == NULL)	{
            break;
        }

        ReadItem = sscanf(szLine, "%d %d %d %d %s",
                          &(DihList[n_Phi][0]), &(DihList[n_Phi][1]), &(DihList[n_Phi][2]), &(DihList[n_Phi][3]), szFlag);

        if(ReadItem >= 4)	{
            DihList[n_Phi][0]--;
            DihList[n_Phi][1]--;
            DihList[n_Phi][2]--;
            DihList[n_Phi][3]--;
            IdxDihSelect[n_Phi] = Mol_ESP.Query_Dihedral_Index(DihList[n_Phi][0], DihList[n_Phi][1], DihList[n_Phi][2], DihList[n_Phi][3]);

            if(IdxDihSelect[n_Phi] < 0)	{
                Quit_With_Error_Msg("Fail to identify the index of one soft dihedral.\n");
            }

            Is_Dih_Fixed[n_Phi] = 0;
            if(ReadItem==5)	{
                if( (strcmp(szFlag, "F")==0) || (strcmp(szFlag, "f")==0) )	{
                    Is_Dih_Fixed[n_Phi] = 1;
                }
            }

            n_Phi++;
        }
        else	{
            break;
        }
    }

    fclose(fIn);

    Setup_Phi_Constraint_List();

    return n_Phi;
}
Пример #2
0
int Read_Soft_DihedralList(void)
{
	FILE *fIn;
	int ReadItem;
	char szLine[256], *ReadLine;

	n_Phi = 0;

	fIn = fopen(szPhiToScan, "r");

	while(1)	{
		if(feof(fIn))	{
			break;
		}
		ReadLine = fgets(szLine, 128, fIn);
		if(ReadLine == NULL)	{
			break;
		}

		ReadItem = sscanf(szLine, "%d %d %d %d %lf %lf %lf %lf %lf %lf", 
			&(DihList[n_Phi][0]), &(DihList[n_Phi][1]), &(DihList[n_Phi][2]), &(DihList[n_Phi][3]), 
			&(Phi_Set[n_Phi][0]), &(Phi_Set[n_Phi][1]), &(Phi_Set[n_Phi][2]), &(Phi_Set[n_Phi][3]), &(Phi_Set[n_Phi][4]), &(Phi_Set[n_Phi][5]));

		if(ReadItem > 4)	{
			DihList[n_Phi][0]--;
			DihList[n_Phi][1]--;
			DihList[n_Phi][2]--;
			DihList[n_Phi][3]--;
			IdxDihSelect[n_Phi] = Mol.Query_Dihedral_Index(DihList[n_Phi][0], DihList[n_Phi][1], DihList[n_Phi][2], DihList[n_Phi][3]);

			if(IdxDihSelect[n_Phi] < 0)	{
				Quit_With_Error_Msg("Fail to identify the index of one soft dihedral.\n");
			}
			Mol.BuildSegmentList_Dihedrals(IdxDihSelect[n_Phi]);

			n_State_List[n_Phi] = ReadItem - 4;
			n_Phi++;
		}
		else	{
			break;
		}
	}

	fclose(fIn);

	memcpy(Phi_Set_Save, Phi_Set, sizeof(double)*N_MAX_DIH*MAX_N_STATE);
	memcpy(n_State_List_Save, n_State_List, sizeof(int)*N_MAX_DIH);

	return n_Phi;
}
Пример #3
0
int Read_Soft_DihedralList(void)
{
	FILE *fIn;
	int ReadItem;
	char szLine[256], *ReadLine;

	n_Phi = 0;

	fIn = fopen(szPhiToScan, "r");

	while(1)	{
		if(feof(fIn))	{
			break;
		}
		ReadLine = fgets(szLine, 128, fIn);
		if(ReadLine == NULL)	{
			break;
		}

		ReadItem = sscanf(szLine, "%d %d %d %d", 
			&(DihList[n_Phi][0]), &(DihList[n_Phi][1]), &(DihList[n_Phi][2]), &(DihList[n_Phi][3]));

		if(ReadItem == 4)	{
			DihList[n_Phi][0]--;
			DihList[n_Phi][1]--;
			DihList[n_Phi][2]--;
			DihList[n_Phi][3]--;
			IdxDihSelect[n_Phi] = Mol_ESP.Query_Dihedral_Index(DihList[n_Phi][0], DihList[n_Phi][1], DihList[n_Phi][2], DihList[n_Phi][3]);

			if(IdxDihSelect[n_Phi] < 0)	{
				Quit_With_Error_Msg("Fail to identify the index of one soft dihedral.\n");
			}
			n_Phi++;
		}
		else	{
			break;
		}
	}

	fclose(fIn);

	Setup_Phi_Constraint_List();

	return n_Phi;
}