Giter Club home page Giter Club logo

aenet-python's Introduction

aenet-python – Python tools for ænet

See also the documentation.

This package provides Python tools for the interaction with the atomic energy network (ænet) machine-learning interatomic potential software package. To learn more about ænet, see the ænet website and GitHub repository.

Common use cases for the tools within the aenet-python package are

  • Extraction of structures, energies, and forces from the output of first-principles calculations;
  • Interconversion of atomic structure formats, especially conversion to ænet's XSF format;
  • Manipulation of atomic structures, e.g., for generating reference data;
  • Operations on the featurized reference data produced by ænet's generate.x; and
  • Analysis of the outputs generated by ænet's train.x, i.e., from machine-learning potential training.

Installation

Install the Python package as usual, for example with pip

$ pip install --user .

To use the featurization capabilities, the main ænet package needs to be installed separately as described elsewhere. And aenet-python needs to be made aware of the ænet installation path, for example, using its interactive configuration tool

$ aenet config --set-aenet-path [path-to-aenet]

where [path-to-aenet] is the path pointing to the aenet root directory.

Structure conversion

aenet-python can be used to interconvert between atomic structure formats.

$ aenet sconv --format

Supported file formats:

Format      description                     read   write  extensions
--------------------------------------------------------------------
aims        FHI-aims geometry.in format     yes    yes    in aims
aimsout     FHI-aims output file format     yes    no     out
ase         ASE's trajectory (traj) format  yes    yes    traj
atat        ATAT's structure format         yes    yes
cp          cp.x trajectory (QE)            yes    no     pos
crystal     CRYSTAL's fort.34 format        yes    yes    crystal gui
espresso    Quantum Espresso input format   yes    yes    espresso
gap         GAP reference structure format  yes    no     gap
lammps      LAMMPS atomic structure dump    yes    yes    dump lammps lmp
lammpsdata  subset of LAMMPS data format    no     yes    data
pdb         Protein Data Base format        no     yes    pdb
prism       Prismatic XYZ format            yes    yes    prism
pw          pw.x output format (QE)         yes    no
runner      RuNNer input.data format        yes    yes
tinker      Tinker XYZ format               yes    yes    tinker arc
vasp        VASP's POSCAR/CONTCAR format    yes    yes    vasp
vasprun     VAPS's vasprun.xml archive      yes    no     xml
xdatcar     VASP's XDATCAR format           yes    no
xsf         XCrysDen Structure Format       yes    yes    xsf
xyz         XYZ Cartesian coordinates       yes    yes    xyz

For more details, see the documentation.

References

If you make use of this package, please cite the ænet reference publication

[1] N. Artrith and A. Urban, Comput. Mater. Sci. 114 (2016) 135-150, http://dx.doi.org/10.1016/j.commatsci.2015.11.047

If you are using the featurization tools, please also cite

[2] N. Artrith, A. Urban, and G. Ceder, Phys. Rev. B 96, 2017, 014112, https://doi.org/10.1103/PhysRevB.96.014112

[3] V. Gharakhanyan, M. S. Aalto, A. Alsoulah, N. Artrith, A. Urban, ICLR 2023, https://openreview.net/forum?id=4Hl8bjobpl9

aenet-python's People

Contributors

alexurba avatar jqmasters avatar nartrith avatar gvahe avatar

Stargazers

 avatar In Won Yeu avatar

Watchers

 avatar  avatar  avatar

aenet-python's Issues

Wrong example in the `aenet config --help`

The documentation said:

Configure aenet paths
---------------------

To configure the paths to the aenet installation directory and
compiled binaries with the `--path/-p` option.

  $ aenet config --path <aenet_path>

But only -p worked, while --path reported error:

aenet: error: unrecognized arguments: --path

Error with the example command `aenet sconv vasprun.xml final_structure.xsf`

Error message was:

Traceback (most recent call last):
  File "/Users/jianzhou/.local/bin/aenet", line 30, in <module>
    args.run(args)
  File "/Users/jianzhou/.local/lib/python3.9/site-packages/aenet/commandline/aenet_sconv.py", line 231, in run
    self.sconvert(infile=args.input_file,
  File "/Users/jianzhou/.local/lib/python3.9/site-packages/aenet/commandline/aenet_sconv.py", line 465, in sconvert
    struc = self. read_input_structure(
  File "/Users/jianzhou/.local/lib/python3.9/site-packages/aenet/commandline/aenet_sconv.py", line 290, in read_input_structure
    struc = structure.read_safely(infile, frmt=infrmt, **kwargs)
  File "/Users/jianzhou/.local/lib/python3.9/site-packages/aenet/io/structure.py", line 87, in read_safely
    struc = read(filename, frmt=frmt, **kwargs)
  File "/Users/jianzhou/.local/lib/python3.9/site-packages/aenet/io/structure.py", line 78, in read
    return formats[frmt].read(filename, **kwargs)
  File "/Users/jianzhou/.local/lib/python3.9/site-packages/aenet/formats/vasp.py", line 214, in read
    if has_lxml:
NameError: name 'has_lxml' is not defined

I tried to debug it:

In the ../aenet/formats/vasp.py file, line 11

try:
       from lxml import etree
       has_lxml = True
except ImportError:
       import xml.etree.cElementTree as ET

As I didn't install lxml package, the variable has_lxml is not defined. Thus on the line 214:

if has_lxml:
             parser = etree.XMLParser(recover=True, huge_tree=True)
             tree = etree.parse(infile, parser)

It reported one error.

Config.json error: Quotation marks missing

I copied the config file contents sent by Vahe via Slack. Two error happened:

  1. Quotation formats were wrong.
  2. Quotations were missing for "False" and "True".

Here is the copy from Vahe (via slack):

{
“aenet”: {
“root_path”: “/data/home/UrbanGroup/2022-09-similarity/aenet”,
“generate_x_path”: “/data/home/UrbanGroup/2022-09-similarity/aenet/generate.x”,
“train_x_path”: “/data/home/UrbanGroup/2022-09-similarity/aenet”,
“predict_x_path”: “/data/home/UrbanGroup/2022-09-similarity/aenet”,
“trnset2ascii_x_path”: “/data/home/UrbanGroup/2022-09-similarity/aenet/trnset2ASCII.x”
},
“matplotlib_rc_params”: {
“font.size”: 14,
“legend.frameon”: False,
“xtick.top”: True,
“xtick.direction”: “in”,
“xtick.minor.visible”: True,
“xtick.major.size”: 8,
“xtick.minor.size”: 4,
“ytick.right”: True,
“ytick.direction”: “in”,
“ytick.minor.visible”: True,
“ytick.major.size”: 8,
“ytick.minor.size”: 4
}
}

The command line `aenet` reported `./data/species.json` missing

The installation with the command python setup.py install --user was successful. When run aenet in the command line, the error came up:

Traceback (most recent call last):
  File "/Users/jianzhou/.local/bin/aenet", line 27, in <module>
    cmd.discover(subparsers)
  File "/Users/jianzhou/.local/lib/python3.9/site-packages/aenet/commandline/__init__.py", line 23, in discover
    __import__('aenet.commandline.' + t)
  File "/Users/jianzhou/.local/lib/python3.9/site-packages/aenet/commandline/aenet_sfp.py", line 6, in <module>
    from ..trainset import TrnSet
  File "/Users/jianzhou/.local/lib/python3.9/site-packages/aenet/trainset.py", line 18, in <module>
    from .io.structure import read_safely
  File "/Users/jianzhou/.local/lib/python3.9/site-packages/aenet/io/structure.py", line 18, in <module>
    from ..formats import formats
  File "/Users/jianzhou/.local/lib/python3.9/site-packages/aenet/formats/__init__.py", line 23, in <module>
    parser_module.append(__import__('aenet.formats.' + package))
  File "/Users/jianzhou/.local/lib/python3.9/site-packages/aenet/formats/crystal.py", line 14, in <module>
    from ..staticdata import atomic_number, atomic_species
  File "/Users/jianzhou/.local/lib/python3.9/site-packages/aenet/staticdata.py", line 24, in <module>
    with open(resource_filename(__name__, "data/species.json"), 'r') as fp:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/jianzhou/.local/lib/python3.9/site-packages/aenet/data/species.json'

I guess the reason is aenet/data folder was not copied to the right path during installation. Maybe something is wrong with the setup.py file.

Problem with Converting Binary Files and Function Compatibility

I encountered some issues while trying to run the example notebook. Specifically, the from_fortran_binary_file function fails to convert data.train into data.train.ascii unless I remove the --raw mask. However, even after successful conversion, the from_ascii_file function expects a different structure order for data.train.ascii.

Steps to Reproduce:

Run the example notebook.
Observe the failure of the from_fortran_binary_file function to convert data.train into data.train.ascii when the --raw mask is applied.
Remove the --raw mask and observe successful conversion.
Notice that the from_ascii_file function expects a different structure order for data.train.ascii after conversion.
Expected Behavior:
The from_fortran_binary_file function should be able to convert data.train into data.train.ascii even when the --raw mask is applied. Additionally, the from_ascii_file function should be compatible with the structure order of data.train.ascii after conversion.

Additional Information:
I suspect that there might be multiple versions of trainbin2ASCII.x available, and I may not be using the correct one. Is it possible that the issue arises because I am using an outdated version instead of the latest version of aenet-Pytorch?

Thank you for your assistance in resolving this issue.

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.