Skip to content

Commit

Permalink
added quasi constructor functions for cell/details (#31)
Browse files Browse the repository at this point in the history
sets sensible default values, for poor souls binding yaehmop
  • Loading branch information
richardjgowers authored and greglandrum committed Feb 15, 2019
1 parent afa908e commit 0938879
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 50 deletions.
34 changes: 34 additions & 0 deletions tightbind/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,40 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// For booleans
#include "stdbool.h"

void set_details_defaults(details)
detail_type *details;
/* Set defaults struct to default options, ie off*/
{
details->walsh_details.num_steps = 1;
details->walsh_details.num_vars = 0;
details->use_symmetry = 0;
details->find_princ_axes = 0;
details->vary_zeta = 0;
details->avg_props = 0;
details->just_geom = 0;
details->dump_overlap = 0;
details->dump_hamil = 0;
details->sparsify_value = 0.0;
details->Execution_Mode = FAT;
details->the_const = THE_CONST;
details->weighted_Hij = 1;
details->eval_electrostat = 0;
details->close_nn_contact = NN_DISTANCE;
details->symm_tol = SYMM_TOL;
details->muller_mix = MULLER_MIX_DEF;
details->muller_E_tol = MULLER_E_TOL_DEF;
details->muller_Z_tol = MULLER_Z_TOL_DEF;
details->num_moments = 4;
details->line_width = 80;
details->k_offset = K_OFFSET;
}
void set_cell_defaults(cell)
cell_type *cell;
{
cell->equiv_atoms = 0;
cell->charge = -1000.0;
}

void inner_wrapper(char *file_name, bool use_stdin_stdout){
char temp_file_name[500],err_string[500];
FILE *temp_file;
Expand Down
27 changes: 2 additions & 25 deletions tightbind/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1533,34 +1533,11 @@ void read_inputfile(cell,details,name,num_orbs,orbital_lookup_table,the_file,
/*******
initialize some variables
********/
details->walsh_details.num_steps = 1;
details->walsh_details.num_vars = 0;
details->use_symmetry = 0;
details->find_princ_axes = 0;
details->vary_zeta = 0;
details->avg_props = 0;
details->just_geom = 0;
details->dump_overlap = 0;
details->dump_hamil = 0;
details->sparsify_value = 0.0;
set_details_defaults(details);
set_cell_defaults(cell);
got_params = 0;
got_muller_params = 0;
got_geom = 0;
details->Execution_Mode = FAT;
details->the_const = THE_CONST;
details->weighted_Hij = 1;
details->eval_electrostat = 0;
details->close_nn_contact = NN_DISTANCE;
details->symm_tol = SYMM_TOL;
details->muller_mix = MULLER_MIX_DEF;
details->muller_E_tol = MULLER_E_TOL_DEF;
details->muller_Z_tol = MULLER_Z_TOL_DEF;
details->num_moments = 4;
details->line_width = 80;
details->k_offset = K_OFFSET;
cell->equiv_atoms = 0;

cell->charge = -1000.0;

/***************
Expand Down
2 changes: 2 additions & 0 deletions tightbind/prototypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,8 @@ extern void gen_k_point_mesh PROTO((point_type * *points, int num_per_vect[3],
real offset));
extern void automagic_k_points PROTO((detail_type * details, cell_type *cell));

extern void set_details_defaults PROTO((detail_type*));
extern void set_cell_defaults PROTO((cell_type*));
extern void run_bind PROTO((char *, bool, char *));
extern void run_eht PROTO((FILE *));

Expand Down
27 changes: 2 additions & 25 deletions tightbind/test_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,34 +52,11 @@ void main(int argc, char **argv){
/*******
initialize some variables
********/
details->walsh_details.num_steps = 1;
details->walsh_details.num_vars = 0;
details->use_symmetry = 0;
details->find_princ_axes = 0;
details->vary_zeta = 0;
details->avg_props = 0;
details->just_geom = 0;
details->dump_overlap = 0;
details->dump_hamil = 0;
details->sparsify_value = 0.0;
details->Execution_Mode = FAT;
details->the_const = THE_CONST;
details->weighted_Hij = 1;
details->eval_electrostat = 0;
details->close_nn_contact = NN_DISTANCE;
details->symm_tol = SYMM_TOL;
details->muller_mix = MULLER_MIX_DEF;
details->muller_E_tol = MULLER_E_TOL_DEF;
details->muller_Z_tol = MULLER_Z_TOL_DEF;
details->num_moments = 4;
details->line_width = 80;
details->k_offset = K_OFFSET;
unit_cell->equiv_atoms = 0;

set_details_defaults(details);
set_cell_defaults(unit_cell);

safe_strcpy(details->title,"test job");


// molecular calculation
details->Execution_Mode = MOLECULAR;
details->num_KPOINTS = 1;
Expand Down

0 comments on commit 0938879

Please sign in to comment.