SimonEnsemble / PorousMaterials.jl

Julia package towards classical molecular modeling of nanoporous materials
GNU General Public License v3.0
50 stars 11 forks source link

Optimizing `vdw_energy()` #1

Closed SimonEnsemble closed 6 years ago

SimonEnsemble commented 6 years ago

I think r_squared follows from dx as r_squared = sum(dx .* dx), no? i.e., no need to compute x_k or do molecule.pos[:,i] - x_k. Is that right?

SimonEnsemble commented 6 years ago

framework.box.c_to_f * molecule.pos is computed multiple times inside the loop over atoms of the molecule. So maybe this should be outside of the for loop over framework atoms. xf_molecule_atom = framework.box.c_to_f * molecule.pos[:, i] and then work with it later.

SimonEnsemble commented 6 years ago

dxf[j] += sign(dxf[j]) * repfactors[j] is the sign right here? If dxf[j] is less than negative repfactors[j] / 2, it should be shifted to the right, so we should add repfactors[j], not make it further to the left?