X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=mdrun.c;h=f0edd0bac7546bed88625c1d7a3242a0a2632650;hb=0d2f9a11030dff3583104dac5d4dcb9f040a1327;hp=c30ce5ffffca7738a6e851faa56defd3d27ee6da;hpb=f1645c044d628216b6b77dd899ab0de469a59175;p=physik%2Fposic.git diff --git a/mdrun.c b/mdrun.c index c30ce5f..f0edd0b 100644 --- a/mdrun.c +++ b/mdrun.c @@ -17,11 +17,6 @@ #include "potentials/tersoff.h" #endif -/* pse */ -#define PSE_MASS -#include "pse.h" -#undef PSE_MASS - #define ME "[mdrun]" /* @@ -101,6 +96,9 @@ int add_stage(t_mdrun *mdrun,u8 type,void *params) { case STAGE_DEL_ATOMS: psize=sizeof(t_del_atoms_params); break; + case STAGE_MODIFY_ATOMS: + psize=sizeof(t_modify_atoms_params); + break; case STAGE_INSERT_ATOMS: psize=sizeof(t_insert_atoms_params); break; @@ -169,6 +167,7 @@ int mdrun_parse_config(t_mdrun *mdrun) { int i,o; t_displace_atom_params dap; + t_modify_atoms_params map; t_insert_atoms_params iap; t_insert_mixed_atoms_params imp; t_continue_params cp; @@ -203,6 +202,7 @@ int mdrun_parse_config(t_mdrun *mdrun) { // reset memset(&iap,0,sizeof(t_insert_atoms_params)); + memset(&map,0,sizeof(t_modify_atoms_params)); memset(&imp,0,sizeof(t_insert_mixed_atoms_params)); memset(&cp,0,sizeof(t_continue_params)); memset(&ap,0,sizeof(t_anneal_params)); @@ -467,7 +467,9 @@ int mdrun_parse_config(t_mdrun *mdrun) { csp.type=0; for(i=1;i0) + csp.ptau=0.01/(csp.ptau*GPA); csp.type|=CHSATTR_PCTRL; } if(!strncmp(word[i],"tctrl",5)) { @@ -525,6 +527,22 @@ int mdrun_parse_config(t_mdrun *mdrun) { delp.r=atof(word[5]); add_stage(mdrun,STAGE_DEL_ATOMS,&delp); } + else if(!strncmp(word[1],"mod_atoms",8)) { + i=2; + while(iatom; + stage=mdrun->stage.current->data; + map=stage->params; + v.x=0.0; v.y=0.0; v.z=0.0; + + for(i=0;icount;i++) { + if(atom[i].tag==map->tag) { + v.x=sqrt(2.0*fabs(map->ekin.x)/atom[i].mass); + if(map->ekin.x<0.0) + v.x=-v.x; + v.y=sqrt(2.0*fabs(map->ekin.y)/atom[i].mass); + if(map->ekin.y<0.0) + v.y=-v.y; + v.z=sqrt(2.0*fabs(map->ekin.z)/atom[i].mass); + if(map->ekin.z<0.0) + v.z=-v.z; + v3_copy(&(atom[i].v),&v); + printf("%s atom modified: v = (%f %f %f)\n", + ME,v.x,v.y,v.z); + } + } + + return 0; } int insert_atoms(t_moldyn *moldyn,t_mdrun *mdrun) { @@ -902,7 +952,23 @@ int insert_atoms(t_moldyn *moldyn,t_mdrun *mdrun) { printf("%s atom inserted (%d/%d): %f %f %f\n", ME,(iap->cnt_steps+1)*iap->ins_atoms, iap->ins_steps*iap->ins_atoms,r.x,r.y,r.z); - printf(" -> d2 = %f/%f\n",dmin,iap->cr*iap->cr); + printf(" attributes: "); + if(iap->attr&ATOM_ATTR_VB) + printf("b "); + if(iap->attr&ATOM_ATTR_HB) + printf("h "); + if(iap->attr&ATOM_ATTR_VA) + printf("v "); + if(iap->attr&ATOM_ATTR_FP) + printf("f "); + if(iap->attr&ATOM_ATTR_1BP) + printf("1 "); + if(iap->attr&ATOM_ATTR_2BP) + printf("2 "); + if(iap->attr&ATOM_ATTR_3BP) + printf("3 "); + printf("\n"); + printf(" d2 = %f/%f\n",dmin,iap->cr*iap->cr); cnt+=1; } @@ -1060,13 +1126,13 @@ int chsattr(t_moldyn *moldyn,t_mdrun *mdrun) { if(csp->ptau>0) set_p_scale(moldyn,P_SCALE_BERENDSEN,csp->ptau); else - set_p_scale(moldyn,P_SCALE_BERENDSEN,csp->ptau); + set_p_scale(moldyn,P_SCALE_NONE,1.0); } if(csp->type&CHSATTR_TCTRL) { if(csp->ttau>0) set_t_scale(moldyn,T_SCALE_BERENDSEN,csp->ttau); else - set_t_scale(moldyn,T_SCALE_BERENDSEN,csp->ttau); + set_t_scale(moldyn,T_SCALE_NONE,1.0); } if(csp->type&CHSATTR_PRELAX) { if(csp->dp<0) @@ -1154,6 +1220,11 @@ int mdrun_hook(void *ptr1,void *ptr2) { del_atoms(moldyn,mdrun); change_stage=TRUE; break; + case STAGE_MODIFY_ATOMS: + stage_print(" -> modify atoms\n\n"); + modify_atoms(moldyn,mdrun); + change_stage=TRUE; + break; case STAGE_INSERT_ATOMS: stage_print(" -> insert atoms\n\n"); iap=stage->params;