Package: express-py
ExPreSSExabyte Property Extractor, Sourcer, Serializer (ExPreSS) is a Python package to extract material- and simulation-related properties and serialize them according to the Exabyte Data Convention (EDC) outlined inExabyte Source of Schemas and Examples (ESSE).1. OverviewThe following Functionality is supported:Extract structural information, material properties and from simulation dataSerialize extracted information according toESSEdata standardSupport for multiple simulation engines, including:VASPQuantum ESPRESSOJARVISothers, to be addedThe package is written in a modular way easy to extend for additional applications and properties of interest. Contributions can be in the form of additionalfunctionalityandbug/issue reports.2. InstallationExPreSS can be installed as a Python package either via PyPi or the repository as below.2.1. From PyPipipinstallexpress-py2.2. From GitHub repositorySee "Development" section below.3. Usage3.1. Extract Total EnergyThe following example demonstrates how to initialize an ExPreSS class instance to extract and serialize total energy produced in a Quantum ESPRESSO calculation. The full path to the calculation directory (work_dir) and the file containing standard output (stdout_file) are required to be passed as arguments to the underlying Espresso parser.importjsonfromexpressimportExPrESSkwargs={"work_dir":"./tests/fixtures/espresso/test-001","stdout_file":"./tests/fixtures/espresso/test-001/pw-scf.out"}handler=ExPrESS("espresso",**kwargs)data=handler.property("total_energy",**kwargs)print(json.dumps(data,indent=4))3.2. Extract Relaxed StructureIn this example the final structure of a VASP calculation is extracted and is serialized to a material. The final structure is extracted from theCONTCARfile located in the calculation directory (work_dir).is_final_structure=Trueargument should be passed to theMaterial Propertyclass to let it know to extract final structure.importjsonfromexpressimportExPrESSkwargs={"work_dir":"./tests/fixtures/vasp/test-001","stdout_file":"./tests/fixtures/vasp/test-001/vasp.out"}handler=ExPrESS("vasp",**kwargs)data=handler.property("material",is_final_structure=True,**kwargs)print(json.dumps(data,indent=4))3.3. Extract Structure from input fileOne can useStructureParserto extract materials from POSCAR or PW input files. Please note thatStructureParserclass only works with strings and not files and therefore the input files should be read first and then passed to the parser.importjsonfromexpressimportExPrESSwithopen("./tests/fixtures/vasp/test-001/POSCAR")asf:poscar=f.read()kwargs={"structure_string":poscar,"structure_format":"poscar"}handler=ExPrESS("structure",**kwargs)data=handler.property("material",**kwargs)print(json.dumps(data,indent=4))withopen("./tests/fixtures/espresso/test-001/pw-scf.in")asf:pwscf_input=f.read()kwargs={"structure_string":pwscf_input,"structure_format":"espresso-in"}handler=ExPrESS("structure",**kwargs)data=handler.property("material",**kwargs)print(json.dumps(data,indent=4))4. Development4.1. Install From GitHubInstallgit-lfsin order to pull the files stored on Git LFS.Clone repository:gitclonegit@github.com:Exabyte-io/express.gitInstallvirtualenvusingpipif not already present:pipinstallvirtualenvCreate virtual environment and install required packages:cdexpress
virtualenvvenvsourcevenv/bin/activateexportGIT_LFS_SKIP_SMUDGE=1pipinstall-ePATH_TO_EXPRESS_REPOSITORY4.2. TestsThere are two types of tests in ExPreSS: unit and integration, implemented inPython Unit Testing Framework.4.2.1. Unit TestsUnit tests are used to assert properties are serialized according to EDC. Properties classes are initialized with mocked parser data and then are serialized to assert functionality.4.2.2. Integration TestsParsers functionality is tested through integration tests. The parsers are initialized with the configuration specified in theTests Manifestand then the functionality is asserted.4.2.3. Running TestsNote that the CI tests are run using a github action in.github, and not using the script below, so there could be discrepancies.Run the following commands to run the tests ("unit" tests only in this case).python-munittestdiscover--verbose--catch--start-directorytests/unit5. ArchitectureThe following diagram presents the package architecture. The package provides aninterfaceto extract properties in EDC format. Inside the interfacePropertyclasses are initialized with aParser(Vasp, Espresso, or Structure) depending on the given parameters through the parser factory. EachPropertyclass implements required calls toParserfunctions listed in theseMixins Classesto extract raw data either from the textual files, XML files or input files in string format and implements a serializer to form the final property according to the EDC format.5.1. ParsersAs explained above, ExPreSS parsers are responsible for extracting raw data from different sources such as data on the disk and provide the raw data to properties classes. In order to make sure all parsers implement the same interfaces and abstract properties classes from the parsers implementations, a set aMixin Classesare provided which should be mixed with the parsers. The parsers must implement Mixins' abstract methods at the time of inheritance.5.2. PropertiesExPreSS properties classes are responsible to form the properties based on the raw data provided by the parsers and serialize the property according to EDC. A list of supported properties are available inhere.5.3. ExtractorsExtractors are classes that are composed with the parsers to extract raw data from the corresponding sources such as text or XML.6. ContributionThis repository is anopen-sourcework-in-progress and we welcome contributions. We suggest forking this repository and introducing the adjustments there. The changes in the fork can further be considered for merging into this repository as explained inGitHub Standard Fork and Pull Request Workflow.7. TODO listDesirable features for implementation:Add support for other propertiesAdd support for other types of applications, parsers and extractorsother (TBA)LinksExcellent Source of Schemas and Examples (ESSE), Github RepositoryVienna Ab-initio Simulation Package (VASP), official websiteQuantum ESPRESSO, Official WebsiteJARVIS NIST