src/sim/sim_lmp.c
int dimer_evaluate_lambda(sim_lmp_t * obj, ffs_t * ffs, double * lambda){
  /* int t can be used to distinguish between int, double etc lambda
   * not operational at the moment
   */

  double BoxLength[3];
  double dimer_coords[6];
  double rsep;
  int nc;
  
  int natoms = lammps_get_natoms(obj->lmp);
  double *coords = (double *) malloc(3*natoms*sizeof(double));
  int *id = (int *) malloc(natoms*sizeof(int));
  int *type = (int *) malloc(natoms*sizeof(int));

  lammps_gather_atoms(obj->lmp, "x", 1, 3, coords);
  lammps_gather_atoms(obj->lmp, "id", 0, 1, id);
  lammps_gather_atoms(obj->lmp, "type", 0, 1, type);

  if(get_coord_with_type(coords, type, natoms, 2, dimer_coords, &nc) != 0){
    free(coords);
    free(id);
    free(type);
    return 1;
  }
  
  if(lammps_get_3Dboxsize(obj->lmp, BoxLength) != 0){
    free(coords);
    free(id);
    free(type);
    return 1;
  }

  if(calculate_pair_separation(dimer_coords, BoxLength, &rsep) != 0){
    free(coords);
    free(id);
    free(type);
    return 1;
  }
  free(coords);
  free(id);
  free(type);

  /* Want an increasing lambda */
  *lambda = rsep;

  return 0;
}
/*dimer stuff follows*/
/*should be in its own file*/
dimer stuff follows
should be in its own file
dimer stuff follows should be in its own file
int dimer_evaluate_lambda(sim_lmp_t * obj, ffs_t * ffs, double * lambda){
  double BoxLength[3];
  double dimer_coords[6];
  double rsep;
  int nc;
  int natoms = lammps_get_natoms(obj->lmp);
  double *coords = (double *) malloc(3*natoms*sizeof(double));
  int *id = (int *) malloc(natoms*sizeof(int));
  int *type = (int *) malloc(natoms*sizeof(int));
  lammps_gather_atoms(obj->lmp, "x", 1, 3, coords);
  lammps_gather_atoms(obj->lmp, "id", 0, 1, id);
  lammps_gather_atoms(obj->lmp, "type", 0, 1, type);
  if(get_coord_with_type(coords, type, natoms, 2, dimer_coords, &nc) != 0){
    free(coords);
    free(id);
    free(type);
    return 1;
  }
  if(lammps_get_3Dboxsize(obj->lmp, BoxLength) != 0){
    free(coords);
    free(id);
    free(type);
    return 1;
  }
  if(calculate_pair_separation(dimer_coords, BoxLength, &rsep) != 0){
    free(coords);
    free(id);
    free(type);
    return 1;
  }
  free(coords);
  free(id);
  free(type);
  *lambda = rsep;
  return 0;
}
int dimer_evaluate_lambda ( sim_lmp_t * obj , ffs_t * ffs , double * lambda ) { double BoxLength [ 3 ] ; double dimer_coords [ 6 ] ; double rsep ; int nc ; int natoms = lammps_get_natoms ( obj -> lmp ) ; double * coords = ( double * ) malloc ( 3 * natoms * sizeof ( double ) ) ; int * id = ( int * ) malloc ( natoms * sizeof ( int ) ) ; int * type = ( int * ) malloc ( natoms * sizeof ( int ) ) ; lammps_gather_atoms ( obj -> lmp , " " , 1 , 3 , coords ) ; lammps_gather_atoms ( obj -> lmp , " " , 0 , 1 , id ) ; lammps_gather_atoms ( obj -> lmp , " " , 0 , 1 , type ) ; if ( get_coord_with_type ( coords , type , natoms , 2 , dimer_coords , & nc ) != 0 ) { free ( coords ) ; free ( id ) ; free ( type ) ; return 1 ; } if ( lammps_get_3Dboxsize ( obj -> lmp , BoxLength ) != 0 ) { free ( coords ) ; free ( id ) ; free ( type ) ; return 1 ; } if ( calculate_pair_separation ( dimer_coords , BoxLength , & rsep ) != 0 ) { free ( coords ) ; free ( id ) ; free ( type ) ; return 1 ; } free ( coords ) ; free ( id ) ; free ( type ) ; * lambda = rsep ; return 0 ; }
dimer stuff follows
should be in its own file
dimer stuff follows should be in its own file
/* int t can be used to distinguish between int, double etc lambda
   * not operational at the moment
   */ /* Want an increasing lambda */