Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a build function #172

Closed
qzhu2017 opened this issue Nov 22, 2021 · 2 comments
Closed

Add a build function #172

qzhu2017 opened this issue Nov 22, 2021 · 2 comments

Comments

@qzhu2017
Copy link
Collaborator

Sometimes it is useful to build a crystal with exact information

# A short example to explain how to use the build function
from pyxtal import pyxtal
from pyxtal.lattice import Lattice

c = pyxtal()
l = Lattice.from_para(5.62, 5.62, 5.62, 90, 90, 90, ltype='Cubic')

#define the sites as dictionary 
sites = [{"4a": None}, # Na 
         {"4b": None}, # Cl
        ]
c.build(225, ['Na', 'Cl'], [4, 4], lattice=l, sites=sites)
print(c)

#define the sites by position only, pyxtal will attempt to assign the wyckoff sites by itself
sites = [
         [[0, 0, 0]], #list of Na atoms
         [[0.5, 0.5, 0.5]], #list of Cl atoms
        ]
c.build(225, ['Na', 'Cl'], [4, 4], lattice=l, sites=sites)
print(c)

------Crystal from Build------
Dimension: 3
Composition: Na4Cl4
Group: Fm-3m (225)
Cubic lattice:   5.6200   5.6200   5.6200  90.0000  90.0000  90.0000
Wyckoff sites:
	Na @ [ 0.0000  0.0000  0.0000], WP [4a] Site [4/m-32/m]
	Cl @ [ 0.5000  0.5000  0.5000], WP [4b] Site [4/m-32/m]

------Crystal from Build------
Dimension: 3
Composition: Na4Cl4
Group: Fm-3m (225)
Cubic lattice:   5.6200   5.6200   5.6200  90.0000  90.0000  90.0000
Wyckoff sites:
	Na @ [ 0.0000  0.0000  0.0000], WP [4a] Site [4/m-32/m]
	Cl @ [ 0.5000  0.5000  0.5000], WP [4b] Site [4/m-32/m]
@qzhu2017 qzhu2017 mentioned this issue Nov 23, 2021
@pcpatfire
Copy link

Thanks for the .build function. Is it already available from pip install or should I download the library from github?

@qzhu2017
Copy link
Collaborator Author

pip install --upgrade git+https://github.com/qzhu2017/PyXtal.git@master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants