Skip to content

Commit

Permalink
Merge pull request #36 from issp-center-dev/getcif_symprec
Browse files Browse the repository at this point in the history
add symprec in option section
  • Loading branch information
aoymt authored Sep 6, 2024
2 parents 741b960 + c5d7273 commit 1be2986
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
11 changes: 11 additions & 0 deletions docs/en/source/getcif/filespec/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ This section contains global settings needed for the first-principles calculatio

When this parameter is set to True, getcif prints the search conditions and exists without connecting to the database. It is useful to check the content of the query.

``symprec`` (default value: 0.1)

This parameter specifies the tolerance in calculating the symmetry of a crystal structure when the structure data are written to a CIF file. By default, 0.1 is specified. When ``symprec`` is set to 0.0, it is treated as if ``symprec`` is unspecified, in which case a CIF file is generated without considering symmetry.

``symprec`` is a parameter that specifies the tolerance used to determine the symmetry of a crystal structure. When calculating the symmetry of a crystal structure, it is essential to consider the slight displacements of atomic positions and the precision of numerical calculations. ``symprec`` controls the allowable range of these displacements and serves as a threshold for deciding whether a symmetry operation should be applied.

If ``symprec`` is set to a smaller value (e.g., 0.01), the symmetry determination becomes more stringent, and even minor displacements in the crystal structure may prevent the application of symmetry operations. This can result in the identification of a lower-symmetry space group. Conversely, if ``symprec`` is set to a larger value (e.g., 1.0), the symmetry determination is more lenient, allowing small displacements to be ignored, which may lead to the recognition of a higher-symmetry space group.

When the ``symmetry`` field is specified in the fields section, the symmetry information determined using the default ``symprec=0.1`` in the Materials Project is obtained and written to a text file (``symmetry``).


properties
--------------------------------

Expand Down
11 changes: 11 additions & 0 deletions docs/ja/source/getcif/filespec/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ option

データベースへの接続は行わず、検索条件を出力して終了します。検索内容の確認を行うことができます。

``symprec`` (デフォルト値: 0.1)

結晶構造データをCIFファイルに出力する際の対称性を判定する許容精度を指定します。デフォルトは 0.1 です。 ``symprec`` に 0.0 を指定した場合は ``symprec`` を指定しないものとして扱い、対称性を考慮しないCIFファイルが生成されます。

``symprec`` は、結晶構造における対称性を判定する際の許容精度(tolerance)を指定するパラメータです。対称性の計算においては、原子位置の微細なずれや数値計算の精度の影響を考慮する必要があります。``symprec`` はこのずれの許容範囲を制御し、対称操作が適用されるかどうかを決定する際の閾値として機能します。

``symprec`` を小さく設定する(例: 0.01)と、対称性の判定がより厳密になり、結晶構造のわずかなずれでも対称操作が適用されない可能性が高まります。その結果、より低い対称性の空間群が得られることがあります。逆に、``symprec`` を大きく設定する(例: 1.0)と、対称性の判定が緩やかになり、わずかなずれが無視され、より高い対称性が認められることがあります。

なお、 ``fields`` セクションで ``symmetry`` を指定すると、Materials Project でデフォルトの ``symprec=0.1`` で判定された対称性の情報を取得し、テキストファイル(symmetry)に出力します。


properties
--------------------------------
検索条件を記述します。
Expand Down
11 changes: 10 additions & 1 deletion src/getcif/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ def _setup_dbinfo(self, info):
def _setup_option(self, info):
self.output_dir = info.get("output_dir", "")
self.dry_run = info.get("dry_run", False)
# symprec: default value 0.1 used in Materials Project to determine symmetry
self.symprec = info.get("symprec", 0.1)
if self.symprec == 0:
self.symprec = None

def _find_query(self, info):
props = self._find_properties(info.get("properties", {}))
Expand Down Expand Up @@ -338,6 +342,8 @@ def _do_query(self, query):

def _do_summary(self, docs, fields):
results = []
symprec = self.symprec

for idx, doc in enumerate(docs):
m_id = str(doc.material_id)
m_formula = doc.formula_pretty
Expand All @@ -352,7 +358,10 @@ def _do_summary(self, docs, fields):
if field == "material_id":
pass
elif field == "structure":
doc.structure.to(Path(data_dir, "structure.cif"), fmt="cif", symprec=0.01)
if symprec is not None:
doc.structure.to(Path(data_dir, "structure.cif"), fmt="cif", symprec=symprec)
else:
doc.structure.to(Path(data_dir, "structure.cif"), fmt="cif")
elif field == "formula_pretty":
with open(Path(data_dir, "formula"), "w", encoding="utf-8") as fp:
fp.write(str(d[field]) + "\n")
Expand Down

0 comments on commit 1be2986

Please sign in to comment.