Assistance with Hiphive Advanced Topic Example

I’m honored to be the first question on the hiphive discourse… anyway I am hoping to use hiphive for some monolayer calculations, which is great because that was part of the hiphive benchmark and so their is a corresponding example. The script looks like this and is directly (except for a change in filename) copied from

examples/advanced_topics/rotational_sum_rules/MoS2_monolayer/1_setup_structure_container.py

from ase.io import read
from hiphive import ClusterSpace, StructureContainer

# parameters
cutoffs = [8.0]
structures = read('[email protected]:')

# build clusterspace and structurecontainer
cs = ClusterSpace(structures[15], cutoffs)
sc = StructureContainer(cs)
for structure in structures:
    sc.add_structure(structure)
sc.write('structure_container.sc')

Now when I run it for the example, things are fine. However, when I run it on my cell, I have one of two problems. Either I leave the symprec at 1e-5 (the default) and no symmetry is found, which leads to a stupendously long time to build the container (300 atom supercell), or I reduce symprec to 1e-3 and hiphive correctly identifies the P-6m2 space group. But then this bizarre error shows up:

ValueError: Number of atoms in reference primitive cell 300 does not match target primitive 3

Two questions:
(1) How am I supposed to properly build my container?
(2) can the cluster space be constructed in parallel to speed up low symmetry supercells?

We are honored to have you as the first user of this subforum. In fact I have been meaning to move our “forum” from the gitlab issue tracker for some time but haven’t gotten around to doing so. Thanks for the motivation.

Regarding your question, without having seen your structure it sounds as if the numerical accuracy of the primitive structure is a limited. It would be useful to check what kind of symmetry (primarily spacegroup) you obtain from spglib. You can use, e.g., this function.

  1. Just the way you did it.
  2. Do you mean parallel over structures or parallel in the sense of multi-processing?

Thank you for your response. Prof. Erhart! (1) was resolved by using the “prepare_structures” function. I thought I had donee it properly when I set up the .extxyz file but I missed something. For (2) I mean multiprocessing. I am used to using Alamode, but I want to explore Hipive because if its broader functionality. In alamode, building the cluster space can be slow for large low symmetry structures, but it still completes substantially quicker than hiphive. I’m assuming it is because building the cluster space in Hiphive doesn’t make use of C backends, but I’m not sure. If I could use multiprocessing somehow, it might help speed it up.

  1. Hiphive uses jit compilation via numba
  2. Is it the cluster space construction or when you create training data that is slow?
  3. If you send the primitive cell and the settings you use I can see if there is an easy fix for your use case. We try to have as much as possible pure python to keep things simple.