#chemistry #castep #linear-algebra #model-generator #computational-chem


A rust-written backend lib for edit and generation of lattice 3D-models compatible with CASTEP and Materials Studio

18 stable releases

2.1.3 Sep 19, 2023
2.1.1 Dec 20, 2022
2.0.7 Nov 30, 2022
0.1.2 Oct 17, 2022

#79 in Math

Download history 1/week @ 2023-06-03 22/week @ 2023-06-17 22/week @ 2023-06-24 1/week @ 2023-07-01 2/week @ 2023-07-15 1/week @ 2023-07-22 1/week @ 2023-07-29 20/week @ 2023-08-12 1/week @ 2023-08-19 40/week @ 2023-08-26 22/week @ 2023-09-02 2/week @ 2023-09-09 28/week @ 2023-09-16

92 downloads per month

MIT license

1.5K SLoC


A rust-written backend lib for edit and generation of lattice 3D-models compatible with CASTEP and Materials Studio.

  1. castep-model-core


This library is 100% written in rust. Currently, it has the following features:

  1. Place any molecules into a lattice, with necessary information provided:
    1. The number and identities of atoms used to coordinate with the lattice.
    2. The geometry information to determine the molecule direction in 3d space.
  2. Export the seedfiles for CASTEP task, supported by castep-model-core
  3. Parallel batch processing for model edit, molecule placement onto the lattice, and exports, supported by rayon.
    • The detailed workflow for iteration is implemented by yourself.
  4. Configurable with YAML format files.

Configuration with YAML files

This lib is designed to be controlled with specific YAML files. You can also hardcode the necessary information in your crate.

Project-level: The YAML file for project level control provides the following fields:

  1. base_model_loc: path to the base model msi file. This lattice model is used for the consequent batch editing and adsorbate placement.
  2. element_table_loc: path to the element table YAML file. It will include the elements that will be involved in your project.
  3. adsorbate_table_loc: path to the adsorbate information YAML file. It records the necessary information to deal with the placement of adsorbates.
  4. potentials_loc: path to the CASTEP potential files directory.
  5. export_loc: path to export your results.
  6. coord_sites: An array recording the target coordination sites that will be used in your lattice models. It has the following format for example:
        - name: c1
        atom_id: 41
        - name: c2
        atom_id: 42
    The name field is for naming your exported models. The atom_id field is consistent with the id in msi file, which is one-indexed.
  7. coord_cases: You will describe the possible coordination cases between the lattice and adsorbates. Currently, the library is designed to handle cases with coordination atoms up to two. For example:
    - name: double
        cases: [[41,42], [42,54], [54,53], [53,52], [41, 40], [41, 73], [42, 73]]
    - name: single
        cases: [[41, null], [42, null], [54, null], [53, null], [52, null], [40, null], [73, null]]

Adsorbate information

This YAML file describes the necessary information about the adsorbate, which is key to the placement workflow of adsorbates onto the lattice.

Example structures:

directory: C2_pathways_ads
  - name: CO
    coordAtomIds: [1]
    stemAtomIds: [1,2]
    # planeAtomIds missing since it has only two atoms
    # plane_angle missing since it has only two atoms
    stem_coord_angle: 90.0
    bSym: false
    upperAtomId: 2
    atomNums: 2
    pathName: ethylene
  - name: CHO
    coordAtomIds: [1]
    stemAtomIds: [2, 3]
    planeAtomIds: [1, 2, 3]
    plane_angle: 90.0
    stem_coord_angle: 90.0
    bSym: false
    upperAtomId: 2
    atomNums: 3
    pathName: ethylene

The directory field tells the code where to locate the adsorbate msi files. The pathName field helps the code to find the adsorbate: Currently this lib is designed to find the adsorbate according to the path: ./{directory}/{pathName}_path/{adsorbate_name}.msi.


~187K SLoC