SMTG-Bham / ShakeNBreak

Defect structure-searching employing chemically-guided bond distortions
https://shakenbreak.readthedocs.io
MIT License
81 stars 18 forks source link

Structure I/O Compatibility (CP2K & Quantum Espresso) #4

Closed kavanase closed 2 years ago

kavanase commented 2 years ago

This is an Issue to track the feature development of structure I/O compatibility with CP2K and Quantum Espresso.

If possible, this package should work with cp2k, CASTEP, FHI-aims and Quantum Espresso. SIESTA could be a potential addition afterwards (Make note on README that these can be added if users request it?), but less popular and so less of a priority. Should be relatively handy as this just means converting input structures to pymatgen, and then outputs to their format instead of VASP. Likely best implemented as an io.py module?

To do the distortions, we rely on doped reading in the defect type etc., so will have to have some functions that can read an input POSCAR and figure out what defect is present (i.e. the doped parsing tools, which are pymatgen under the hood).

If possible, would be best to not require doped, but have it as an easy way to provide inputs, but alternatively can just give a list of folders in which the defect structures are located, and can have pymatgen read in from these.

ireaml commented 2 years ago

Regarding this, conversion between pymatgen structures and code formatted ones seems simple using ase.io module (https://wiki.fysik.dtu.dk/ase/ase/io/io.html), which is compatible with QE, CP2K, CASTEP and FHI-aims. But guess beyond the structure i/o, we should write a complete input file as done for VASP. This would require further arguments to be given to input.apply_shakenbreak (pseudopotentials, keywords for the different codes etc). So maybe a cleaner alternative would be to refactor input.apply_shakenbreak into a class (which takes only the defect dict and distortion parameters as inputs) and then a method for each code (taking the code specific arguments)?

kavanase commented 2 years ago

I agree! I think best thing would be to refactor to a class with methods as you say, and then implement the structure conversion functions for the other codes. Regarding the input files for other codes, I think maybe the best/easiest thing is to have optional arguments that (1) can just copy e.g. CP2K input files in the current directory to each generated distortion directory (as they should be the same in each case right?) or (2) where you feed in your ase calculation parameters and it writes the appropriate input files or (3) you don't specify either and shakenbreak just writes the structure files (and then you can copy in your manually-written input files to each folder)