Git Product home page Git Product logo

testing-framework's People

Contributors

bernstei avatar casv2 avatar davkovacs avatar fcmocanu avatar gabor1 avatar htunstall avatar jameskermode avatar stenczelt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

testing-framework's Issues

vacancy test (and others?) use wrong bulk structure for low symmetry lattices

The current approach for the vacancy test, and probably others (other point defects, surfaces?) is to read bulk_supercell.xyz from the test directory, rescale it to match the lattice constant of the corresponding bulk structure (indicated by its bulk_struct_test info field), then relax the atoms without the cell DOFs. This was originally conceived to make it possible for the user to do complicated things like impose a symmetry breaking (like the Si vacancy Jahn-Teller), or add some initial relaxation manually for interstitials.

However, this is incorrect for lower symmetry crystal lattices, because it does not relax the cell shape. For all intents and purposes the test must use a supercell constructed from the relaxed bulk cell (which can be extract from the bulk test). If additional manual adjustments must be made there needs to be some other mechanism to specify them.

Making testing-framework module

I was wondering if we could add a setup.py and change the file strucutre to allow for the testing-framework functions to be imported.

Benefits:

  1. Functions could be used ouside of the testing-framework setting, while still working there
  2. Rather than having to be careful in what working dir one is and using import utils *, one could import testingframeowrk.utils, allowing for better editor support and more varied folder structure.
  3. All tests would effectively become "shared", and useable accorss different tets

To Do:

  • Move all files to a subfolder testingframework, such that it could be imported as from testingframework.utilities import *, note that testing-framework would not be valid subdirectory name.
  • Adding a setup.py file, something like below.

Potential setup.py

from setuptools import setup, find_packages

PACKAGENAME = "testingframework"
DESCRIPTION = "Testing Framework for atomistic models"
AUTHOR = "Libatoms"
AUTHOR_EMAIL = ""

version = {}
with open("version.py") as fp:
    exec(fp.read(), version)

setup(
    name=PACKAGENAME,
    packages=find_packages(),
    version=version["__version__"],
    description=DESCRIPTION,
    long_description=open("testing-framework/README.md").read(),
    install_requires=["scipy", "numpy", "matplotlib", "pandas>=0.21.0", "scipy",],
    setup_requires=["pytest-runner",],
    tests_require=["pytest",],
    author=AUTHOR,
    author_email=AUTHOR_EMAIL,
    package_data={"": ["data/*", "calib/data/*"],},
)

Questions

  1. Would someones own implementation/use of the framework impeded by the file structure change?

`run_all.py` script fails default args if `HOSTNAME` not in env

The run_all.py script has a default argument set, which assumes that HOSTNAME environment variable exists. This is mostly satisfied within a submitted batch job, likely not for interactive jobs though (tested on SGE).

$ ../../../scripts/run-all.py -m Tersoff_quippy -s SiC --tests="bulk_Si_simple_hexagonal"
Traceback (most recent call last):
  File "../../../scripts/run-all.py", line 24, in <module>
    default=re.sub('[0-9]*$', '', os.environ['HOSTNAME'].split('.')[0]))
  File "/opt/womble/miniconda3/user_envs/tks32/quip-serial/lib/python3.8/os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: 'HOSTNAME'

for a hack, exporting it does help

export HOSTANAME=$(hostname)

I am not sure what this functionality is intended for, but particularly getting the hostname is possible to be obtained in a safer way from python.

Formatting python code

I was wondering if we could decide on a formatter to format the code according to one convention. I had talked to @stenczelt about this before and he also uses black, which might be a good suggestion as its a widely used formatter.

Why add a formatter

  1. Easier to merge pull requests: as all conventions are the same, it is easier to merge pull requests as the only differences are in code content rather than which quotation marks were used ect.
  2. Ease of reading code
  3. Simple to use
  4. Now might be a good time to improve formatting, as there are significant changes with the file structure already.

How to use?

pip install black
# or 
conda install -c conda-forge black

To use black simpy do: black file_to_format.py or use black * to format whole direcotries, or whole repository. The easiest way to use black is by integrating it into your favourite editor and formatting upon save: for VS Code, for Jupyter Noteooks.

Readme 'running tests' example fails

The example from the readme does not work. Did the arguments change?

$ mkdir -p example_run_dir/CSiGe/run_dir
$ cd example_run_dir/CSiGe/run_dir
$ ../../../scripts/run-model-test.py -s CSiGe Tersoff bulk_Si_diamond
usage: run-model-test.py [-h] [--system_label SYSTEM_LABEL] [--force]
                         [--base_model BASE_MODEL] [--no_redirect_io]
                         [--no_append_log]
                         model test
run-model-test.py: error: unrecognized arguments: -s bulk_Si_diamond

Removing the -s option creates a text file with further errors concerning paths:

$ ../../../scripts/run-model-test.py Tersoff bulk_Si_diamond
share_dir /home/u2073032/nomad/code/testing-framework/scripts/../share
$ cat model-Tersoff-test-bulk_Si_diamond.txt

###### START RUN Wed Sep 29 14:13:52 2021 ######
Model Tersoff, Test bulk_Si_diamond
Test run at 2021-09-29 14:13

model file: ../../models/Tersoff/model.py
============================================================
Traceback (most recent call last):
  File "../../../scripts/run-model-test.py", line 118, in <module>
    sys.stdout.write(open(model_file).read())
FileNotFoundError: [Errno 2] No such file or directory: '../../models/Tersoff/model.py'

more point defect tests

Add antisite defects, and code that automatically finds plausible interstitial defects and creates them, preferably in a way that eliminates symmetry-equivalent configurations similarly to the vacancies.

[Note: created mostly as a reminder to finish putting together the corresponding PR. PR will be created once code is ready for public viewing]

Planned for PR to also close #1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.