Closed HamidArianZad closed 1 year ago
Please surround J0'
with double-quotation marks "
as
"J0'" = 1.0
I'm sorry for the document does not mention it. I'll add.
Hi, I tried to introduce the next-nearest neighbor and that of the next-next-nearest neighbor interactions in tenes_simple file and recall them in basic.toml by putting the corresponding interactions in double-quotation marks but the tenes can not recognize neither next-nearest neighbor " J0' " nor next-next-nearest neighbor " J0'' " interactions. I considered a simple square lattice with next-next-nearest neighbor interaction " J0'' " as introduced in the following codes:
class SquareLattice(Lattice):
def __init__(self, param: Dict[str, Any]):
super().__init__(param)
self.type = "square lattice"
self.z = 4
self.skew = 0
L, W = self.L, self.W
if W == 1:
self.skew = 1
assert L > 1
self.latticevector = np.diag([L, W])
vd = self.vdim
self.sublattice.append(SubLattice([vd, vd, vd, vd], is_vacancy=False))
self.sublattice.append(SubLattice([vd, vd, vd, vd], is_vacancy=False))
self.sublattice.append(SubLattice([vd, vd, vd, vd], is_vacancy=False))
self.sublattice.append(SubLattice([vd, vd, vd, vd], is_vacancy=False))
for index in range(L * W):
x, y = index2coord(index, L)
# if self.initial_states == "antiferro":
# if (x + y) % 2 == 0:
# self.sublattice[0].add_site(source)
# else:
# self.sublattice[1].add_site(source)
if x % 2 == 0 and y % 2 == 0:
#
# sublattice A
#
self.sublattice[0].add_site(index)
# self.coords.append(a0 * x + a1 * y)
# 1st neighbors
self.bonds[0][0].append(Bond(index, 1, 0))
self.bonds[0][0].append(Bond(index, 0, 1))
# 3rd neighbors
self.bonds[2][0].append(Bond(index, 2, 0))
elif x % 2 == 1 and y % 2 == 0:
#
# sublattice B
#
self.sublattice[1].add_site(index)
# 1st neighbors
self.bonds[0][0].append(Bond(index, 1, 0))
self.bonds[0][1].append(Bond(index, 0, 1))
elif x % 2 == 0 and y % 2 == 1:
#
# sublattice C
#
self.sublattice[2].add_site(index)
# 1st neighbors
self.bonds[0][0].append(Bond(index, 1, 0))
self.bonds[0][0].append(Bond(index, 0, 1))
# 3rd neighbors
self.bonds[2][0].append(Bond(index, 2, 0))
else:
#
# sublattice D
#
self.sublattice[3].add_site(index)
# 1st neighbors
self.bonds[0][0].append(Bond(index, 1, 0))
self.bonds[0][1].append(Bond(index, 0, 1))
And in basic.toml:
[parameter]
[parameter.general]
is_real = true
[parameter.simple_update]
num_step = 100
tau = 0.01
[parameter.full_update]
num_step = 0
tau = 0.01
[parameter.ctm]
iteration_max = 100
dimension = 10
[lattice]
type = "square lattice"
L = 10
W = 2
virtual_dim = 2
initial = "random"
[model]
type = "spin"
J0 = 1
" J0'' " = 2
J1 = 1
I tried several values " J0'' " = [0, 1, 2] but each time I got the same result for the magnetization that seems to be strange. I thing TeNeS does not recognize double-quotation marks for exchange interactions. Can you please address this problem?
Please drop white spaces from " J0'' "
as "J0''"
.
Thank you for reporting. We will make TeNeS automatically strip these whitespaces.
Thanks! Now it works,
I'm glad to hear that.
Dear TeNeS establishers,
I would like to simulate the 2D honeycomb lattice with nearest and next-nearest-neighbor interactions J0 and J0'. I considered the interaction parameters in the basic.toml file as:
[model] type = "spin" J0 = 1.0 J0' = 1.0
but I receive below error when I try to run the code:
Traceback (most recent call last): File "tutorial_magnetization.py", line 25, in dict_toml = toml.load(f) File "/home/hamid/.local/lib/python3.6/site-packages/toml/decoder.py", line 156, in load return loads(f.read(), _dict, decoder) File "/home/hamid/.local/lib/python3.6/site-packages/toml/decoder.py", line 262, in loads original, i)
toml.decoder.TomlDecodeError: Found invalid character in key name: ' ' '. Try quoting the key name. (line 27 column 3 char 319) h
I considered " J0' " instead of J0' and the code works normally. Could you please let me know that " J0' " also indicates the next-nearest-neighbor interaction?