Skip to content

Commit

Permalink
Merge pull request #71 from issp-center-dev/temperatures
Browse files Browse the repository at this point in the history
New option for generating temperature points as beta space
  • Loading branch information
yomichi authored Oct 25, 2024
2 parents 9ba4cc9 + 7b58f3d commit 16e5aca
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion abics/sampling/mc_mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def __init__(
self.write_node = write_node
self.T2E = T2E
self.E2T = 1.0 / T2E
self.kTs = [T2E * T for T in kTs]
self.kTs = np.array([T2E * T for T in kTs])

## mycalc.kT and mycalc.config should be set later
myconfig = configs[0]
Expand Down
5 changes: 4 additions & 1 deletion abics/sampling/pamc.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ def from_dict(cls, d):
kTstart = d["kTstart"]
kTend = d["kTend"]
kTnum = d["kTnum"]
params.kTs = np.linspace(kTstart, kTend, kTnum)
if d.get("linspace_in_beta", False):
params.kTs = 1.0 / np.linspace(1.0 / kTstart, 1.0 / kTend, kTnum)
else:
params.kTs = np.linspace(kTstart, kTend, kTnum)

if "nsteps_between_anneal" in d:
params.nsteps = d["nsteps_between_anneal"] * kTnum
Expand Down
5 changes: 4 additions & 1 deletion abics/sampling/rxmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ def from_dict(cls, d):
else:
kTstart = d["kTstart"]
kTend = d["kTend"]
params.kTs = np.linspace(kTstart, kTend, params.nreplicas)
if d.get("linspace_in_beta", False):
params.kTs = 1.0 / np.linspace(1.0 / kTstart, 1.0 / kTend, params.nreplicas)
else:
params.kTs = np.linspace(kTstart, kTend, params.nreplicas)
params.nsteps = d["nsteps"]
params.RXtrial_frequency = d.get("RXtrial_frequency", 1)
params.sample_frequency = d.get("sample_frequency", 1)
Expand Down
2 changes: 1 addition & 1 deletion abics/sampling/simple_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def __init__(
kTs = [kTs] * self.procs
self.T2E = T2E
self.E2T = 1.0 / T2E
self.kTs = [T2E * T for T in kTs]
self.kTs = np.array([T2E * T for T in kTs])
self.model = model
self.nreplicas = len(configs)
self.write_node = write_node
Expand Down
10 changes: 10 additions & 0 deletions docs/sphinx/en/source/inputfiles/parameter_sampling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Keywords

- Specify temperature points by using ``kTs`` or ``kTstart``, ``kTend``, and ``kTnum`` (lineary spaced).
If ``kTs`` is specified, the others will be ignored.
- Temperatures should be given in the unit of Kelvin.

- ``kTs``

Expand Down Expand Up @@ -70,6 +71,15 @@ Keywords
The number of temperature points.
When ``sampler = "RXMC"``, the number of temperature points will equal to ``nreplicas``.

- ``linspace_in_beta``

**Format :** true or false

**Description :**
If true, temperature points are generated in the inverse temperature space with equal intervals.
If false, temperature points are generated in the temperature space with equal intervals.
Default value = false.

- About replica

- ``nprocs_per_replica``
Expand Down
12 changes: 11 additions & 1 deletion docs/sphinx/ja/source/inputfiles/parameter_sampling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

- 温度点は ``kTs`` を用いて陽に指定するか、 ``kTstart`` と ``kTend`` とを用いて等間隔に自動生成するかのどちらかで指定します。
両方指定した場合、 ``kTs`` が優先されます.
- 温度はケルビンを単位とした絶対温度で指定します.

- ``kTs``

Expand Down Expand Up @@ -70,7 +71,16 @@
**説明 :**
温度点の数.
``sampler = "PAMC"`` のときに使用.
``sampler = "RXMC"`` のときは、 レプリカ数 ``nreplicas`` と同じ値になります.
``sampler = "RXMC"`` のときは、 レプリカ数 ``nreplicas`` が温度点の数になります.

- ``linspace_in_beta``

**形式 :** true or false

**説明 :**
true の場合、温度点を生成する時に、逆温度空間で等間隔に生成します.
false の場合、温度空間で等間隔に生成します.
デフォルト値 = false.


- レプリカに関する指定
Expand Down

0 comments on commit 16e5aca

Please sign in to comment.