|
5 | 5 | import dpdata |
6 | 6 | from monty.serialization import dumpfn |
7 | 7 | from pymatgen.core.structure import Structure |
| 8 | +from pymatgen.analysis.structure_matcher import StructureMatcher |
8 | 9 | from apex.core.calculator.lib import abacus_utils |
9 | 10 | from apex.core.lib import crys |
10 | 11 | from apex.core.calculator.calculator import make_calculator |
|
14 | 15 | from apex.core.structure import StructureInfo |
15 | 16 | from dflow.python import upload_packages |
16 | 17 | upload_packages.append(__file__) |
17 | | -lammps_task_type = ['deepmd', 'eam_alloy', 'meam', 'eam_fs', 'meam_spline', 'snap', 'gap', 'rann', 'mace'] |
| 18 | +lammps_task_type = ['deepmd', 'eam_alloy', 'meam', 'eam_fs', 'meam_spline', 'snap', 'gap', 'rann', 'mace', 'nep'] |
18 | 19 |
|
19 | 20 |
|
20 | 21 | def make_equi(confs, inter_param, relax_param): |
@@ -201,13 +202,23 @@ def post_equi(confs, inter_param): |
201 | 202 | except FileNotFoundError: |
202 | 203 | logging.warning(f"No CONTCAR found in {ii}, skip") |
203 | 204 | continue |
| 205 | + try: |
| 206 | + init_ss = Structure.from_file(poscar) |
| 207 | + except FileNotFoundError: |
| 208 | + logging.warning(f"No POSCAR found in {ii}, skip") |
| 209 | + continue |
204 | 210 | st = StructureInfo(ss) |
| 211 | + matcher = StructureMatcher() |
| 212 | + is_match = matcher.fit(init_ss, ss) |
| 213 | + if not is_match: |
| 214 | + logging.warning(f"Structure mismatch after relaxation in {ii}") |
205 | 215 | struct_info_dict = { |
206 | 216 | "space_group_symbol": st.space_group_symbol, |
207 | 217 | "space_group_number": st.space_group_number, |
208 | 218 | "point_group_symbol": st.point_group_symbol, |
209 | 219 | "crystal_system": st.crystal_system, |
210 | 220 | "lattice_type": st.lattice_type, |
| 221 | + "mismatch": not is_match, |
211 | 222 | } |
212 | 223 |
|
213 | 224 | dumpfn(struct_info_dict, os.path.join(ii, "structure.json"), indent=4) |
|
0 commit comments