From 2768d621852589f4d1c96714100e914335079e62 Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Wed, 30 Oct 2019 16:23:14 +0000 Subject: [PATCH 1/5] Copied files from aiida-crystal17, then removed/replaced all crystal17 specific code/references commit: 1eab9635e81a29956b0113bc91e13d5a4ee4269d --- .coveragerc | 2 - .flake8 | 10 + .gitattributes | 2 - .gitchangelog.rc | 316 + .gitignore | 10 +- .pre-commit-config.yaml | 98 +- .pre-commit/check_version.py | 130 + .prospector.yaml | 4 - .readthedocs.yml | 23 +- .travis-data/check_version.py | 36 - .travis.yml | 154 +- .vscode/settings.json | 42 + LICENSE | 186 +- MANIFEST.in | 5 +- README.md | 105 +- aiida_gulp/__init__.py | 23 +- aiida_gulp/calculations/__init__.py | 15 + aiida_gulp/calculations/base.py | 330 - aiida_gulp/calculations/gulp_abstract.py | 194 + aiida_gulp/calculations/gulp_fitting.py | 324 + aiida_gulp/calculations/gulp_optimize.py | 110 + aiida_gulp/calculations/gulp_single.py | 44 + aiida_gulp/calculations/optimize.py | 96 - .../calculations/potentials/__init__.py | 23 - aiida_gulp/calculations/potentials/reaxff.py | 7 - aiida_gulp/calculations/single.py | 63 - aiida_gulp/cmndline/__init__.py | 15 + aiida_gulp/cmndline/potentials.py | 74 + aiida_gulp/common/__init__.py | 25 + aiida_gulp/common/atoms.py | 377 + aiida_gulp/common/compatibility.py | 41 - aiida_gulp/common/cry_fname_map.yaml | 87 + aiida_gulp/common/dict_funcs.py | 81 + aiida_gulp/common/kpoints.py | 50 + aiida_gulp/common/mapping.py | 115 + aiida_gulp/common/parsing.py | 70 + aiida_gulp/common/units.py | 166 - aiida_gulp/common/units.yaml | 1343 + aiida_gulp/data/__init__.py | 15 + aiida_gulp/data/potential.py | 182 + aiida_gulp/data/symmetry.py | 222 + aiida_gulp/geometry.py | 550 - aiida_gulp/parsers/__init__.py | 15 + aiida_gulp/parsers/optimize.py | 124 - aiida_gulp/parsers/parse_fitting.py | 146 + aiida_gulp/parsers/parse_opt.py | 186 + aiida_gulp/parsers/parse_output.py | 188 - aiida_gulp/parsers/parse_single.py | 86 + aiida_gulp/parsers/raw/__init__.py | 16 + aiida_gulp/parsers/raw/parse_output_common.py | 324 + aiida_gulp/parsers/raw/parse_output_fit.py | 232 + aiida_gulp/parsers/raw/parse_output_std.py | 273 + aiida_gulp/parsers/raw/write_geometry.py | 177 + aiida_gulp/parsers/raw/write_input.py | 271 + aiida_gulp/parsers/raw/write_input_fitting.py | 97 + aiida_gulp/parsers/reaxff_convert.py | 706 - aiida_gulp/parsers/single.py | 110 - aiida_gulp/potentials/__init__.py | 15 + aiida_gulp/potentials/base.py | 775 + aiida_gulp/potentials/common.py | 71 + aiida_gulp/potentials/lj.py | 168 + aiida_gulp/potentials/raw_reaxff.py | 1039 + aiida_gulp/potentials/reaxff.py | 59 + aiida_gulp/symmetry/__init__.py | 16 + aiida_gulp/symmetry/symmetry.py | 824 + aiida_gulp/tests/__init__.py | 7 +- aiida_gulp/tests/conftest.py | 49 + aiida_gulp/tests/mock_gulp | 59 - aiida_gulp/tests/mock_gulp.py | 103 + .../tests/output_files/opt_reaxff_pyrite.gout | 11508 ------ .../{input_files => raw_files}/__init__.py | 0 .../cif}/__init__.py | 0 aiida_gulp/tests/raw_files/cif/pyrite.cif | 77 + .../empty.gin => raw_files/gulp/__init__.py} | 0 .../tests/raw_files/gulp/failed/__init__.py | 0 .../gulp/failed/empty_error.gout} | 0 .../raw_files/gulp/failed/opt_step_limit.gout | 267 + .../raw_files/gulp/fit_lj_fes/__init__.py | 0 .../raw_files/gulp/fit_lj_fes/fitting.grs | 71 + .../tests/raw_files/gulp/fit_lj_fes/main.gin | 79 + .../tests/raw_files/gulp/fit_lj_fes/main.gout | 443 + .../raw_files/gulp/fit_lj_fes/main_stderr.txt | 0 .../raw_files/gulp/fit_reaxff_fes/__init__.py | 0 .../raw_files/gulp/fit_reaxff_fes/fitting.grs | 139 + .../raw_files/gulp/fit_reaxff_fes/main.gin | 177 + .../raw_files/gulp/fit_reaxff_fes/main.gout | 476 + .../gulp/fit_reaxff_fes/main_stderr.txt | 0 .../gulp/non_primitive_opt/__init__.py | 0 .../raw_files/gulp/non_primitive_opt/main.gin | 26 + .../gulp/non_primitive_opt/main.gout | 413 + .../gulp/non_primitive_opt/readme.txt | 1 + .../gulp/optimize_lj_pyrite/__init__.py | 0 .../gulp/optimize_lj_pyrite/main.gin | 35 + .../gulp/optimize_lj_pyrite/main.gout | 353 + .../gulp/optimize_lj_pyrite/output.cif | 33 + .../gulp/optimize_lj_pyrite_symm/__init__.py | 0 .../gulp/optimize_lj_pyrite_symm/main.gin} | 120 +- .../gulp/optimize_lj_pyrite_symm/main.gout | 483 + .../gulp/optimize_lj_pyrite_symm/output.cif} | 22 +- .../gulp/optimize_reaxff_pyrite/__init__.py | 0 .../gulp/optimize_reaxff_pyrite/main.gin | 131 + .../gulp/optimize_reaxff_pyrite/main.gout | 28822 ++++++++++++++++ .../gulp/optimize_reaxff_pyrite/output.cif | 33 + .../optimize_reaxff_pyrite_symm/__init__.py | 0 .../optimize_reaxff_pyrite_symm/main.gin} | 131 +- .../optimize_reaxff_pyrite_symm/main.gout | 11344 ++++++ .../main_stderr.txt | 1 + .../optimize_reaxff_pyrite_symm/output.cif | 33 + .../gulp/potentials}/FeCrOSCH.reaxff | 0 .../raw_files/gulp/potentials/__init__.py | 0 .../raw_files/gulp/s2_polymer_opt/__init__.py | 0 .../raw_files/gulp/s2_polymer_opt/main.gin | 121 + .../raw_files/gulp/s2_polymer_opt/main.gout | 736 + .../gulp/s2_polymer_opt/main_stderr.txt | 0 .../raw_files/gulp/s2_polymer_opt/output.cif | 4 + .../gulp/single_lj_pyrite/__init__.py | 0 .../raw_files/gulp/single_lj_pyrite/main.gin | 29 + .../raw_files/gulp/single_lj_pyrite/main.gout | 155 + .../gulp/single_reaxff_pyrite/__init__.py | 0 .../gulp/single_reaxff_pyrite/main.gin | 125 + .../gulp/single_reaxff_pyrite/main.gout} | 223 +- .../raw_files/gulp/surface_opt/__init__.py | 0 .../tests/raw_files/gulp/surface_opt/main.gin | 36 + .../raw_files/gulp/surface_opt/main.gout | 279 + .../raw_files/gulp/surface_opt/readme.txt | 1 + aiida_gulp/tests/resources.py | 211 + aiida_gulp/tests/test_calc_main.py | 297 - .../tests/test_calculations/__init__.py | 0 .../tests/test_calculations/test_fitting.py | 200 + .../test_calcjob_submit_lj_fes.txt | 79 + .../test_calcjob_submit_lj_fes.yml | 13 + .../test_calcjob_submit_reaxff_fes.txt | 189 + .../test_calcjob_submit_reaxff_fes.yml | 13 + .../test_fitting/test_run_lj_fes.yml | 116 + .../test_fitting/test_run_reaxff_fes.yml | 102 + .../test_calculations/test_gulp_optimize.py | 222 + .../test_run_optimize_lj.yml | 13 + .../test_run_optimize_lj_with_symm.yml | 15 + .../test_run_optimize_reaxff.yml | 68 + .../test_run_optimize_reaxff_symm.yml | 69 + .../test_calculations/test_gulp_single.py | 93 + .../test_gulp_single/test_run_single_lj.yml | 9 + .../test_run_single_reaxff.yml | 64 + .../tests/test_cmndline/test_potential.py | 9 + .../tests/test_data/test_data_potential.py | 20 + .../test_data_potential/test_potential_lj.yml | 12 + aiida_gulp/tests/test_data/test_symmetry.py | 44 + aiida_gulp/tests/test_main_parser.py | 60 - aiida_gulp/tests/test_parsers/__init__.py | 0 .../tests/test_parsers/test_parse_main.py | 116 + .../test_parsers/test_parse_output_fit.py | 16 + .../test_parse_file_lj.yml | 101 + .../test_parse_file_reaxff.yml | 101 + .../test_parsers/test_parse_output_std.py | 114 + .../test_parse_failed_optimize.yml | 39 + .../test_parse_non_primitive_opt.yml | 16 + .../test_parse_optimize_reaxff_pyrite.yml | 71 + .../test_parse_polymer_opt.yml | 63 + .../test_parse_single_lj_pyrite.yml | 11 + .../test_parse_single_reaxff_pyrite.yml | 66 + .../test_parse_surface_opt.yml | 150 + .../tests/test_parsers/test_write_input.py | 224 + aiida_gulp/tests/test_potentials/__init__.py | 0 aiida_gulp/tests/test_potentials/test_base.py | 92 + aiida_gulp/tests/test_potentials/test_lj.py | 139 + .../tests/test_potentials/test_reaxff.py | 349 + .../test_reaxff/test_read_lammps_format.yml | 1977 ++ .../test_round_trip_lammps_format.txt | 292 + .../test_reaxff/test_write_gulp_format.txt | 642 + .../test_write_gulp_format_with_filter.txt | 112 + .../test_write_gulp_format_with_filter.yml | 227 + .../test_write_gulp_format_with_fitting.txt | 116 + aiida_gulp/tests/test_reaxff_parse.py | 845 - aiida_gulp/tests/test_symmetry/__init__.py | 0 .../tests/test_symmetry/test_symmetry.py | 214 + aiida_gulp/tests/utils.py | 694 +- aiida_gulp/unit_styles.py | 192 + aiida_gulp/validation/__init__.py | 62 +- aiida_gulp/validation/reaxff.schema.json | 859 - aiida_gulp/validation/schemas/__init__.py | 0 .../schemas/fitting.base.schema.json | 88 + .../validation/schemas/fitting.lj.schema.json | 40 + .../schemas/fitting.reaxff.schema.json | 166 + .../schemas/fitting_settings.schema.json | 58 + .../schemas/gulp_fitting_flags.yaml | 575 + .../gulp_optimize.schema.json} | 2 +- .../schemas/potential.base.schema.json | 121 + .../schemas/potential.lj.schema.json | 73 + .../schemas/potential.reaxff.schema.json | 278 + .../{ => schemas}/structure.schema.json | 8 +- .../validation/schemas/symmetry.schema.json | 50 + aiida_gulp/validation/symmetry.schema.json | 71 - aiida_gulp/validation/utils.py | 123 + clean.sh | 1 + conda_dev_env.yml | 39 + conftest.py | 289 +- doc8.ini | 2 + docs/.gitignore | 7 +- docs/Makefile | 6 +- docs/environment.yaml | 9 + docs/source/api_index.rst | 7 + docs/source/changelog.rst | 139 + docs/source/conf.py | 529 +- docs/source/developer_guide/index.rst | 64 - docs/source/index.rst | 32 +- docs/source/rtd_settings.py | 47 +- docs/source/user_guide/calc_gulp.ipynb | 1312 + docs/source/user_guide/get_started.rst | 37 - docs/source/user_guide/index.rst | 11 - docs/source/user_guide/test_notebooks.py | 108 + docs/source/user_guide/tutorial.rst | 23 - pyproject.toml | 26 + pytest.ini | 3 + setup.json | 136 +- setup.py | 14 +- 215 files changed, 65681 insertions(+), 17459 deletions(-) delete mode 100644 .coveragerc create mode 100644 .flake8 delete mode 100644 .gitattributes create mode 100644 .gitchangelog.rc create mode 100644 .pre-commit/check_version.py delete mode 100644 .prospector.yaml delete mode 100644 .travis-data/check_version.py create mode 100644 .vscode/settings.json delete mode 100644 aiida_gulp/calculations/base.py create mode 100644 aiida_gulp/calculations/gulp_abstract.py create mode 100644 aiida_gulp/calculations/gulp_fitting.py create mode 100644 aiida_gulp/calculations/gulp_optimize.py create mode 100644 aiida_gulp/calculations/gulp_single.py delete mode 100644 aiida_gulp/calculations/optimize.py delete mode 100644 aiida_gulp/calculations/potentials/__init__.py delete mode 100644 aiida_gulp/calculations/potentials/reaxff.py delete mode 100644 aiida_gulp/calculations/single.py create mode 100644 aiida_gulp/cmndline/__init__.py create mode 100644 aiida_gulp/cmndline/potentials.py create mode 100644 aiida_gulp/common/atoms.py delete mode 100644 aiida_gulp/common/compatibility.py create mode 100644 aiida_gulp/common/cry_fname_map.yaml create mode 100644 aiida_gulp/common/dict_funcs.py create mode 100644 aiida_gulp/common/kpoints.py create mode 100644 aiida_gulp/common/mapping.py create mode 100644 aiida_gulp/common/parsing.py delete mode 100644 aiida_gulp/common/units.py create mode 100644 aiida_gulp/common/units.yaml create mode 100644 aiida_gulp/data/__init__.py create mode 100644 aiida_gulp/data/potential.py create mode 100644 aiida_gulp/data/symmetry.py delete mode 100644 aiida_gulp/geometry.py delete mode 100644 aiida_gulp/parsers/optimize.py create mode 100644 aiida_gulp/parsers/parse_fitting.py create mode 100644 aiida_gulp/parsers/parse_opt.py delete mode 100644 aiida_gulp/parsers/parse_output.py create mode 100644 aiida_gulp/parsers/parse_single.py create mode 100644 aiida_gulp/parsers/raw/__init__.py create mode 100644 aiida_gulp/parsers/raw/parse_output_common.py create mode 100644 aiida_gulp/parsers/raw/parse_output_fit.py create mode 100644 aiida_gulp/parsers/raw/parse_output_std.py create mode 100644 aiida_gulp/parsers/raw/write_geometry.py create mode 100644 aiida_gulp/parsers/raw/write_input.py create mode 100644 aiida_gulp/parsers/raw/write_input_fitting.py delete mode 100644 aiida_gulp/parsers/reaxff_convert.py delete mode 100644 aiida_gulp/parsers/single.py create mode 100644 aiida_gulp/potentials/__init__.py create mode 100644 aiida_gulp/potentials/base.py create mode 100644 aiida_gulp/potentials/common.py create mode 100644 aiida_gulp/potentials/lj.py create mode 100644 aiida_gulp/potentials/raw_reaxff.py create mode 100644 aiida_gulp/potentials/reaxff.py create mode 100644 aiida_gulp/symmetry/__init__.py create mode 100644 aiida_gulp/symmetry/symmetry.py create mode 100644 aiida_gulp/tests/conftest.py delete mode 100644 aiida_gulp/tests/mock_gulp create mode 100644 aiida_gulp/tests/mock_gulp.py delete mode 100644 aiida_gulp/tests/output_files/opt_reaxff_pyrite.gout rename aiida_gulp/tests/{input_files => raw_files}/__init__.py (100%) rename aiida_gulp/tests/{output_files => raw_files/cif}/__init__.py (100%) create mode 100644 aiida_gulp/tests/raw_files/cif/pyrite.cif rename aiida_gulp/tests/{input_files/empty.gin => raw_files/gulp/__init__.py} (100%) create mode 100644 aiida_gulp/tests/raw_files/gulp/failed/__init__.py rename aiida_gulp/tests/{output_files/empty.gout => raw_files/gulp/failed/empty_error.gout} (100%) create mode 100644 aiida_gulp/tests/raw_files/gulp/failed/opt_step_limit.gout create mode 100644 aiida_gulp/tests/raw_files/gulp/fit_lj_fes/__init__.py create mode 100644 aiida_gulp/tests/raw_files/gulp/fit_lj_fes/fitting.grs create mode 100644 aiida_gulp/tests/raw_files/gulp/fit_lj_fes/main.gin create mode 100644 aiida_gulp/tests/raw_files/gulp/fit_lj_fes/main.gout create mode 100644 aiida_gulp/tests/raw_files/gulp/fit_lj_fes/main_stderr.txt create mode 100644 aiida_gulp/tests/raw_files/gulp/fit_reaxff_fes/__init__.py create mode 100644 aiida_gulp/tests/raw_files/gulp/fit_reaxff_fes/fitting.grs create mode 100644 aiida_gulp/tests/raw_files/gulp/fit_reaxff_fes/main.gin create mode 100644 aiida_gulp/tests/raw_files/gulp/fit_reaxff_fes/main.gout create mode 100644 aiida_gulp/tests/raw_files/gulp/fit_reaxff_fes/main_stderr.txt create mode 100644 aiida_gulp/tests/raw_files/gulp/non_primitive_opt/__init__.py create mode 100644 aiida_gulp/tests/raw_files/gulp/non_primitive_opt/main.gin create mode 100644 aiida_gulp/tests/raw_files/gulp/non_primitive_opt/main.gout create mode 100644 aiida_gulp/tests/raw_files/gulp/non_primitive_opt/readme.txt create mode 100644 aiida_gulp/tests/raw_files/gulp/optimize_lj_pyrite/__init__.py create mode 100644 aiida_gulp/tests/raw_files/gulp/optimize_lj_pyrite/main.gin create mode 100644 aiida_gulp/tests/raw_files/gulp/optimize_lj_pyrite/main.gout create mode 100644 aiida_gulp/tests/raw_files/gulp/optimize_lj_pyrite/output.cif create mode 100644 aiida_gulp/tests/raw_files/gulp/optimize_lj_pyrite_symm/__init__.py rename aiida_gulp/tests/{input_files/single_reaxff_pyrite.gin => raw_files/gulp/optimize_lj_pyrite_symm/main.gin} (50%) create mode 100644 aiida_gulp/tests/raw_files/gulp/optimize_lj_pyrite_symm/main.gout rename aiida_gulp/tests/{output_files/opt_reaxff_pyrite.cif => raw_files/gulp/optimize_lj_pyrite_symm/output.cif} (55%) create mode 100644 aiida_gulp/tests/raw_files/gulp/optimize_reaxff_pyrite/__init__.py create mode 100644 aiida_gulp/tests/raw_files/gulp/optimize_reaxff_pyrite/main.gin create mode 100644 aiida_gulp/tests/raw_files/gulp/optimize_reaxff_pyrite/main.gout create mode 100644 aiida_gulp/tests/raw_files/gulp/optimize_reaxff_pyrite/output.cif create mode 100644 aiida_gulp/tests/raw_files/gulp/optimize_reaxff_pyrite_symm/__init__.py rename aiida_gulp/tests/{input_files/opt_reaxff_pyrite.gin => raw_files/gulp/optimize_reaxff_pyrite_symm/main.gin} (66%) create mode 100644 aiida_gulp/tests/raw_files/gulp/optimize_reaxff_pyrite_symm/main.gout create mode 100644 aiida_gulp/tests/raw_files/gulp/optimize_reaxff_pyrite_symm/main_stderr.txt create mode 100644 aiida_gulp/tests/raw_files/gulp/optimize_reaxff_pyrite_symm/output.cif rename aiida_gulp/tests/{input_files => raw_files/gulp/potentials}/FeCrOSCH.reaxff (100%) create mode 100644 aiida_gulp/tests/raw_files/gulp/potentials/__init__.py create mode 100644 aiida_gulp/tests/raw_files/gulp/s2_polymer_opt/__init__.py create mode 100644 aiida_gulp/tests/raw_files/gulp/s2_polymer_opt/main.gin create mode 100644 aiida_gulp/tests/raw_files/gulp/s2_polymer_opt/main.gout create mode 100644 aiida_gulp/tests/raw_files/gulp/s2_polymer_opt/main_stderr.txt create mode 100644 aiida_gulp/tests/raw_files/gulp/s2_polymer_opt/output.cif create mode 100644 aiida_gulp/tests/raw_files/gulp/single_lj_pyrite/__init__.py create mode 100644 aiida_gulp/tests/raw_files/gulp/single_lj_pyrite/main.gin create mode 100644 aiida_gulp/tests/raw_files/gulp/single_lj_pyrite/main.gout create mode 100644 aiida_gulp/tests/raw_files/gulp/single_reaxff_pyrite/__init__.py create mode 100644 aiida_gulp/tests/raw_files/gulp/single_reaxff_pyrite/main.gin rename aiida_gulp/tests/{output_files/single_reaxff_pyrite.gout => raw_files/gulp/single_reaxff_pyrite/main.gout} (75%) create mode 100644 aiida_gulp/tests/raw_files/gulp/surface_opt/__init__.py create mode 100644 aiida_gulp/tests/raw_files/gulp/surface_opt/main.gin create mode 100644 aiida_gulp/tests/raw_files/gulp/surface_opt/main.gout create mode 100644 aiida_gulp/tests/raw_files/gulp/surface_opt/readme.txt create mode 100644 aiida_gulp/tests/resources.py delete mode 100644 aiida_gulp/tests/test_calc_main.py create mode 100644 aiida_gulp/tests/test_calculations/__init__.py create mode 100644 aiida_gulp/tests/test_calculations/test_fitting.py create mode 100644 aiida_gulp/tests/test_calculations/test_fitting/test_calcjob_submit_lj_fes.txt create mode 100644 aiida_gulp/tests/test_calculations/test_fitting/test_calcjob_submit_lj_fes.yml create mode 100644 aiida_gulp/tests/test_calculations/test_fitting/test_calcjob_submit_reaxff_fes.txt create mode 100644 aiida_gulp/tests/test_calculations/test_fitting/test_calcjob_submit_reaxff_fes.yml create mode 100644 aiida_gulp/tests/test_calculations/test_fitting/test_run_lj_fes.yml create mode 100644 aiida_gulp/tests/test_calculations/test_fitting/test_run_reaxff_fes.yml create mode 100644 aiida_gulp/tests/test_calculations/test_gulp_optimize.py create mode 100644 aiida_gulp/tests/test_calculations/test_gulp_optimize/test_run_optimize_lj.yml create mode 100644 aiida_gulp/tests/test_calculations/test_gulp_optimize/test_run_optimize_lj_with_symm.yml create mode 100644 aiida_gulp/tests/test_calculations/test_gulp_optimize/test_run_optimize_reaxff.yml create mode 100644 aiida_gulp/tests/test_calculations/test_gulp_optimize/test_run_optimize_reaxff_symm.yml create mode 100644 aiida_gulp/tests/test_calculations/test_gulp_single.py create mode 100644 aiida_gulp/tests/test_calculations/test_gulp_single/test_run_single_lj.yml create mode 100644 aiida_gulp/tests/test_calculations/test_gulp_single/test_run_single_reaxff.yml create mode 100644 aiida_gulp/tests/test_cmndline/test_potential.py create mode 100644 aiida_gulp/tests/test_data/test_data_potential.py create mode 100644 aiida_gulp/tests/test_data/test_data_potential/test_potential_lj.yml create mode 100644 aiida_gulp/tests/test_data/test_symmetry.py delete mode 100644 aiida_gulp/tests/test_main_parser.py create mode 100644 aiida_gulp/tests/test_parsers/__init__.py create mode 100644 aiida_gulp/tests/test_parsers/test_parse_main.py create mode 100644 aiida_gulp/tests/test_parsers/test_parse_output_fit.py create mode 100644 aiida_gulp/tests/test_parsers/test_parse_output_fit/test_parse_file_lj.yml create mode 100644 aiida_gulp/tests/test_parsers/test_parse_output_fit/test_parse_file_reaxff.yml create mode 100644 aiida_gulp/tests/test_parsers/test_parse_output_std.py create mode 100644 aiida_gulp/tests/test_parsers/test_parse_output_std/test_parse_failed_optimize.yml create mode 100644 aiida_gulp/tests/test_parsers/test_parse_output_std/test_parse_non_primitive_opt.yml create mode 100644 aiida_gulp/tests/test_parsers/test_parse_output_std/test_parse_optimize_reaxff_pyrite.yml create mode 100644 aiida_gulp/tests/test_parsers/test_parse_output_std/test_parse_polymer_opt.yml create mode 100644 aiida_gulp/tests/test_parsers/test_parse_output_std/test_parse_single_lj_pyrite.yml create mode 100644 aiida_gulp/tests/test_parsers/test_parse_output_std/test_parse_single_reaxff_pyrite.yml create mode 100644 aiida_gulp/tests/test_parsers/test_parse_output_std/test_parse_surface_opt.yml create mode 100644 aiida_gulp/tests/test_parsers/test_write_input.py create mode 100644 aiida_gulp/tests/test_potentials/__init__.py create mode 100644 aiida_gulp/tests/test_potentials/test_base.py create mode 100644 aiida_gulp/tests/test_potentials/test_lj.py create mode 100644 aiida_gulp/tests/test_potentials/test_reaxff.py create mode 100644 aiida_gulp/tests/test_potentials/test_reaxff/test_read_lammps_format.yml create mode 100644 aiida_gulp/tests/test_potentials/test_reaxff/test_round_trip_lammps_format.txt create mode 100644 aiida_gulp/tests/test_potentials/test_reaxff/test_write_gulp_format.txt create mode 100644 aiida_gulp/tests/test_potentials/test_reaxff/test_write_gulp_format_with_filter.txt create mode 100644 aiida_gulp/tests/test_potentials/test_reaxff/test_write_gulp_format_with_filter.yml create mode 100644 aiida_gulp/tests/test_potentials/test_reaxff/test_write_gulp_format_with_fitting.txt delete mode 100644 aiida_gulp/tests/test_reaxff_parse.py create mode 100644 aiida_gulp/tests/test_symmetry/__init__.py create mode 100644 aiida_gulp/tests/test_symmetry/test_symmetry.py create mode 100644 aiida_gulp/unit_styles.py delete mode 100644 aiida_gulp/validation/reaxff.schema.json create mode 100644 aiida_gulp/validation/schemas/__init__.py create mode 100644 aiida_gulp/validation/schemas/fitting.base.schema.json create mode 100644 aiida_gulp/validation/schemas/fitting.lj.schema.json create mode 100644 aiida_gulp/validation/schemas/fitting.reaxff.schema.json create mode 100644 aiida_gulp/validation/schemas/fitting_settings.schema.json create mode 100644 aiida_gulp/validation/schemas/gulp_fitting_flags.yaml rename aiida_gulp/validation/{optimize.schema.json => schemas/gulp_optimize.schema.json} (99%) create mode 100644 aiida_gulp/validation/schemas/potential.base.schema.json create mode 100644 aiida_gulp/validation/schemas/potential.lj.schema.json create mode 100644 aiida_gulp/validation/schemas/potential.reaxff.schema.json rename aiida_gulp/validation/{ => schemas}/structure.schema.json (86%) create mode 100644 aiida_gulp/validation/schemas/symmetry.schema.json delete mode 100644 aiida_gulp/validation/symmetry.schema.json create mode 100644 aiida_gulp/validation/utils.py create mode 100644 conda_dev_env.yml create mode 100644 doc8.ini create mode 100644 docs/environment.yaml create mode 100644 docs/source/api_index.rst create mode 100644 docs/source/changelog.rst delete mode 100644 docs/source/developer_guide/index.rst create mode 100644 docs/source/user_guide/calc_gulp.ipynb delete mode 100644 docs/source/user_guide/get_started.rst delete mode 100644 docs/source/user_guide/index.rst create mode 100644 docs/source/user_guide/test_notebooks.py delete mode 100644 docs/source/user_guide/tutorial.rst create mode 100644 pyproject.toml create mode 100644 pytest.ini mode change 100644 => 100755 setup.py diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index f10f6ff..0000000 --- a/.coveragerc +++ /dev/null @@ -1,2 +0,0 @@ -[run] -source=aiida_gulp diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..f4ae7d6 --- /dev/null +++ b/.flake8 @@ -0,0 +1,10 @@ +[flake8] +max-line-length = 120 +import-order-style = appnexus +application-import-names = aiida_gulp +application-package-names = aiida +ignore = + # ignore `whitespace before ':'`, because incompatible with black formatter + E203 + # ignore `line break before binary operator`, because incompatible with black formatter + W503 diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index dfe0770..0000000 --- a/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto diff --git a/.gitchangelog.rc b/.gitchangelog.rc new file mode 100644 index 0000000..e48dac9 --- /dev/null +++ b/.gitchangelog.rc @@ -0,0 +1,316 @@ +# -*- coding: utf-8; mode: python -*- +# +# Format +# +# ACTION: [AUDIENCE:] COMMIT_MSG [!TAG ...] +# +# Description +# +# ACTION is one of 'chg', 'fix', 'new' +# +# Is WHAT the change is about. +# +# 'chg' is for refactor, small improvement, cosmetic changes... +# 'fix' is for bug fixes +# 'new' is for new features, big improvement +# +# AUDIENCE is optional and one of 'dev', 'usr', 'pkg', 'test', 'doc' +# +# Is WHO is concerned by the change. +# +# 'dev' is for developpers (API changes, refactors...) +# 'usr' is for final users (UI changes) +# 'pkg' is for packagers (packaging changes) +# 'test' is for testers (test only related changes) +# 'doc' is for doc guys (doc only changes) +# +# COMMIT_MSG is ... well ... the commit message itself. +# +# TAGs are additionnal adjective as 'refactor' 'minor' 'cosmetic' +# +# They are preceded with a '!' or a '@' (prefer the former, as the +# latter is wrongly interpreted in github.) Commonly used tags are: +# +# 'refactor' is obviously for refactoring code only +# 'minor' is for a very meaningless change (a typo, adding a comment) +# 'cosmetic' is for cosmetic driven change (re-indentation, 80-col...) +# 'wip' is for partial functionality but complete subfunctionality. +# +# Example: +# +# new: usr: support of bazaar implemented +# chg: re-indentend some lines !cosmetic +# new: dev: updated code to be compatible with last version of killer lib. +# fix: pkg: updated year of licence coverage. +# new: test: added a bunch of test around user usability of feature X. +# fix: typo in spelling my name in comment. !minor +# +# Please note that multi-line commit message are supported, and only the +# first line will be considered as the "summary" of the commit message. So +# tags, and other rules only applies to the summary. The body of the commit +# message will be displayed in the changelog without reformatting. + +# +# ``ignore_regexps`` is a line of regexps +# +# Any commit having its full commit message matching any regexp listed here +# will be ignored and won't be reported in the changelog. +# + +# r'[mM]inor.*', +# r'[tT]est fix.*', +# r'[tT]ravis fix.*', +# r'[fF]ix .*', +# r'[tT]ry .*', +# r'[tT]est.', +# r'[dD]oc fix.*', +# r'Coverage.*', +# r'^$' + +ignore_regexps = [ + r'^[tT]est$', + r'^[tT]est fix.*$', + r'^[tT]ravis fix.*$', + r'^[yY]apf (test)? fix.*$', + r'^[pP]re-commit fix.*$', + r'^[fF]ix [tT]est[s]?.*$', + r'^[fF]ix [cC]overall[s]?.*$', + r'^[iI]mprove[d]? [tT]est[s]?.*$', + r'^[cC]overage fix.*$', + r'^[cC]overage$', + r'^[tT]ry.*$', + r'^[bB]ump version.*$', + r'^[dD]oc test fix.*$', + r'^.*Merge pull request.*$', + r'@minor', + r'!minor', + r'@cosmetic', + r'!cosmetic', + r'@refactor', + r'!refactor', + r'@wip', + r'!wip', + r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*[p|P]kg:', + r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*[d|D]ev:', + r'^(.{3,3}\s*:)?\s*[fF]irst commit.?\s*$', + r'^$', # ignore commits with empty messages + + # one time removals + r'^[Pp]re commit( test)? fix\.$', + r'^Add test for aiida development version.*$', + r'^Test correction\.$', + r'^Minor improvements\.$', + r'^Style test fix\.$', +] + +# ``section_regexps`` is a list of 2-tuples associating a string label and a +# list of regexp +# +# Commit messages will be classified in sections thanks to this. Section +# titles are the label, and a commit is classified under this section if any +# of the regexps associated is matching. +# +# Please note that ``section_regexps`` will only classify commits and won't +# make any changes to the contents. So you'll probably want to go check +# ``subject_process`` (or ``body_process``) to do some changes to the subject, +# whenever you are tweaking this variable. +# +section_regexps = [ + ('New', [ + r'^[nN]ew\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$', + ]), + ('Changes', [ + r'^[cC]hg\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$', + ]), + ('Fix', [ + r'^[fF]ix\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$', + ]), + ( + 'Other', + None # Match all lines + ), +] + +# ``body_process`` is a callable +# +# This callable will be given the original body and result will +# be used in the changelog. +# +# Available constructs are: +# +# - any python callable that take one txt argument and return txt argument. +# +# - ReSub(pattern, replacement): will apply regexp substitution. +# +# - Indent(chars=" "): will indent the text with the prefix +# Please remember that template engines gets also to modify the text and +# will usually indent themselves the text if needed. +# +# - Wrap(regexp=r"\n\n"): re-wrap text in separate paragraph to fill 80-Columns +# +# - noop: do nothing +# +# - ucfirst: ensure the first letter is uppercase. +# (usually used in the ``subject_process`` pipeline) +# +# - final_dot: ensure text finishes with a dot +# (usually used in the ``subject_process`` pipeline) +# +# - strip: remove any spaces before or after the content of the string +# +# - SetIfEmpty(msg="No commit message."): will set the text to +# whatever given ``msg`` if the current text is empty. +# +# Additionally, you can `pipe` the provided filters, for instance: +# body_process = Wrap(regexp=r'\n(?=\w+\s*:)') | Indent(chars=" ") +# body_process = Wrap(regexp=r'\n(?=\w+\s*:)') + +body_process = (strip | ReSub(r'\*', r'\\*') | ReSub(r'((^|\n)[A-Z]\w+(-\w+)*: .*(\n\s+.*)*)+$', r'') | strip | # noqa + final_dot | ucfirst) # noqa + +# ``subject_process`` is a callable +# +# This callable will be given the original subject and result will +# be used in the changelog. +# +# Available constructs are those listed in ``body_process`` doc. +subject_process = ( + strip | ReSub(r'\*', r'\\*') | ReSub( # noqa + r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n@]*)(@[a-z]+\s+)*$', r'\4') | + SetIfEmpty("No commit message.") | ucfirst | final_dot) # noqa + +# ``tag_filter_regexp`` is a regexp +# +# Tags that will be used for the changelog must match this regexp. +# +tag_filter_regexp = r'^[v]?[0-9]+\.[0-9]+(\.[0-9]+)?([ab][0-9])?$' + +# ``unreleased_version_label`` is a string or a callable that outputs a string +# +# This label will be used as the changelog Title of the last set of changes +# between last valid tag and HEAD if any. +unreleased_version_label = "(unreleased)" + +# ``output_engine`` is a callable +# +# This will change the output format of the generated changelog file +# +# Available choices are: +# +# - rest_py +# +# Legacy pure python engine, outputs ReSTructured text. +# This is the default. +# +# - mustache() +# +# Template name could be any of the available templates in +# ``templates/mustache/*.tpl``. +# Requires python package ``pystache``. +# Examples: +# - mustache("markdown") +# - mustache("restructuredtext") +# +# - makotemplate() +# +# Template name could be any of the available templates in +# ``templates/mako/*.tpl``. +# Requires python package ``mako``. +# Examples: +# - makotemplate("restructuredtext") +# +output_engine = rest_py # noqa +# output_engine = mustache("restructuredtext") +# output_engine = mustache("markdown") +# output_engine = makotemplate("restructuredtext") + +# ``include_merge`` is a boolean +# +# This option tells git-log whether to include merge commits in the log. +# The default is to include them. +include_merge = True + +# ``log_encoding`` is a string identifier +# +# This option tells gitchangelog what encoding is outputed by ``git log``. +# The default is to be clever about it: it checks ``git config`` for +# ``i18n.logOutputEncoding``, and if not found will default to git's own +# default: ``utf-8``. +# log_encoding = 'utf-8' + +# ``publish`` is a callable +# +# Sets what ``gitchangelog`` should do with the output generated by +# the output engine. ``publish`` is a callable taking one argument +# that is an interator on lines from the output engine. +# +# Some helper callable are provided: +# +# Available choices are: +# +# - stdout +# +# Outputs directly to standard output +# (This is the default) +# +# - FileInsertAtFirstRegexMatch(file, pattern, idx=lamda m: m.start()) +# +# Creates a callable that will parse given file for the given +# regex pattern and will insert the output in the file. +# ``idx`` is a callable that receive the matching object and +# must return a integer index point where to insert the +# the output in the file. Default is to return the position of +# the start of the matched string. +# +# - FileRegexSubst(file, pattern, replace, flags) +# +# Apply a replace inplace in the given file. Your regex pattern must +# take care of everything and might be more complex. Check the README +# for a complete copy-pastable example. +# +# publish = FileInsertIntoFirstRegexMatch( +# "CHANGELOG.rst", +# r'/(?P[0-9]+\.[0-9]+(\.[0-9]+)?)\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)\n--+\n/', +# idx=lambda m: m.start(1) +# ) +# publish = stdout + +# ``revs`` is a list of callable or a list of string +# +# callable will be called to resolve as strings and allow dynamical +# computation of these. The result will be used as revisions for +# gitchangelog (as if directly stated on the command line). This allows +# to filter exaclty which commits will be read by gitchangelog. +# +# To get a full documentation on the format of these strings, please +# refer to the ``git rev-list`` arguments. There are many examples. +# +# Using callables is especially useful, for instance, if you +# are using gitchangelog to generate incrementally your changelog. +# +# Some helpers are provided, you can use them:: +# +# - FileFirstRegexMatch(file, pattern): will return a callable that will +# return the first string match for the given pattern in the given file. +# If you use named sub-patterns in your regex pattern, it'll output only +# the string matching the regex pattern named "rev". +# +# - Caret(rev): will return the rev prefixed by a "^", which is a +# way to remove the given revision and all its ancestor. +# +# Please note that if you provide a rev-list on the command line, it'll +# replace this value (which will then be ignored). +# +# If empty, then ``gitchangelog`` will act as it had to generate a full +# changelog. +# +# The default is to use all commits to make the changelog. +# revs = ["^1.0.3", ] +# revs = [ +# Caret( +# FileFirstRegexMatch( +# "CHANGELOG.rst", +# r"(?P[0-9]+\.[0-9]+(\.[0-9]+)?)\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)\n--+\n")), +# "HEAD" +# ] +revs = [] diff --git a/.gitignore b/.gitignore index e25ad0b..fb8111d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,10 +6,16 @@ .project *.egg* .DS_Store -.coverage .idea/ .pytest_cache/ +.ropeproject/ .idea/vcs.xml postgres*.log .aiida_envs.yaml - +.ropeproject +_archive/ +.ipynb_checkpoints/ +databases/ +test_workdir/ +_archive/ +pip-wheel-metadata/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 018df7b..8383665 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,37 +1,67 @@ # Install pre-commit hooks via # pre-commit install -# modernizer: make sure our code-base is Python 3 ready -#- repo: https://github.com/python-modernize/python-modernize.git -# sha: a234ce4e185cf77a55632888f1811d83b4ad9ef2 -# hooks: -# - id: python-modernize -# exclude: ^docs/ -# args: -# - --write -# - --nobackups - -- repo: local - hooks: - # yapf = yet another python formatter - - id: yapf - name: yapf - entry: yapf - language: system - types: [python] - args: ["-i"] - - # prospector: collection of linters - - id: prospector - language: system - types: [file, python] - name: prospector - description: "This hook runs Prospector: https://github.com/landscapeio/prospector" - entry: prospector - exclude: '^(aiida_gulp/tests/)|(examples/)' - - - id: version-number - name: Check version numbers - entry: python ./.travis-data/check_version.py - language: system - files: '^(setup.json)|(aiida_gulp/__init__.py)' +exclude: > + (?x)^( + aiida_gulp/tests/raw_files/.* + )$ + +repos: + + - repo: git://github.com/pre-commit/pre-commit-hooks + rev: v2.2.3 + hooks: + - id: check-json + exclude: vscode/settings\.json + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - id: flake8 + + - repo: https://github.com/psf/black + rev: stable + hooks: + - id: black + + - repo: local + hooks: + + - id: version-number + name: Check version numbers + entry: python ./.pre-commit/check_version.py version + language: system + files: >- + (?x)^( + setup.json| + .pre-commit/check_version.py| + aiida_gulp/__init__.py + )$ + pass_filenames: false + + - id: conda + name: Create environment.yml + entry: python ./.pre-commit/check_version.py conda + language: system + files: >- + (?x)^( + setup.json| + setup.py| + .pre-commit/check_version.py| + conda_dev_env.yml| + )$ + pass_filenames: false + + - id: travis-linter + name: Travis Lint + entry: travis lint + files: .travis.yml + language: ruby + additional_dependencies: ['travis'] + + - id: doc8 + entry: doc8 + language: system + types: [rst] + name: doc8 - Lint the documentation. + + # TODO could also add check-manifest diff --git a/.pre-commit/check_version.py b/.pre-commit/check_version.py new file mode 100644 index 0000000..3e260bb --- /dev/null +++ b/.pre-commit/check_version.py @@ -0,0 +1,130 @@ +"""Validate consistency of versions and dependencies. + +Validates consistency of setup.json and + + * environment.yml + * version in aiida/__init__.py +""" +import json +import os +import sys + +import click + +FILENAME_SETUP_JSON = "setup.json" +SCRIPT_PATH = os.path.split(os.path.realpath(__file__))[0] +ROOT_DIR = os.path.join(SCRIPT_PATH, os.pardir) +FILEPATH_SETUP_JSON = os.path.join(ROOT_DIR, FILENAME_SETUP_JSON) + + +def get_setup_json(): + """Return the `setup.json` as a python dictionary.""" + with open(FILEPATH_SETUP_JSON, "r") as handle: + setup_json = json.load(handle) # , object_pairs_hook=OrderedDict) + + return setup_json + + +@click.group() +def cli(): + """Command line interface for pre-commit checks.""" + pass + + +@cli.command("version") +def validate_version(): + """Check that version numbers match. + + Check version number in setup.json and aiida_gulp/__init__.py and make sure + they match. + """ + # Get version from python package + sys.path.insert(0, ROOT_DIR) + import aiida_gulp # pylint: disable=wrong-import-position + + version = aiida_gulp.__version__ + + setup_content = get_setup_json() + if version != setup_content["version"]: + click.echo("Version number mismatch detected:") + click.echo( + "Version number in '{}': {}".format( + FILENAME_SETUP_JSON, setup_content["version"] + ) + ) + click.echo( + "Version number in '{}/__init__.py': {}".format("aiida_gulp", version) + ) + click.echo( + "Updating version in '{}' to: {}".format(FILENAME_SETUP_JSON, version) + ) + + setup_content["version"] = version + with open(FILEPATH_SETUP_JSON, "w") as fil: + # Write with indentation of two spaces and explicitly define separators to not have spaces at end of lines + json.dump(setup_content, fil, indent=2, separators=(",", ": ")) + + sys.exit(1) + + +@cli.command("conda") +def update_environment_yml(): + """Update conda_dev_env.yml file for conda.""" + import re + from ruamel.yaml.comments import CommentedMap, CommentedSeq + from ruamel.yaml import YAML + + environment_filename = "conda_dev_env.yml" + + cmap = CommentedMap() + cmap.yaml_set_start_comment( + ( + "Usage: conda env create -n myenvname -f {} python=3.6\n" + " conda activate myenvname\n" + " pip install --no-deps -e .".format(environment_filename) + ) + ) + cmap["name"] = "aiida_gulp" + cmap["channels"] = CommentedSeq(["conda-forge", "cjs14"]) + cmap["channels"].yaml_add_eol_comment("for sqlalchemy-diff and pgtest", 1) + cmap["dependencies"] = dmap = CommentedSeq() + + # additional packages + dmap.append("pip") + dmap.append("aiida-core.services") + + # fix incompatibilities between conda and pypi + replacements = {"pre-commit": "pre_commit"} + setup_json = get_setup_json() + + for base, key in [ + (None, "install_requires"), + ("extras_require", "testing"), + ("extras_require", "code_style"), + ("extras_require", "docs"), + ]: + requirements = setup_json.get(base, setup_json)[key] + count = 0 + for req in sorted(requirements, key=lambda x: x.lower()): + # skip packages required for specific python versions < 3 + if re.findall("python_version\\s*\\<\\s*\\'?3", req): + continue + req = req.split(";")[0] + for (regex, replacement) in iter(replacements.items()): + req = re.sub(regex, replacement, req) + count += 1 + dmap.append(req.lower()) + + dmap.yaml_set_comment_before_after_key(len(dmap) - count, before=key) + + yaml = YAML(typ="rt") + yaml.default_flow_style = False + yaml.encoding = "utf-8" + yaml.allow_unicode = True + file_path = os.path.join(ROOT_DIR, environment_filename) + with open(file_path, "w") as env_file: + yaml.dump(cmap, env_file) + + +if __name__ == "__main__": + cli() # pylint: disable=no-value-for-parameter diff --git a/.prospector.yaml b/.prospector.yaml deleted file mode 100644 index 7030117..0000000 --- a/.prospector.yaml +++ /dev/null @@ -1,4 +0,0 @@ -# configuration for prospector -strictness: medium -ignore-patterns: - - '^(tests/)|(examples/)' diff --git a/.readthedocs.yml b/.readthedocs.yml index 76a5fd7..45a0cf7 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,7 +1,18 @@ -build: - image: latest +version: 2 + +conda: + environment: docs/environment.yaml + python: - version: 2.7 - pip_install: true - extra_requirements: - - "docs" + version: 3.6 + install: + - method: pip + path: . + # extra_requirements: + # - docs + +# default +# sphinx: +# builder: html +# configuration: conf.py +# fail_on_warning: true diff --git a/.travis-data/check_version.py b/.travis-data/check_version.py deleted file mode 100644 index bad82c1..0000000 --- a/.travis-data/check_version.py +++ /dev/null @@ -1,36 +0,0 @@ -"""Check that version numbers match. - -Check version number in setup.json and aiida_gulp/__init__.py and make sure -they match. -""" -from __future__ import absolute_import -from __future__ import print_function -import os -import json -import sys - -this_path = os.path.split(os.path.realpath(__file__))[0] - -# Get content of setup.json -setup_fname = 'setup.json' -setup_path = os.path.join(this_path, os.pardir, setup_fname) -with open(setup_path) as f: - setup_content = json.load(f) - -# Get version from python package -sys.path.insert(0, os.path.join(this_path, os.pardir)) -import aiida_gulp # pylint: disable=wrong-import-position -version = aiida_gulp.__version__ - -if version != setup_content['version']: - print("Version number mismatch detected:") - print("Version number in '{}': {}".format(setup_fname, - setup_content['version'])) - print("Version number in '{}/__init__.py': {}".format( - 'aiida_gulp', version)) - sys.exit(1) - -# Overwrite version in setup.json -#setup_content['version'] = version -#with open(setup_path, 'w') as f: -# json.dump(setup_content, f, indent=4, sort_keys=True) diff --git a/.travis.yml b/.travis.yml index 4bc1a31..27c32fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,81 +1,119 @@ +dist: trusty # note rabbitmq is currently not available on xenial language: python -python: -- "2.7" cache: pip services: - postgresql -- rabbitmq # required for aiida >= 1.0 - +- rabbitmq addons: - postgresql: "9.5" - -before_install: -# Upgrade pip setuptools and wheel -- pip install -U pip wheel setuptools - -install: -- pip install -e .[testing,docs,pre-commit] -- reentry scan -r aiida -- pip install coveralls - -env: - matrix: - - TEST_TYPE: tests - TEST_AIIDA_BACKEND: django - MOCK_EXECUTABLES: true - PYPI_DEPLOY: true - - TEST_TYPE: tests - TEST_AIIDA_BACKEND: sqlalchemy - MOCK_EXECUTABLES: true - - TEST_TYPE: pre-commit - - TEST_TYPE: docs - READTHEDOCS: 'True' - # TODO for aiida v1 test pytest is failing on setup at present (dependency version clash?) - - TEST_TYPE="tests" AIIDA_BRANCH="develop" TEST_AIIDA_BACKEND="django" MOCK_EXECUTABLES=true - - TEST_TYPE="tests" AIIDA_BRANCH="develop" TEST_AIIDA_BACKEND="sqlalchemy" MOCK_EXECUTABLES=true + postgresql: "10.6" + apt: + packages: + - graphviz matrix: - allow_failures: - - env: TEST_TYPE="tests" AIIDA_BRANCH="develop" TEST_AIIDA_BACKEND="django" MOCK_EXECUTABLES=true - - env: TEST_TYPE="tests" AIIDA_BRANCH="develop" TEST_AIIDA_BACKEND="sqlalchemy" MOCK_EXECUTABLES=true + include: + - python: 3.6 + env: TEST_TYPE="pre-commit" + - python: 3.6 + env: TEST_TYPE="pytest" TEST_AIIDA_BACKEND="django" PYPI_DEPLOY=true + - python: 2.7 + env: TEST_TYPE="pytest" TEST_AIIDA_BACKEND="django" + - python: 3.6 + env: TEST_TYPE="pytest" TEST_AIIDA_BACKEND="sqlalchemy" + - python: 3.6 + env: TEST_TYPE="docs" READTHEDOCS="True" + - python: 3.6 + env: TEST_TYPE="conda" + + # allow_failures: + # - env: TEST_TYPE="docs" READTHEDOCS="True" install: # Upgrade pip setuptools and wheel -- pip install -U pip wheel setuptools -- pip install -e .[pre-commit,testing,docs] -- > - if [[ ! -z "${AIIDA_BRANCH}" ]]; then - cur_path="$(pwd)"; - cd ..; - git clone --branch=${AIIDA_BRANCH} https://github.com/aiidateam/aiida_core.git; - cd aiida_core; - pip install -U -e .[testing,atomic_tools]; - cd "$cur_path"; - fi -- pip install coveralls +- pip install --upgrade pip wheel setuptools "reentry>=1.3" +- pip install numpy==1.16.4 # otherwise numpy 1.17 is installed, which is incompatible with aiida-core==1.0.0b5 +- | + if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then + pip install typing==3.6.6 # otherwise importlib_resources installs incompatible version for aiida-core==1.0.0b5 + fi +- | + if [[ "$TEST_TYPE" == "pre-commit" ]]; then + pip install -e .[code_style] + fi +- | + if [[ "$TEST_TYPE" == "pytest" ]]; then + pip install "notebook<5.5" # required by aiida-core->circus->pyzmq<17 + pip install -e .[testing] + pip install coveralls + fi +- | + if [[ "$TEST_TYPE" == "docs" ]]; then + pip install -e .[docs] + url="https://github.com/jgm/pandoc/releases/tag/2.6" + path=$(curl -L $url | grep -o '/jgm/pandoc/releases/download/.*-amd64\.deb') + downloadUrl="https://github.com$path" + file=${path##*/} + wget $downloadUrl && sudo dpkg -i $file + fi +- | + if [[ "$TEST_TYPE" == "conda" ]]; then + # See https://conda.io/docs/user-guide/tasks/use-conda-with-travis-ci.html#the-travis-yml-file + wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; + bash miniconda.sh -b -p $HOME/miniconda + export PATH="$HOME/miniconda/bin:$PATH" + hash -r + conda config --set always_yes yes --set changeps1 no + conda update -q conda + # Useful for debugging any issues with conda + conda info -a + fi before_script: -- reentry scan +- | + if [[ "$TEST_TYPE" == "pytest" ]] || [[ "$TEST_TYPE" == "docs" ]]; then + reentry scan + fi script: -- > - if [[ "$TEST_TYPE" == "tests" ]]; then - if [[ ! -z "${AIIDA_BRANCH}" ]]; then - pytest -v aiida_gulp; - else - pytest -v --cov=aiida_gulp --cov-config .coveragerc --cov-report= aiida_gulp; - fi +- | + if [[ "$TEST_TYPE" == "pytest" ]]; then + pytest -v --cov=aiida_gulp --cov=examples --cov-config .coveragerc --cov-report= aiida_gulp fi -- > +- | if [[ "$TEST_TYPE" == "pre-commit" ]]; then - pre-commit install; - pre-commit run --all-files || ( git status --short; git diff ; exit 1 ) ; + pre-commit run --all-files || ( git status --short ; git diff ; exit 1 ) + fi +- | + if [[ "$TEST_TYPE" == "docs" ]]; then + cd docs + make + fi +- | + if [[ "$TEST_TYPE" == "conda" ]]; then + travis_retry conda env create -f conda_dev_env.yml -n test-environment python=$TRAVIS_PYTHON_VERSION + conda list -n test-environment + source activate test-environment + pip install --no-deps -e . + reentry scan + verdi data gulp.potentials --help fi -- if [[ "$TEST_TYPE" == "docs" ]]; then cd docs; make; fi after_success: -- coveralls +- | + if [[ "$TEST_TYPE" == "pytest" ]]; then + coveralls + fi +# deploy: +# - provider: pypi +# distributions: "sdist bdist_wheel" +# user: cjsewell +# password: +# secure: VCQWK8xNFFKaWOswrtlvEqn/ULz8qjy80Y5xoXjh/tQHnfqtUSHiDh7i5BeDTYepG/C4qkGLApHp2oEOs5JM2bp8QMCVz0ERsMlX8IYAs7iMA85w9rcYWUXk/EkqPC07pyoCLk7wGlSmWnjnrfWfO9Wu5i2Ys7kpiJD6/pcbnGeAuyUv7lI+giAYiDFMjX9T4Iqh2QA2hPjVz0GVqmZyh4FDxlLNJBTvySGlrr4WDjidUamK06eqNBQ6pGGUGRjbu+KNgpSOkZBrLuDJYHhxoqYYPlIGFxWtXyBA1bQxYWWnR0R2iS93TC3TKExznFKsvN/Q11vdlnH6yophJxhimlUhDJXG70cVzsAsxXgLmQtA0Mb5nDsx0lxisAffHeKYAcoSfEg9Fj906L1vH+8/9AnVBQ2sgGB/ob9PpIyvrJoYArMmoj6O/lyNuvzufs6TVUP+iY2+Se8QCwW7l+Izh74GrWBah3Zb4j8JDNLqzjG90qmEoyjMLA67NVDqzfzEIQdZ5q8By5TIJWyv9LhHdJ6Jjl9KQCWD9w9lYzVkYI9W7J7gg8bof9oTLZ9Ntl0NwBpZV3YMpDFQNMl8OP6eNWlXCE5vS2mFPR8Lwk+s1mfq1MrSYXQQKa5m3Dt4p8PzNWrDsf8/94bwR35F+jMfRKdhwRhSvAa8AhXO1y+lJoU= +# on: +# branch: master +# tags: true +# condition: $PYPI_DEPLOY = true diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..03f651d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,42 @@ +{ + "editor.rulers": [ + 88, 120 + ], + "files.exclude": { + "**/.git": true, + "**/.svn": true, + "**/.hg": true, + "**/CVS": true, + "**/.DS_Store": true, + "**/__pycache__": true, + "**/.ipynb_checkpoints": true, + "**/.pytest_cache": true, + "**/.eggs": true + }, + + "python.pythonPath": "/anaconda/envs/aiida_crystal17/bin/python", + "python.formatting.provider": "black", + "python.linting.pylintEnabled": false, + "python.linting.flake8Enabled": true, + "python.linting.enabled": true, + "python.testing.pytestArgs": [ + "aiida_gulp" + ], + "python.testing.unittestEnabled": false, + "python.testing.nosetestsEnabled": false, + "python.testing.pytestEnabled": false, + "restructuredtext.preview.sphinx.disabled": true, + "restructuredtext.confPath": "${workspaceFolder}/docs/source", + "restructuredtext.linter.extraArgs": ["--max-line-length", "120"], + "cSpell.words": [ + "aiida", + "pytest" + ], + "todo-tree.general.tags": [ + "TODO", + "todo::", + "FIXME", + "NOTE" + ], + "todo-tree.regex.regex": "((//|#-?|\n", + "\n", + "\n", + "\n", + "%3\n", + "\n", + "\n", + "\n", + "N5\n", + "\n", + "GulpSingleCalculation (5)\n", + "State: finished\n", + "Exit Code: 0\n", + "\n", + "\n", + "\n", + "N8\n", + "\n", + "Dict (8)\n", + "\n", + "\n", + "\n", + "N5->N8\n", + "\n", + "\n", + "CREATE\n", + "results\n", + "\n", + "\n", + "\n", + "N7\n", + "\n", + "FolderData (7)\n", + "\n", + "\n", + "\n", + "N5->N7\n", + "\n", + "\n", + "CREATE\n", + "retrieved\n", + "\n", + "\n", + "\n", + "N6\n", + "\n", + "RemoteData (6)\n", + "@localhost\n", + "\n", + "\n", + "\n", + "N5->N6\n", + "\n", + "\n", + "CREATE\n", + "remote_folder\n", + "\n", + "\n", + "\n", + "N4\n", + "\n", + "EmpiricalPotential (4)\n", + "lj\n", + "\n", + "\n", + "\n", + "N4->N5\n", + "\n", + "\n", + "INPUT_CALC\n", + "potential\n", + "\n", + "\n", + "\n", + "N3\n", + "\n", + "StructureData (3)\n", + "Fe4S8\n", + "\n", + "\n", + "\n", + "N3->N5\n", + "\n", + "\n", + "INPUT_CALC\n", + "structure\n", + "\n", + "\n", + "\n", + "N1\n", + "\n", + "Code (1)\n", + "gulp_mock@localhost\n", + "\n", + "\n", + "\n", + "N1->N5\n", + "\n", + "\n", + "INPUT_CALC\n", + "code\n", + "\n", + "\n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "graph = Graph(graph_attr={'size': \"6,8!\", \"rankdir\": \"LR\"})\n", + "graph.add_node(calcnode)\n", + "graph.add_incoming(calcnode, annotate_links=\"both\")\n", + "graph.add_outgoing(calcnode, annotate_links=\"both\")\n", + "graph.graphviz" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### gulp.optimize" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "opt_dict={\n", + " \"minimize\": {\"style\": \"cg\", \"max_iterations\": 100},\n", + " \"relax\": {\"type\": \"conp\"}}\n", + "opt_params = DataFactory('dict')(dict=opt_dict)\n", + "opt_params" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [], + "source": [ + "code_opt = Code.objects.get(\n", + " label=\"gulp.optimize-gulp_mock@localhost\")\n", + "builder_opt = code_opt.get_builder()\n", + "builder_opt.metadata.options = {\n", + " \"resources\": {\n", + " \"num_machines\": 1, \n", + " \"num_mpiprocs_per_machine\": 1}}\n", + "builder_opt.structure = structure\n", + "builder_opt.potential = potential_lj\n", + "builder_opt.parameters = opt_params" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "result, calcnode_opt = run_get_node(builder_opt)\n", + "calcnode_opt" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "True\n", + "ProcessState.FINISHED\n", + "0\n" + ] + } + ], + "source": [ + "print(calcnode_opt.is_finished_ok)\n", + "print(calcnode_opt.process_state)\n", + "print(calcnode_opt.exit_status)" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "ipub": { + "figure": { + "caption": "`gulp.optimize` calculation provenance graph." + } + } + }, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "%3\n", + "\n", + "\n", + "\n", + "N10\n", + "\n", + "GulpOptCalculation (10)\n", + "State: finished\n", + "Exit Code: 0\n", + "\n", + "\n", + "\n", + "N14\n", + "\n", + "StructureData (14)\n", + "Fe4S8\n", + "\n", + "\n", + "\n", + "N10->N14\n", + "\n", + "\n", + "CREATE\n", + "structure\n", + "\n", + "\n", + "\n", + "N13\n", + "\n", + "Dict (13)\n", + "\n", + "\n", + "\n", + "N10->N13\n", + "\n", + "\n", + "CREATE\n", + "results\n", + "\n", + "\n", + "\n", + "N12\n", + "\n", + "FolderData (12)\n", + "\n", + "\n", + "\n", + "N10->N12\n", + "\n", + "\n", + "CREATE\n", + "retrieved\n", + "\n", + "\n", + "\n", + "N11\n", + "\n", + "RemoteData (11)\n", + "@localhost\n", + "\n", + "\n", + "\n", + "N10->N11\n", + "\n", + "\n", + "CREATE\n", + "remote_folder\n", + "\n", + "\n", + "\n", + "N9\n", + "\n", + "Dict (9)\n", + "\n", + "\n", + "\n", + "N9->N10\n", + "\n", + "\n", + "INPUT_CALC\n", + "parameters\n", + "\n", + "\n", + "\n", + "N4\n", + "\n", + "EmpiricalPotential (4)\n", + "lj\n", + "\n", + "\n", + "\n", + "N4->N10\n", + "\n", + "\n", + "INPUT_CALC\n", + "potential\n", + "\n", + "\n", + "\n", + "N3\n", + "\n", + "StructureData (3)\n", + "Fe4S8\n", + "\n", + "\n", + "\n", + "N3->N10\n", + "\n", + "\n", + "INPUT_CALC\n", + "structure\n", + "\n", + "\n", + "\n", + "N2\n", + "\n", + "Code (2)\n", + "gulp_mock@localhost\n", + "\n", + "\n", + "\n", + "N2->N10\n", + "\n", + "\n", + "INPUT_CALC\n", + "code\n", + "\n", + "\n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "graph = Graph(graph_attr={'size': \"6,8!\", \"rankdir\": \"LR\"})\n", + "graph.add_node(calcnode_opt)\n", + "graph.add_incoming(calcnode_opt, annotate_links=\"both\")\n", + "graph.add_outgoing(calcnode_opt, annotate_links=\"both\")\n", + "graph.graphviz" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "```json\n", + "{\n", + " \"errors\": [],\n", + " \"opt_type\": \"bulk\",\n", + " \"warnings\": [],\n", + " \"energy_units\": \"eV\",\n", + " \"final_energy\": -17.47113113,\n", + " \"gulp_version\": \"4.5.3\",\n", + " \"parser_class\": \"GulpOptParser\",\n", + " \"opt_succeeded\": true,\n", + " \"parser_errors\": [],\n", + " \"initial_energy\": -0.32809466,\n", + " \"parser_version\": \"0.10.0b5\",\n", + " \"opt_time_second\": 0.3676,\n", + " \"parser_warnings\": [],\n", + " \"total_time_second\": 0.3677,\n", + " \"final_primitive_energy\": -17.47113113,\n", + " \"peak_dynamic_memory_mb\": 0.54,\n", + " \"initial_primitive_energy\": -0.32809466\n", + "}\n", + "```" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "display_json(calcnode_opt.outputs.results.attributes)" + ] + } + ], + "metadata": { + "celltoolbar": "Tags", + "hide_input": false, + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.7" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": true, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "Contents", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": false + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/docs/source/user_guide/get_started.rst b/docs/source/user_guide/get_started.rst deleted file mode 100644 index 586934e..0000000 --- a/docs/source/user_guide/get_started.rst +++ /dev/null @@ -1,37 +0,0 @@ -=============== -Getting started -=============== - -This page should contain a short guide on what the plugin does and -a short example on how to use the plugin. - -Installation -++++++++++++ - -Use the following commands to install the plugin:: - - git clone https://github.com/chrisjsewell/aiida-gulp . - cd aiida-gulp - pip install -e . # also installs aiida, if missing (but not postgres) - #pip install -e .[pre-commit,testing] # install extras for more features - verdi quicksetup # better to set up a new profile - verdi calculation plugins # should now show your calclulation plugins - -Then use ``verdi code setup`` with the ``gulp`` input plugin -to set up an AiiDA code for aiida-gulp. - -Usage -+++++ - -A quick demo of how to submit a calculation:: - - verdi daemon start # make sure the daemon is running - cd examples - verdi run submit.py # submit test calculation - verdi calculation list -a # check status of calculation - -If you have already set up your own aiida_gulp code using -``verdi code setup``, you may want to try the following command:: - - gulp-submit # uses aiida_gulp.cli - diff --git a/docs/source/user_guide/index.rst b/docs/source/user_guide/index.rst deleted file mode 100644 index 9c9eac9..0000000 --- a/docs/source/user_guide/index.rst +++ /dev/null @@ -1,11 +0,0 @@ -========== -User guide -========== - -.. toctree:: - :maxdepth: 3 - - get_started - tutorial - - diff --git a/docs/source/user_guide/test_notebooks.py b/docs/source/user_guide/test_notebooks.py new file mode 100644 index 0000000..9b5c232 --- /dev/null +++ b/docs/source/user_guide/test_notebooks.py @@ -0,0 +1,108 @@ +"""Test documentation notebooks.""" +import io +import logging +import os +import subprocess + +import pytest + +logger = logging.getLogger(__name__) + + +@pytest.mark.gulp_doc_notebooks +@pytest.mark.parametrize("filename", ("calc_gulp.ipynb",)) +def test_notebook(pytestconfig, db_test_app, filename): + """Execute Jupyter Notebook, using a clean AiiDA database/profile, and test its output is as expected. + + Can be executed by: ``pytest --gulp-nb-tests --log-cli-level=info`` + """ + from pytest_notebook.nb_regression import NBRegressionFixture + from pytest_notebook.plugin import gather_config_options + + kwargs, other_args = gather_config_options(pytestconfig) + + nb_regression = NBRegressionFixture(**kwargs) + nb_regression.diff_replace = ( + ( + "/cells/*/outputs/*/text", + "\\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\b", + "", + ), + ( + "/cells/*/outputs/*/data/text", + "\\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\b", + "", + ), + ("/cells/*/outputs/*/text", "[-/|\\\\]\b", ""), + ( + "/cells/*/outputs/*/text", + "postgres:\\s+Connected as.*\n", + "postgres: Connected as
", + ), + ("/cells/*/outputs/*/text", "repository:\\s+/.+\n", "repository: "), + ( + "/cells/*/outputs/*/text", + "Daemon is running as PID.+\n", + "Daemon is running as \n", + ), + ("/cells/*/outputs/*/text", "\\d+s\\sago", "XXs ago"), + ( + "/cells/*/outputs/*/text", + "(ctime|mtime)\\s+\\d{2,4}-\\d{1,2}-\\d{1,2}.+\n", + "(c/m)time \n", + ), + ( + "/cells/*/outputs/*/text", + "time an entry changed state\\:.+\n", + "time an entry changed state: