@@ -23,6 +23,7 @@ extern "C" {
2323
2424 // flags
2525 static bool particle_list_change_flag=true ;
26+ static bool initial_particle_flag=false ;
2627
2728 // common
2829
@@ -102,6 +103,8 @@ extern "C" {
102103 if (ptr->my_rank ==0 ) std::cout<<" PETAR: recommit_parameters start\n " ;
103104#endif
104105 ptr->input_parameters .n_glb .value = ptr->stat .n_real_glb ;
106+ ptr->input_parameters .update_changeover_flag = true ;
107+ ptr->input_parameters .update_rsearch_flag = true ;
105108 ptr->initialParameters ();
106109 ptr->initial_step_flag = false ;
107110
@@ -123,6 +126,15 @@ extern "C" {
123126
124127 int new_particle (int * index_of_the_particle, double mass, double x, double y, double z, double vx, double vy, double vz, double radius) {
125128 // if not yet initial the system
129+ #ifdef INTERFACE_DEBUG_PRINT
130+ if (!ptr->read_data_flag && ptr->my_rank ==0 ) {
131+ std::cout<<" New particle, rank " <<ptr->my_rank <<std::endl;
132+ std::cout<<std::setw (20 )<<" ID" ;
133+ ParticleBase::printColumnTitle (std::cout);
134+ std::cout<<std::endl;
135+ }
136+ #endif
137+
126138 ptr->read_data_flag = true ;
127139
128140 PS ::S64 id_offset = ptr->input_parameters .id_offset .value ;
@@ -152,10 +164,25 @@ extern "C" {
152164 p.rank_org = ptr->my_rank ;
153165 p.adr = n_loc;
154166
167+ if (initial_particle_flag) {
168+ PS ::F64 m_fac = p.mass *Ptcl::mean_mass_inv;
169+ PS ::F64 r_out = ptr->input_parameters .r_out .value ;
170+ PS ::F64 r_in = r_out*ptr->input_parameters .ratio_r_cut .value ;
171+ p.changeover .setR (m_fac, r_in, r_out);
172+ p.calcRSearch (ptr->input_parameters .dt_soft .value );
173+ }
174+
155175 ptr->system_soft .addOneParticle (p);
156176
157177 ptr->stat .n_real_loc ++;
158178 *index_of_the_particle = p.id ;
179+ #ifdef INTERFACE_DEBUG_PRINT
180+ std::cout<<std::setprecision (14 );
181+ std::cout<<std::setw (20 )<<p.id ;
182+ p.ParticleBase ::printColumn (std::cout);
183+ std::cout<<std::endl;
184+ #endif
185+
159186 }
160187 ptr->stat .n_real_glb ++;
161188
@@ -548,7 +575,7 @@ extern "C" {
548575
549576 int evolve_model (double time_next) {
550577#ifdef INTERFACE_DEBUG_PRINT
551- if (ptr->my_rank ==0 ) std::cout<<" PETAR: evolve models start\n " ;
578+ if (ptr->my_rank ==0 ) std::cout<<" PETAR: evolve models to " <<time_next<< " start\n " ;
552579#endif
553580
554581 if (ptr->stat .n_real_glb ==0 ) {// escape if no particle
@@ -731,6 +758,7 @@ extern "C" {
731758 ptr->initialStep ();
732759 ptr->reconstructIdAdrMap ();
733760 particle_list_change_flag = false ;
761+ initial_particle_flag = true ;
734762#ifdef INTERFACE_DEBUG_PRINT
735763 if (ptr->my_rank ==0 ) std::cout<<" PETAR: commit_particles end\n " ;
736764#endif
@@ -859,6 +887,17 @@ extern "C" {
859887 return 0 ;
860888 }
861889
890+ int set_output_step (double dt_snap) {
891+ ptr->input_parameters .dt_snap .value = dt_snap;
892+ return 0 ;
893+ }
894+
895+ int get_output_step (double * dt_snap) {
896+ *dt_snap = ptr->input_parameters .dt_snap .value ;
897+ return 0 ;
898+ }
899+
900+
862901 // // set gravitational constant
863902 // int set_gravitational_constant(double G) {
864903 // ptr->input_parameters.unit_set.value=-1;
0 commit comments