@@ -384,41 +384,21 @@ void periodic_boundary_adjustment(Atom* atoms,
384384 // first adjust direct coordinates,
385385 // then update them into cartesian coordinates,
386386 // ----------------------------------------------
387- for (int i=0 ;i<ntype;i++) {
388- Atom* atom = &atoms[i];
389- for (int j=0 ;j<atom->na ;j++) {
390- printf (" the taud is %f %f %f\n " ,atom->taud [j].x ,atom->taud [j].y ,atom->taud [j].z );
391- }
392- }
393387 for (int it = 0 ; it < ntype; it++) {
394388 Atom* atom = &atoms[it];
395389 for (int ia = 0 ; ia < atom->na ; ia++) {
396390 // mohan update 2011-03-21
397- if (atom-> taud [ia]. x < 0 )
391+ for ( int ik = 0 ; ik < 3 ; ik++)
398392 {
399- atom->taud [ia].x += 1.0 ;
400- }
401- if (atom->taud [ia].y < 0 )
402- {
403- atom->taud [ia].y += 1.0 ;
404- }
405- if (atom->taud [ia].z < 0 )
406- {
407- atom->taud [ia].z += 1.0 ;
408- }
409- if (atom->taud [ia].x >= 1.0 )
410- {
411- atom->taud [ia].x -= 1.0 ;
412- }
413- if (atom->taud [ia].y >= 1.0 )
414- {
415- atom->taud [ia].y -= 1.0 ;
416- }
417- if (atom->taud [ia].z >= 1.0 )
418- {
419- atom->taud [ia].z -= 1.0 ;
393+ if (atom->taud [ia][ik] < 0 )
394+ {
395+ atom->taud [ia][ik] += 1.0 ;
396+ }
397+ if (atom->taud [ia][ik] >= 1.0 )
398+ {
399+ atom->taud [ia][ik] -= 1.0 ;
400+ }
420401 }
421-
422402 if (atom->taud [ia].x < 0
423403 || atom->taud [ia].y < 0
424404 || atom->taud [ia].z < 0
0 commit comments