/* ************************************************************************ * All Copyright Reserved! * * * * Prog: prepgen * * Version: version 1.0 * * Author: Junmei Wang * * * * Department of Pharmaceutical Chemistry * * School of Pharmacy * * University of California * * San Francisco CA 94143 * * Octomber, 2001 * ************************************************************************ */ char *amberhome; # include "common.h" # include "define.h" # include "atom.h" # include "utility.c" # include "common.c" # include "rotate.c" # include "ring.c" # include "ac.c" char ifilename[MAXCHAR]; char ofilename[MAXCHAR]; char inf_filename[MAXCHAR] = "PREP.INF"; char mc_filename[MAXCHAR]; char pdbfilename[MAXCHAR] = "NEWPDB.PDB"; char mcfilename[30] = "MAINCHAIN.DAT"; FILE *fpin; FILE *fpout; FILE *fprep; FILE *fptest; FILE *fppdb; char line[MAXCHAR]; int i, j, k, l; int mainatomnum = 0; int selectnum = 0; int connum = 0; int countatom = 4; int cartindex = 0; /*0 for internal format and 1 for cartesian format*/ char head[6]; char tail[6]; char preheadtype[6]; char posttailtype[6]; int read_mc_index = 0; int headno = 0; int tailno = 0; int omitnum = 0; double charge = 9999.; int atomnum = 0; int bondnum = 0; int ringnum = 0; ATOM *atom; AROM *arom; BOND *bond; RING *ring; ATOM *newatom; ATOM *atoma; NAME *mc_name; NAME *omit; int *selectchain; int *mainatom; int *selectindex; int *seq1; int *seq2; int *connumbak; int *omitno; int *posindex; MOLINFO minfo; CONTROLINFO cinfo; int adjust_atom_seq_order = 1; /* sometimes no valid prepc or prepi can be generated without adjusting the sequence order of atoms, should verify the topolgy file using xleap */ int jbond (int at1, int at2) { int i; for(i=0;i 0) read_mc_index = 2; else read_mc_index = 1; for (i = 0; i < number1 + num_ter_atom; i++) printf("\nMAIN_CHAIN %5d%5d%5s", i + 1, mainatom[i] + 1, atom[mainatom[i]].name); for (j = 0; j < number2; j++) for (i = 0; i < atomnum; i++) if (strcmp(omit[j].name, atom[i].name) == 0) { omitno[j] = i; num_omitted_atom ++; printf("\nOMIT_ATOM %5d%5d%5s", num_omitted_atom, omitno[j] + 1, atom[i].name); break; } mainatomnum = number1 + num_ter_atom; omitnum = number2; fclose(fpin); printf ("\nNumber of mainchain atoms (including head and tail atom): %5d", mainatomnum); printf("\nNumber of omited atoms: %5d", omitnum); } void adjustid(void) { int i, j; int num; num = 0; for (i = 0; i < atomnum; i++) if (strcmp(head, atom[i].name) == 0) { headno = i; mainatom[num] = headno; num++; } for (j = 0; j < mainatomnum; j++) for (i = 0; i < atomnum; i++) if (strcmp(mc_name[j].name, atom[i].name) == 0) { mainatom[num] = i; num++; break; } for (i = 0; i < atomnum; i++) if (strcmp(tail, atom[i].name) == 0) { tailno = i; mainatom[num] = tailno; num++; } } void improper(void) { int i, j; int index; int tmpint; for (i = 0; i < atomnum; i++) { /*for sp2 carbon */ if (atom[i].atomicnum == 6 && atom[i].connum == 3) atom[i].improper = 1; /*for planar nitrogen */ if (atom[i].atomicnum == 7 && atom[i].connum == 3 && (arom[i].ar1 >= 1 || arom[i].ar2 >= 1 || arom[i].ar3 >= 1)) atom[i].improper = 1; /* amide nitrogen */ if ((atom[i].ambername[0] == 'c' && atom[i].ambername[1] == ' ' ) || (atom[i].ambername[0] == 'c' && strlen(atom[i].ambername) == 1) || (atom[i].ambername[0] == 'C' && atom[i].ambername[1] == ' ' ) || (atom[i].ambername[0] == 'C' && strlen(atom[i].ambername) == 1)) { index = 0; for (j = 0; j < 3; j++) { tmpint = atom[i].con[j]; if (tmpint == -1) break; if (atom[tmpint].atomicnum == 7) { index = 1; break; } } if (index == 1) { atom[i].improper = 1; atom[tmpint].improper = 1; } } /*special treatment for those prep files saved from leap*/ if (atom[i].atomicnum == 6 && atom[i].connum == 2 && atom[i].ambername[0] == 'C' && (atom[i].ambername[1] == ' ' || atom[i].ambername[1] == '\0')) atom[i].improper = 1; if (atom[i].atomicnum == 7 && atom[i].connum == 2 && atom[i].ambername[0] == 'N' && (atom[i].ambername[1] == ' ' || atom[i].ambername[1] == '\0')) atom[i].improper = 1; /* check for NH2 group attached to aromatic ring: */ if (atom[i].atomicnum == 7 && arom[i].ar1 == 0 && arom[i].ar2 == 0 && arom[i].ar3 == 0 &&atom[i].connum == 3) { index = 0; for (j = 0; j < 3; j++) { tmpint = atom[i].con[j]; if (tmpint == -1) break; if (arom[tmpint].ar1 >= 1 || arom[tmpint].ar2 >= 1 || arom[tmpint].ar3 >= 1) { index = 1; break; } } if (index == 1) atom[i].improper = 1; } /* fprintf( stdout, "%5d%5d%5d%5d%5d %s\n", i,atom[i].atomicnum,atom[i].connum,atom[i].arom, atom[i].improper, atom[i].ambername ); */ } } void postprep() { int i, j, k; int initindex; int tmpint1, tmpint2, tmpint3; int bond, angle, twist; int flag; double bondv, anglev, twistv; double tmpx, tmpy, tmpz; char tmpchar[MAXCHAR]; char array[3][MAXCHAR]; char array0[3][MAXCHAR]; int *connum; NAME *aatype; aatype = (NAME *) malloc(sizeof(NAME) * (atomnum + 10)); if (aatype == NULL) { fprintf(stdout, "memory allocation error for *aatype\n"); exit(1); } connum = (int *) malloc(sizeof(int) * (atomnum + 10)); if (connum == NULL) { fprintf(stdout, "memory allocation error for *connum\n"); exit(1); } if ((fprep = fopen(ofilename, "w")) == NULL) { printf("\n Cannot open a file %s to write in postprep(), exit", ofilename); return; } for (i = 0; i < atomnum + 3; i++) { connum[i] = -1; aatype[i].name[0] = 'X'; } for (i = 0; i < atomnum + 3; i++) connumbak[i] = newatom[i].connum; for (i = 3; i < atomnum + 3; i++) { for (j = 0; j < 6; j++) if (newatom[i].con[j] != -1) newatom[i].con[j] = seq2[newatom[i].con[j]]; } for (i = 3; i < atomnum + 3; i++) { connum[i] = 0; for (j = 3; j < atomnum + 3; j++) { if (seq2[newatom[i].bondatom - 3] == j) connum[i]++; if (seq2[newatom[j].bondatom - 3] == i) connum[i]++; } } for (i = 3; i < atomnum + 3; i++) for (j = i + 1; j < atomnum + 3; j++) { if (seq2[newatom[j].bondatom - 3] == i) continue; if (connum[i] < connumbak[i] && connum[j] < connumbak[j]) for (k = 0; k < 6; k++) if (newatom[i].con[k] == j) { newatom[i].connum--; newatom[j].connum--; } } for (j = 3; j < atomnum + 3; j++) { if (newatom[j].connum == 2) aatype[j].name[0] = 'S'; if (newatom[j].connum == 1) aatype[j].name[0] = 'E'; if (newatom[j].connum == 3) aatype[j].name[0] = 'B'; if (newatom[j].connum == 4) aatype[j].name[0] = '3'; if (newatom[j].connum == 5) aatype[j].name[0] = '4'; if (newatom[j].connum == 6) aatype[j].name[0] = '5'; if (newatom[j].mainatom == 1) aatype[j].name[0] = 'M'; } fprintf(fprep, "%5d%5d%5d\n\n", 0, 0, 2); fprintf(fprep, "%s\n", "This is a remark line"); fprintf(fprep, "%s\n", minfo.resfilename); if (cartindex == 1) { fprintf(fprep, "%s XYZ 0\n", minfo.resname); fprintf(fprep, "%s\n", "CHANGE OMIT DU BEG"); } else { fprintf(fprep, "%s INT 0\n", minfo.resname); fprintf(fprep, "%s\n", "CORRECT OMIT DU BEG"); } fprintf(fprep, "%s\n", " 0.0000"); if (cartindex == 0) { fprintf(fprep, "%s\n", " 1 DUMM DU M 0 -1 -2 0.000 .0 .0 .00000"); fprintf(fprep, "%s\n", " 2 DUMM DU M 1 0 -1 1.449 .0 .0 .00000"); fprintf(fprep, "%s\n", " 3 DUMM DU M 2 1 0 1.523 111.21 .0 .00000"); } if (cartindex == 1) { fprintf(fprep, "%s\n", " 1 DUMM DU M 999.000 999.0 -999.0 .00000"); fprintf(fprep, "%s\n", " 2 DUMM DU M 999.000 -999.0 999.0 .00000"); fprintf(fprep, "%s\n", " 3 DUMM DU M -999.000 999.0 999.0 .00000"); } tmpx = newatom[3].x; tmpy = newatom[3].y; tmpz = newatom[3].z; for (i = 3; i < atomnum + 3; i++) { newatom[i].x = newatom[i].x + 3.54 - tmpx; newatom[i].y = newatom[i].y + 1.42 - tmpy; /* newatom[i].z=newatom[i].z+0.0000001-tmpz; */ newatom[i].z = newatom[i].z - tmpz; } initindex = 0; for (j = 3; j < atomnum + 3; j++) { if (initindex == 0) { bond = 2; angle = 1; twist = 0; aatype[j].name[0] = 'M'; initindex = 1; } else { bond = newatom[j].bondatom - 3; bond = seq2[bond]; angle = newatom[bond].bondatom; if (angle >= 3) { angle = angle - 3; angle = seq2[angle]; } twist = newatom[angle].bondatom; if (twist >= 3) { twist = twist - 3; twist = seq2[twist]; } } bondv = (newatom[bond].x - newatom[j].x) * (newatom[bond].x - newatom[j].x); bondv += (newatom[bond].y - newatom[j].y) * (newatom[bond].y - newatom[j].y); bondv += (newatom[bond].z - newatom[j].z) * (newatom[bond].z - newatom[j].z); bondv = sqrt(bondv); anglev = anglecal(newatom[j], newatom[bond], newatom[angle]); twistv = rotate(newatom[j], newatom[bond], newatom[angle], &newatom[twist]); /* new code for building residue */ if (cartindex == 0) { fprintf(fprep, "%4d %-5s %-5s %c", j + 1, newatom[j].name, newatom[j].ambername, aatype[j].name[0]); fprintf(fprep, "%5d%4d%4d%10.3f%10.3f%10.3f%10.6f\n", bond + 1, angle + 1, twist + 1, bondv, anglev, twistv, newatom[j].charge); } if (cartindex == 1) { fprintf(fprep, "%4d %-5s %-5s %c", j + 1, newatom[j].name, newatom[j].ambername, aatype[j].name[0]); fprintf(fprep, " %10.6f%12.6f%12.6f%12.6f\n", atom[seq1[j]].x, atom[seq1[j]].y, atom[seq1[j]].z, newatom[j].charge); } } fprintf(fprep, "\n\n%s\n", "LOOP"); for (i = 3; i < atomnum + 3; i++) for (j = i + 1; j < atomnum + 3; j++) { if (seq2[newatom[j].bondatom - 3] == i) continue; if (connum[i] < connumbak[i] && connum[j] < connumbak[j]) for (k = 0; k < 6; k++) if (newatom[i].con[k] == j) fprintf(fprep, "%5s%5s\n", newatom[j].name, newatom[i].name); } fprintf(fprep, "\n%s\n", "IMPROPER"); for (i = 3; i < atomnum + 3; i++) if (newatom[i].improper != 0) { tmpint1 = newatom[i].con[0]; tmpint2 = newatom[i].con[1]; tmpint3 = newatom[i].con[2]; flag = 1; if (tmpint1 != -1) { strcpy(array[0], newatom[tmpint1].ambername); strcpy(array0[0], newatom[tmpint1].name); /* newitoa(tmpint1, tmpchar); */ sprintf(tmpchar, "%d", tmpint1); strcat(array[0], tmpchar); } else if (strcmp(head, newatom[i].name) == 0) { strcpy(array[0], preheadtype); strcpy(array0[0], "-M"); /* newitoa(tmpint1, tmpchar); */ sprintf(tmpchar, "%d", tmpint1); strcat(array[0], tmpchar); } else if (strcmp(tail, newatom[i].name) == 0) { strcpy(array[0], posttailtype); strcpy(array0[0], "+M"); /* newitoa(tmpint1, tmpchar); */ sprintf(tmpchar, "%d", tmpint1); strcat(array[0], tmpchar); } else if (newatom[i].atomicnum == 6 && newatom[i].connum == 2 && newatom[i].ambername[0] == 'C' && (newatom[i].ambername[1] == ' ' || newatom[i].ambername[1] == '\0')) { strcpy(array0[0], "+M"); sprintf(tmpchar, "%d", tmpint1); strcat(array[0], tmpchar); } else if (newatom[i].atomicnum == 7 && newatom[i].connum == 2 && newatom[i].ambername[0] == 'N' && (newatom[i].ambername[1] == ' ' || newatom[i].ambername[1] == '\0')) { strcpy(array0[0], "-M"); sprintf(tmpchar, "%d", tmpint1); strcat(array[0], tmpchar); } else { strcpy(array0[0], "M"); printf("\nWarning: ATOM %s has unfilled valence, assuming the linked atom name (in other residue) is \"M\"", newatom[i].name); printf("\n change \"M\" to \"-M\" if ATOM %s is linked to the immediate previous residue", newatom[i].name); printf("\n change \"M\" to \"+M\" if ATOM %s is linked to the immediate after residue", newatom[i].name); sprintf(tmpchar, "%d", tmpint1); strcat(array[0], tmpchar); flag = 0; } if (tmpint2 != -1) { strcpy(array[1], newatom[tmpint2].ambername); strcpy(array0[1], newatom[tmpint2].name); sprintf(tmpchar, "%d", tmpint2); /* newitoa(tmpint2, tmpchar); */ strcat(array[1], tmpchar); } else if (strcmp(head, newatom[i].name) == 0) { strcpy(array[1], preheadtype); strcpy(array0[1], "-M"); /* newitoa(tmpint2, tmpchar); */ sprintf(tmpchar, "%d", tmpint2); strcat(array[1], tmpchar); } else if (strcmp(tail, newatom[i].name) == 0) { strcpy(array[1], posttailtype); strcpy(array0[1], "+M"); /* newitoa(tmpint2, tmpchar); */ sprintf(tmpchar, "%d", tmpint2); strcat(array[1], tmpchar); } else if (newatom[i].atomicnum == 6 && newatom[i].connum == 2 && newatom[i].ambername[0] == 'C' && (newatom[i].ambername[1] == ' ' || newatom[i].ambername[1] == '\0')) { strcpy(array0[1], "+M"); sprintf(tmpchar, "%d", tmpint1); strcat(array[1], tmpchar); } else if (newatom[i].atomicnum == 7 && newatom[i].connum == 2 && newatom[i].ambername[0] == 'N' && (newatom[i].ambername[1] == ' ' || newatom[i].ambername[1] == '\0')) { strcpy(array0[1], "-M"); sprintf(tmpchar, "%d", tmpint1); strcat(array[1], tmpchar); } else { strcpy(array0[1], "M"); printf("\nWarning: ATOM %s has unfilled valence, assuming the linked atom name (in other residue) is \"M\"", newatom[i].name); printf("\n change \"M\" to \"-M\" if ATOM %s is linked to the immediate previous residue", newatom[i].name); printf("\n change \"M\" to \"+M\" if ATOM %s is linked to the immediate after residue", newatom[i].name); sprintf(tmpchar, "%d", tmpint2); strcat(array[1], tmpchar); flag = 0; } if (tmpint3 != -1) { strcpy(array[2], newatom[tmpint3].ambername); strcpy(array0[2], newatom[tmpint3].name); /* newitoa(tmpint3, tmpchar); */ sprintf(tmpchar, "%d", tmpint3); strcat(array[2], tmpchar); } else if (strcmp(head, newatom[i].name) == 0) { strcpy(array[2], preheadtype); strcpy(array0[2], "-M"); /* newitoa(tmpint3, tmpchar); */ sprintf(tmpchar, "%d", tmpint3); strcat(array[2], tmpchar); } else if (strcmp(tail, newatom[i].name) == 0) { strcpy(array[2], posttailtype); strcpy(array0[2], "+M"); /* newitoa(tmpint3, tmpchar); */ sprintf(tmpchar, "%d", tmpint3); strcat(array[2], tmpchar); } else if (newatom[i].atomicnum == 6 && newatom[i].connum == 2 && newatom[i].ambername[0] == 'C' && (newatom[i].ambername[1] == ' ' || newatom[i].ambername[1] == '\0')) { strcpy(array0[2], "+M"); sprintf(tmpchar, "%d", tmpint1); strcat(array[2], tmpchar); } else if (newatom[i].atomicnum == 7 && newatom[i].connum == 2 && newatom[i].ambername[0] == 'N' && (newatom[i].ambername[1] == ' ' || newatom[i].ambername[1] == '\0')) { strcpy(array0[2], "-M"); sprintf(tmpchar, "%d", tmpint1); strcat(array[2], tmpchar); } else { strcpy(array0[2], "M"); printf("\nWarning: ATOM %s has unfilled valence, assuming the linked atom name (in other residue) is \"M\"", newatom[i].name); printf("\n change \"M\" to \"-M\" if ATOM %s is linked to the immediate previous residue", newatom[i].name); printf("\n change \"M\" to \"+M\" if ATOM %s is linked to the immediate after residue", newatom[i].name); sprintf(tmpchar, "%d", tmpint3); strcat(array[2], tmpchar); flag = 0; } for (j = 0; j < 3; j++) for (k = j + 1; k < 3; k++) { if (strcmp(array[k], array[j]) < 0) { strcpy(tmpchar, array[j]); strcpy(array[j], array[k]); strcpy(array[k], tmpchar); strcpy(tmpchar, array0[j]); strcpy(array0[j], array0[k]); strcpy(array0[k], tmpchar); } } if(flag == 1) { fprintf(fprep, "%5s%5s%5s%5s\n", array0[0], array0[1], newatom[i].name, array0[2]); } } fprintf(fprep, "\n%s\n%s\n", "DONE", "STOP"); free(connum); free(aatype); fclose(fprep); } void adjust(ATOM atom[], int startmainnum) { int i; int selectflag; for (i = 0; i < 6; i++) { if (atom[startmainnum].con[i] == -1) break; if (atom[atom[startmainnum].con[i]].bondatom == -1 && atom[atom[startmainnum].con[i]].mainatom == -1) { selectflag = atom[startmainnum].con[i]; atom[selectflag].bondatom = startmainnum + 3; newatom[countatom++] = atom[selectflag]; seq1[countatom - 1] = selectflag; /*printf("\n i %5d", i); */ adjust(atom, selectflag); } } } void getmainatom(ATOM atm[], int selectnum, int startnum) { /*determain the main atoms of the molecules*/ int i, j, k, ii, jj; int visitindex = 0; int startnum1; selectchain[selectnum++] = startnum; selectindex[startnum] = selectnum - 1; if (cartindex == 1) { for (ii = 0; ii < selectnum; ii++) for (jj = ii + 1; jj < selectnum; jj++) if (posindex[selectchain[ii]] > posindex[selectchain[jj]]) return; } if (selectnum > mainatomnum) { for (j = 0; j < selectnum; j++) mainatom[j] = selectchain[j]; mainatomnum = selectnum; } if (selectnum > atomnum) return; for (i = 0; i < 6; i++) { if (atm[startnum].con[i] == -1) return; if (atm[atm[startnum].con[i]].atomicnum == 0) continue; if (atm[atm[startnum].con[i]].atomicnum == 1) continue; startnum1 = atm[startnum].con[i]; if (selectindex[startnum1] != -1) continue; for (k = 0; k < selectnum; k++) if (startnum1 == selectchain[k]) { visitindex = 1; break; } if (visitindex == 1) { visitindex = 0; selectnum = selectindex[selectchain[k]] + 2; for (l = selectnum; l < atomnum; l++) selectchain[l] = -1; continue; } getmainatom(atm, selectnum, startnum1); } } void getmainatomspec(ATOM atm[], int selectnum, int startnum) { /* find a path linking head and tail atoms determain the aromatic atom through an iterative way */ int i, j, k, ii, jj; int start; selectchain[selectnum++] = startnum; selectindex[startnum] = 1; if (cartindex == 1) { for (ii = 0; ii < selectnum; ii++) for (jj = ii + 1; jj < selectnum; jj++) if (posindex[selectchain[ii]] > posindex[selectchain[jj]]) return; } for (i = 0; i < 6; i++) { if (atm[startnum].con[i] == -1) return; start = atm[startnum].con[i]; if (atm[start].atomicnum == 1) continue; for (k = 0; k < selectnum - 2; k++) if (start == selectchain[k]) return; /* we have already visited this atom */ if (start == tailno && (mainatomnum == 0 || mainatomnum > selectnum + 1)) { for (j = 0; j < selectnum; j++) mainatom[j] = selectchain[j]; mainatomnum = selectnum + 1; mainatom[selectnum] = tailno; return; } getmainatomspec(atm, selectnum, start); } } void getmainatom2(ATOM atm[]) { /*determain the main atoms of the molecules without changing the sequence order of atoms*/ int i, j; int suc; int current_id; mainatom[0] = 0; current_id = 0; /*first atom is always a main atom, otherwise, an atom becomes a main atom if it can satisfy the following condition: (1) bonded to the latest main atom (2) the rest atoms does not bond to other main atoms except the latest one*/ for (i = 1; i < atomnum; i++) { if (atom[i].name[0] == 'H') continue; if (atom[i].atomicnum == 0) continue; if (jbond(current_id, i) == 0) continue; suc = 1; for(j=i+1; j 0) for (i = 0; i < atomnum; i++) { /* ignor omitted atoms */ index = 0; for (j = 0; j < omitnum; j++) if (omitno[j] == i) { index = 1; break; } if (index == 1) continue; for (j = 0; j < 6; j++) { tmpint = atom[i].con[j]; if (atom[i].con[j] < 0) continue; /* if atom i links to headno and tailno, break the bond*/ for (k = 0; k < omitnum; k++) { if ((i == headno || i == tailno) && omitno[k] == tmpint) { atom[i].con[j] = -1; continue; } if (omitno[k] < tmpint && atom[i].con[j] >= 0) atom[i].con[j]--; if (omitno[k] == tmpint) { atom[i].connum --; atom[i].con[j] = -1; printf("\nInfo: there is a bond linking a non-head and non-tail residue atom (%s) and an omitted atom (%s).", atom[i].name, atom[omitno[k]].name); printf("\n You need to specifically add this bond in leap using the command 'bond [order]'"); printf("\n to link %s to an atom in another residue (similar to disulfide bonds)!\n", atom[i].name); } } } } for (i = 0; i < atomnum; i++) { num = 0; for (j = 0; j < 6; j++) { if (atom[i].con[j] == -1) continue; atom[i].con[num] = atom[i].con[j]; num++; } atom[i].connum = num; for (j = atom[i].connum; j < 6; j++) atom[i].con[j] = -1; } if (omitnum > 0) { num = 0; for (i = 0; i < atomnum; i++) { index = 0; for (j = 0; j < omitnum; j++) if (omitno[j] == i) { index = 1; break; } if (index == 1) continue; atoma[num] = atom[i]; num++; } atomnum = num; for (i = 0; i < atomnum; i++) atom[i] = atoma[i]; adjustid(); /*adjust headno, tailno, mainatom etc */ } if (omitnum > 0 && charge <= 9990.) { pcharge = 0.0; ncharge = 0.0; for (i = 0; i < atomnum; i++) { if (atom[i].charge > 0.0) pcharge += atom[i].charge; if (atom[i].charge < 0.0) ncharge += atom[i].charge; } if (pcharge == 0.0) printf("\nTotal postive charge is 0.0"); if (ncharge == 0.0) printf("\nTotal negtive charge is 0.0"); if (pcharge != 0.0 && ncharge != 0.0) for (i = 0; i < atomnum; i++) { if (atom[i].charge >= 0) atom[i].charge += atom[i].charge * (charge - pcharge - ncharge) / (pcharge - ncharge); else atom[i].charge -= atom[i].charge * (charge - pcharge - ncharge) / (pcharge - ncharge); atoma[i].charge = atom[i].charge; } } prep(); fclose(fptest); fclose(fppdb); /* free(atom); free(arom); free(bond); free(newatom); free(atoma); free(mc_name); free(omit); free(selectchain); free(mainatom); free(selectindex); free(seq1); free(seq2); free(connumbak); free(omitno); free(posindex); */ return (0); }