qzhu2017 / PyXtal

A code to generate atomic structure with symmetry
MIT License
234 stars 59 forks source link

Long time for generation #232

Closed qzhu2017 closed 9 months ago

qzhu2017 commented 9 months ago

from pyxtal import pyxtal

iters = 100
for i in range(iters):
    c = pyxtal()
    #c.from_random(3, 191, ['C'], [18], sites=[['6j', '6j', '6k']], factor=1.0)
    c.from_random(3, 204, ['C'], [90], sites=[['16f', '16f', '16f', '16f', '16f', '8c', '2a']], factor=1.2)
    print(i, c.lattice)

Takes long time to find the wp for the given sites.

qzhu2017 commented 9 months ago

set_sites(self, sites) If site info is provided, call it only once.

134     def set_sites(self, sites):
135         """
136         initialize Wyckoff sites
137 
138         Args:
139             sites: list
140         """
141         # Symmetry sites
142         self.sites = {}
143         for i, specie in enumerate(self.species):
144             if sites is not None and sites[i] is not None and len(sites[i])>0:
145                 self._check_consistency(sites[i], self.numIons[i])
146                 if type(sites[i]) is dict:
147                     self.sites[specie] = []
148                     for item in sites[i].items():
149                         self.sites[specie].append({item[0]: item[1]})
150                 else:
151                     self.sites[specie] = sites[i]
152             else:
153                 self.sites[specie] = None
qzhu2017 commented 9 months ago

Largely fixed. May improve merge function later if necessary.