Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
2e88a5d
Added hook for montecarlo
jialincheoh Jun 3, 2018
5fb8a31
Added skeleton code for monte carlo -- currently a copy of molecular …
jialincheoh Jun 3, 2018
d3cd4e9
Added some notes on monte carlo, started modifying code accordingly.
jialincheoh Jun 3, 2018
60cee9c
Added while loop for mc, added calculation of random displacement.
jialincheoh Jun 4, 2018
144fbee
Fleshed out step logic for monte carlo.
jialincheoh Jun 4, 2018
980ca63
Added test file for mc, updated help to use mc test file.
jialincheoh Jun 4, 2018
295bdc3
Hello Terri added
Jun 4, 2018
227fb1e
Added state reversion, changed energy value being compared.
jialincheoh Jun 5, 2018
e5e93ba
updated libefphelp with questions
jialincheoh Jun 6, 2018
0e0877e
Changed md run type to opt, Add some randomization to dispmag.
jialincheoh Jun 15, 2018
584a512
pairwise efp
yhb8r4 Jun 22, 2018
633a002
removed print statements
yhb8r4 Jun 25, 2018
b96fed8
Update mc.c
jialincheoh Jul 23, 2018
4f8ef99
add angle randomization
jialincheoh Jul 27, 2018
126773c
angle randomization fix
jialincheoh Jul 27, 2018
8bc1e11
polarization from frag_i to frag_j and vice versa
Aug 2, 2018
cc09d21
removed unnecessary files
Aug 2, 2018
1956c69
removed uncessary energy.c
Aug 2, 2018
36bb36a
added new version of efpmd-mc
Aug 7, 2018
2d36d8d
tried to modify for loop for iterations
Aug 8, 2018
09b6dbb
re-added hook for mc run_type
jialincheoh Aug 12, 2018
0e27df4
Made mc run
jialincheoh Aug 12, 2018
6902213
Added debugging info and comments
jialincheoh Aug 15, 2018
e613165
modified for loop for randomization step
Aug 16, 2018
40e916c
Added debugging
jialincheoh Aug 16, 2018
3eb303c
worked through and found where e_old doesn't get set
Aug 17, 2018
f529176
randomization never occurs because print statement regarding COM in v…
Aug 17, 2018
2c74b13
fixed randomization issue. need to work on free calloc arrays in mc_s…
Aug 18, 2018
daca15c
modified md_1.in in test directory
Aug 18, 2018
5fcf892
Fixed memory overrun error
jialincheoh Aug 23, 2018
a688dee
Added dispmag adjustment
jialincheoh Aug 25, 2018
38451dd
removed profanity
Aug 30, 2018
2307b87
Trying to merge
jialincheoh Sep 1, 2018
cf29d35
trying to merge
jialincheoh Sep 1, 2018
46be299
Commented out old dispmag adjustment. Refactored stepping to incremen…
jialincheoh Sep 2, 2018
96bcbe0
added rand_init in randomization function in mc.c
Sep 6, 2018
4edbcff
removed hardcoding for dispmag_modifier, dispmag_threshold, dispmag_t…
Oct 13, 2018
ccd88dc
modified hardcode for debugging
Oct 13, 2018
976328d
after jay conversation - added rand_init back
Nov 2, 2018
c138cee
played with randomizer
Nov 7, 2018
3b5a654
now monte carlo where you have direct randomization of single fragmen…
Nov 7, 2018
e048443
called rand_init less
Feb 8, 2019
5b5adad
modified mc_state struct by adding vec_t box
Mar 4, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@
/efpmd/src/efpmd
/fraglib/params
tags
bin/*
include/*
2 changes: 1 addition & 1 deletion efpmd/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LIBS= -lefp -lopt -lff $(MYLIBS) -lm

PROG= efpmd
ALL_O= cfg.o common.o efield.o energy.o grad.o gtest.o hess.o main.o \
md.o msg.o opt.o parse.o rand.o sp.o
md.o msg.o opt.o parse.o rand.o sp.o psp.o mc_direct.o

$(PROG): $(ALL_O)
$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(ALL_O) $(LIBS)
Expand Down
10 changes: 7 additions & 3 deletions efpmd/src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ void print_geometry(struct efp *efp)
}
}


size_t n_charges;
check_fail(efp_get_point_charge_count(efp, &n_charges));

if (n_charges > 0) {
double xyz[3 * n_charges];
check_fail(efp_get_point_charge_coordinates(efp, xyz));

for (size_t i = 0; i < n_charges; i++) {
char label[32];
double x = xyz[3 * i + 0] * BOHR_RADIUS;
Expand All @@ -136,7 +136,7 @@ void print_geometry(struct efp *efp)
msg("%-16s %12.6lf %12.6lf %12.6lf\n", label, x, y, z);
}
}

msg("\n\n");
}

Expand Down Expand Up @@ -280,3 +280,7 @@ vec_t box_from_str(const char *str)
vec_scale(&box, 1.0 / BOHR_RADIUS);
return box;
}

void print_six_t(const double *six_t){
msg(" %16.8E %16.8E %16.8E %16.8E %16.8E %16.8E", six_t[1], six_t[3], six_t[4], six_t[2], six_t[5], six_t[0]);
}
6 changes: 5 additions & 1 deletion efpmd/src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ enum run_type {
RUN_TYPE_OPT,
RUN_TYPE_MD,
RUN_TYPE_EFIELD,
RUN_TYPE_GTEST
RUN_TYPE_GTEST,
RUN_TYPE_PSP,
RUN_TYPE_MC
};

enum ensemble_type {
Expand Down Expand Up @@ -96,6 +98,7 @@ struct state {
struct sys *sys;
double energy;
double *grad;
double *energy_components;
};

void NORETURN die(const char *, ...);
Expand All @@ -113,6 +116,7 @@ void print_fragment(const char *, const double *, const double *);
void print_charge(double, double, double, double);
void print_vector(size_t, const double *);
void print_matrix(size_t, size_t, const double *);
void print_six_t(const double *);

void check_fail(enum efp_result);
void compute_energy(struct state *, bool);
Expand Down
5 changes: 5 additions & 0 deletions efpmd/src/energy.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ void compute_energy(struct state *state, bool do_grad)
int itotal;

/* EFP part */

check_fail(efp_compute(state->efp, do_grad));
check_fail(efp_get_energy(state->efp, &efp_energy));
check_fail(efp_get_frag_count(state->efp, &nfrag));
Expand All @@ -46,6 +47,10 @@ void compute_energy(struct state *state, bool do_grad)
state->grad + 6 * nfrag));
}

if (cfg_get_bool(state->cfg, "enable_pairwise")){
check_fail(efp_get_energy_components(state->efp, state->energy_components));
}

state->energy = efp_energy.total;

/* constraints */
Expand Down
26 changes: 22 additions & 4 deletions efpmd/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ void sim_opt(struct state *);
void sim_md(struct state *);
void sim_efield(struct state *);
void sim_gtest(struct state *);
void sim_psp(struct state *);
void sim_mc(struct state *);

#define USAGE_STRING \
"usage: efpmd [-d | -v | -h | input]\n" \
Expand All @@ -55,14 +57,18 @@ static struct cfg *make_cfg(void)
"opt\n"
"md\n"
"efield\n"
"gtest\n",
"gtest\n"
"psp\n"
"mc\n",
(int []) { RUN_TYPE_SP,
RUN_TYPE_GRAD,
RUN_TYPE_HESS,
RUN_TYPE_OPT,
RUN_TYPE_MD,
RUN_TYPE_EFIELD,
RUN_TYPE_GTEST });
RUN_TYPE_GTEST,
RUN_TYPE_PSP,
RUN_TYPE_MC });

cfg_add_enum(cfg, "coord", EFP_COORD_TYPE_XYZABC,
"xyzabc\n"
Expand Down Expand Up @@ -138,7 +144,11 @@ static struct cfg *make_cfg(void)
cfg_add_double(cfg, "pressure", 1.0);
cfg_add_double(cfg, "thermostat_tau", 1.0e3);
cfg_add_double(cfg, "barostat_tau", 1.0e4);

cfg_add_int(cfg, "ligand", 0);
cfg_add_bool(cfg, "enable_pairwise", false);
cfg_add_double(cfg, "dispmag_threshold", 0.5);
cfg_add_double(cfg, "dispmag_modifier", 0.9);
cfg_add_int(cfg, "dispmag_modify_steps", 100);
return cfg;
}

Expand All @@ -159,6 +169,11 @@ static sim_fn_t get_sim_fn(enum run_type run_type)
return sim_efield;
case RUN_TYPE_GTEST:
return sim_gtest;
case RUN_TYPE_PSP:
return sim_psp;
case RUN_TYPE_MC:
fprintf(stdout, "\n----monte carlo----\n\n");
return sim_mc;
}
assert(0);
}
Expand Down Expand Up @@ -247,7 +262,9 @@ static struct efp *create_efp(const struct cfg *cfg, const struct sys *sys)
.pol_driver = cfg_get_enum(cfg, "pol_driver"),
.enable_pbc = cfg_get_bool(cfg, "enable_pbc"),
.enable_cutoff = cfg_get_bool(cfg, "enable_cutoff"),
.swf_cutoff = cfg_get_double(cfg, "swf_cutoff")
.swf_cutoff = cfg_get_double(cfg, "swf_cutoff"),
.enable_pairwise = cfg_get_bool(cfg, "enable_pairwise"),
.ligand = cfg_get_int(cfg, "ligand")
};

enum efp_coord_type coord_type = cfg_get_enum(cfg, "coord");
Expand Down Expand Up @@ -309,6 +326,7 @@ static void state_init(struct state *state, const struct cfg *cfg, const struct
state->energy = 0;
state->grad = xcalloc(sys->n_frags * 6 + sys->n_charges * 3, sizeof(double));
state->ff = NULL;
state->energy_components = xcalloc(sys->n_frags * 6, sizeof(double));

if (cfg_get_bool(cfg, "enable_ff")) {
if ((state->ff = ff_create()) == NULL)
Expand Down
Loading