Skip to content

RuntimeError(msg) #46

@HamidArianZad

Description

@HamidArianZad

Dear NeNeS establishers,

During introducing my own lattice in tenes_simple file I got some errors in tenes_std lines. Please let me know where is the problem and how can I fix this problem.

My own lattice structure is as below figure:

Martini_Kagome_1

The code that I reformed in tenes_simple file is as following:

class KagomeLattice(Lattice):
    def __init__(self, param: Dict[str, Any]):
        super().__init__(param)
        self.type = "kagome lattice"
        self.z = 3

        self.L *= 2
        self.W *= 2

        L, W = self.L, self.W

        self.latticevector = np.array([[1.0, 0.0], [0.5, np.sqrt(3.0) / 2]])
        self.latticevector *= np.array([[L], [W]])

        a0 = np.array([1.0, 0.0])
        a1 = np.array([0.5, np.sqrt(3.0) / 2])
 
        vd = self.vdim
        self.sublattice.append(SubLattice([1, vd, vd, 1]))
        self.sublattice.append(SubLattice([1, 1, vd, vd]))
        self.sublattice.append(SubLattice([vd, 1, 1, vd]))
        self.sublattice.append(SubLattice([vd, vd, 1, 1]))
      
        # Martini lattice 1: 
        for index in range(L * W):
            x, y = index2coord(index, L)

            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))

            elif x % 2 == 1 and y % 2 == 0:
                #
                # sublattice B
                #
                self.sublattice[1].add_site(index)
                self.coords.append(a0 * x + a1 * y)

                # 1st neighbors
                self.bonds[0][1].append(Bond(index, 0, 1))
                self.bonds[0][0].append(Bond(index, -1, 1))

            elif x % 2 == 0 and y % 2 == 1:
                #
                # sublattice C
                #
                self.sublattice[2].add_site(index)
                self.coords.append(a0 * x + a1 * y)

                # 1st neighbors
                self.bonds[0][1].append(Bond(index, -1, 0))

            elif x % 2 == 1 and y % 2 == 1:
                #
                # sublattice D
                #
                self.sublattice[3].add_site(index)
                self.coords.append(a0 * x + a1 * y)

                # 1st neighbors
                self.bonds[0][1].append(Bond(index, 1, 1))


    def cartesian_coordinate(self, x: int, y: int) -> np.ndarray:
        a0 = np.array([1.0, 0.0])
        a1 = np.array([0.5, np.sqrt(3.0) / 2])
        return a0 * x + a1 * y 

In fact, when I consider following sequence for virtual_dim in Sublattices (full connection) everything works normally and I could calculate the magnetization,

self.sublattice.append(SubLattice([vd, vd, vd, vd]))
self.sublattice.append(SubLattice([vd, vd, vd, vd]))
self.sublattice.append(SubLattice([vd, vd, vd, vd]))
self.sublattice.append(SubLattice([vd, vd, vd, vd]))

But my own lattice has just three connections which two of them are counted as virtual_dim. So, I considered below sequence for the virtual_dim of Sublattices:

self.sublattice.append(SubLattice([1, vd, vd, 1]))
self.sublattice.append(SubLattice([1, 1, vd, vd]))
self.sublattice.append(SubLattice([vd, 1, 1, vd]))
self.sublattice.append(SubLattice([vd, vd, 1, 1]))

and I got following error:

martini2.py > output.dat
Traceback (most recent call last):
  File "/home/arian/bin/tenes_std", line 903, in <module>
    model = Model(param)
  File "/home/arian/bin/tenes_std", line 726, in __init__
    self.unitcell = Unitcell(param["tensor"])
  File "/home/arian/bin/tenes_std", line 218, in __init__
    self.load_dict(lat_dict)
  File "/home/arian/bin/tenes_std", line 239, in load_dict
    self.check()
  File "/home/arian/bin/tenes_std", line 360, in check
    raise RuntimeError(msg)
RuntimeError: ERROR: some sites have problems
[INPUT ERROR]
ERROR: cannot find the input file: input_0_500.toml

Traceback (most recent call last):
  File "magnetization_martini2.py", line 50, in <module>
    with open(join("output_{}_{}".format(idx, num_step), "density.dat")) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'output_0_500/density.dat'`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions