SimonEnsemble / PorousMaterials.jl

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

Reader overhaul + Random rotation test #13

Closed Surluson closed 6 years ago

Surluson commented 6 years ago

Some polishing for the read_crystal_structure_file function. remove_overlap is a new bool argument for the function which enables the removal of identical overlapping atoms. It calls upon the remove_overlapping_atoms function (which also runs relevant checks like overlap/charge_neutral) If run_checks = false in read_crystal_structure_file we'll remove identical atoms and we won't be checking if the result is charge neutral or if different elements are overlapping. I made a new test structure, test_structure2B.cif, which is identical to test_structure2.cif, except I copied the atoms multiple times (and got rid of the number on their labels). To test the remove_overlap I compare the framework for test_structure2.cif and test_structure2B.cif (fractional coords, atoms and charges)

For uniformly random rotation test I use a randomly generated radius (from rand()) and form a patch on the sphere and count the points on that patch. Then I use rotation_matrix() to rotate the sphere and count the points that landed on that same patch. I make sure number of points on the patch is similar. The tolerance in that check is 1% of the sample size, which is 1M points. I run this test with three randomly generated radii to make sure that doesn't affect the result.

-Arni

Surluson commented 6 years ago

I decided on having the checks separate for the remove_overlapping_atoms. The reason was to have different messages. But thinking about it, it would probably be easier to define two different strings and reuse the checks being made in read_crystal_structure_file