Changeset 425444 for pcp/src/ions.c
- Timestamp:
- Aug 6, 2008, 8:35:50 AM (17 years ago)
- Children:
- e6372f
- Parents:
- 7670cab
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pcp/src/ions.c
r7670cab r425444 652 652 double i1, j1; 653 653 double R[NDIM]; 654 char *ptr = NULL; 654 655 655 656 if (P->Call.ForcesFile == NULL) return; … … 658 659 if (finput == NULL) 659 660 Error(InitReading, "ForcesFile does not exist."); 660 fscanf(finput, "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", line,line,line,line,line,line,line,line,line,line,line,line,line,line,line,line,line,line,line,line);// skip header line661 fgets(line, 1024, finput); // skip header line 661 662 for (i=0; i < I->Max_Types; i++) 662 663 for (j=0; j < I->I[i].Max_IonsOfType; j++) … … 664 665 Error(InitReading, "ForcesFile does not contain enough lines."); 665 666 } else { 666 //fscanf(finput, "%s\n", line); 667 //if (strlen(line) < 100) { 668 //fprintf(stderr, "i %d, j %d, length of line %ld, line %s.\n", i,j, strlen(line), line); 669 //Error(InitReading, "ForcesFile does not contain enough lines or line is faulty."); 670 //} else 667 fgets(line, 1024, finput); 668 ptr = line; 669 i1 = 1.; 670 while ((ptr = strchr(ptr, '\t')) != NULL) { // count number of tabs in line 671 if (*ptr == '\t') ptr++; 672 i1++; 673 //fprintf(stderr,"%i tabs\n", (int)i1); 674 } 675 if (i1 < 8) { 676 fprintf(stderr, "i %d, j %d, fields in %i, line %s.\n", i,j, (int)i1, line); 677 Error(InitReading, "ForcesFile does not contain enough lines or line is faulty."); 678 } else { 671 679 //fprintf(stderr, "Parsed line: '%s'\n", line); 672 fscanf(finput, "%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\n", &i1,&j1,680 sscanf(line, "%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\t%le\n", &i1,&j1, 673 681 &R[0], &R[1], &R[2], 674 682 &I->I[i].FIon[0+j*NDIM], &I->I[i].FIon[1+j*NDIM], &I->I[i].FIon[2+j*NDIM], … … 677 685 &I->I[i].FMagnetic[0+j*NDIM], &I->I[i].FMagnetic[1+j*NDIM], &I->I[i].FMagnetic[2+j*NDIM], 678 686 &I->I[i].FEwald[0+j*NDIM], &I->I[i].FEwald[1+j*NDIM], &I->I[i].FEwald[2+j*NDIM]); 679 if ((i != (int)i1) || (j != (int)j1)) 687 } 688 if ((i != (int)i1) || (j != (int)j1)) { 689 fprintf(stderr, "(%i) expecting ion (%i, %i), parsed ion (%le, %le)!\n", P->Par.me, i, j, i1, j1); 680 690 Error(InitReading, "Line does not match to desired ion."); 691 } 681 692 } 682 693 fclose(finput);
Note:
See TracChangeset
for help on using the changeset viewer.