pyscal / atomRDF

atomRDF is a python tool for ontology-based creation, manipulation, and quering of structures. atomRDF uses the Computational Material Sample Ontology (CMSO).
https://atomrdf.pyscal.org
MIT License
10 stars 2 forks source link

structure creation #135

Closed sepidbgh closed 4 months ago

sepidbgh commented 4 months ago

When you want to use atomrdf implementation with pyiron to create structure, if you do not provide “a” or “covera” or "crystalstructure ", you will get an error which is not a case in pyiron itself.
For example for "Mg", Pyiron database knows that it is hcp structure with a=3.21 and by default covera= sqrt(8/3)

works in pyiron: hcp_Mg_pyiron = pr.create.structure.bulk( name="Mg").repeat([2,2,2]) hcp_Mg_pyiron.cell = Cell([[6.42, 0.0, 0.0], [-3.21, 5.559883092296095, 0.0], [0.0, 0.0, 10.42608]])

atomrdf+pyiron: hcp_Mg = pr.create.structure.annotated_structure.bulk(element="Mg", repetitions=[2,2,2], cubic=False)


TypeError Traceback (most recent call last) Cell In[6], line 1 ----> 1 hcp_Mg = pr.create.structure.annotated_structure.bulk(element="Mg", repetitions=[2,2,2], cubic=False)

File ~/anaconda3/envs/workflow-rdf-v0.2/lib/python3.11/site-packages/atomrdf/workflow/pyiron/pyiron.py:82, in inform_graph..AnnotatedStructureFactory.bulk(self, element, repetitions, crystalstructure, a, covera, cubic, graph, label) 79 if a is None: 80 a = element_dict[element]["lattice_constant"] ---> 82 struct = _make_crystal( 83 crystalstructure, 84 repetitions=repetitions, 85 lattice_constant=a, 86 ca_ratio=covera, 87 element=element, 88 primitive=not cubic, 89 graph=self._graph, 90 label=label, 91 ) 93 ase_structure = struct.write.ase() 94 pyiron_structure = ase_to_pyiron(ase_structure)

File ~/anaconda3/envs/workflow-rdf-v0.2/lib/python3.11/site-packages/atomrdf/structure.py:90, in _make_crystal(structure, lattice_constant, repetitions, ca_ratio, noise, element, primitive, graph, names, label) 48 def _make_crystal( 49 structure, 50 lattice_constant=1.00, (...) 58 label=None, 59 ): 60 """ 61 Create a crystal structure using the specified parameters. 62 (...) 88 The atomrdf.Structure object representing the generated crystal structure. 89 """ ---> 90 atoms, box, sdict = pcs.make_crystal( 91 structure, 92 lattice_constant=lattice_constant, 93 repetitions=repetitions, 94 ca_ratio=ca_ratio, 95 noise=noise, 96 element=element, 97 return_structure_dict=True, 98 primitive=primitive, 99 ) 101 s = System(graph=graph, names=names) 102 s.box = box

File ~/anaconda3/envs/workflow-rdf-v0.2/lib/python3.11/site-packages/pyscal3/structure_creator.py:94, in make_crystal(structure, lattice_constant, repetitions, ca_ratio, noise, element, return_structure_dict, structures, primitive) 91 sdict['box'][2][2] = ca_ratio 93 #from here, the creation starts ---> 94 box = lattice_constant*np.array(sdict["box"])
96 pos = np.array([_unfold_positions(p, box) for p in sdict["positions"]]) 97 pos = np.array([_generate_noise(x, noise) for x in pos])

TypeError: unsupported operand type(s) for *: 'float' and 'NoneType'