Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BEGIN header
- Real Lattice(A) Lattice parameters(A) Cell Angles
- 2.4675850 0.0000000 0.0000000 a = 2.467585 alpha = 90.000000
- 0.0000000 30.0000000 0.0000000 b = 30.000000 beta = 90.000000
- 0.0000000 0.0000000 30.0000000 c = 30.000000 gamma = 90.000000
- 1 ! nspins
- 25 300 300 ! fine FFT grid along <a,b,c>
- END header: data is "<a b c> pot" in units of Hartrees
- 1 1 1 0.042580
- 1 1 2 0.049331
- 1 1 3 0.038605
- 1 1 4 0.049181
- int readinputfile(){
- FILE *potential = fopen("orderedfile.txt", "r");
- for (i=0; i<size; i++){
- fscanf(potential, "%lf %lf %*f %lf", &x[i], &y[i], &V[i]);
- }
- fclose(potential);
- }
- int res = fscanf(potential, "%lf %lf %*f %lf", &x, &y, &v);
- if (res == EOF) break;
- if (res != 3) {
- fscanf(potential, "%*[^n]");
- }
- #include <stdio.h>
- int main()
- {
- char lineBuffer[256];
- FILE *potential = fopen("orderedfile.txt", "r");
- while(fgets(lineBuffer, sizeof(lineBuffer), potential) != NULL)
- {
- double a, b, c;
- if (3 == sscanf(lineBuffer, "%lf %lf %*f %lf", &a, &b, &c))
- {
- printf("%f %f %fn", a, b, c);
- }
- }
- fclose(potential);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement