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

Specify custom tolerance matrix in from_random() #166

Closed
Evmoerman opened this issue Nov 2, 2021 · 1 comment
Closed

Specify custom tolerance matrix in from_random() #166

Evmoerman opened this issue Nov 2, 2021 · 1 comment

Comments

@Evmoerman
Copy link

Dear ladies and gentlemen,

I would like to generate random 3D-bulk crystals using custom inter-atomic distances for the distance-check.
In the documentation under "Optional parameters",
it is explained that that can be achieved by defining a new Tol_matrix object and passing it to from_random() for example via:

crystal = pyxtal()
crystal.from_random(3, 12, ['C','N'], [2,4], tm=tol_m_1)

However, when trying this, I receive an error, stating that tm is not an existing keyword of from_random().
TypeError: from_random() got an unexpected keyword argument 'tm'

Is that part of the documentation outdated?
Is there actually a possibility to pass a tolerance matrix to from_random()?

Thanks in advance.

Kind regards,
Evgeny

qzhu2017 added a commit that referenced this issue Nov 4, 2021
@qzhu2017
Copy link
Collaborator

qzhu2017 commented Nov 4, 2021

@Evmoerman
This issue has been resolved. Please try to update the code and reinstall it.

Run the following script:

from pyxtal import pyxtal
from pyxtal.tolerance import Tol_matrix
xtal = pyxtal()
xtal.from_random(3, 12, ['C','N'], [2,4])
print(xtal)

xtal = pyxtal()
tol_m = Tol_matrix()
tol_m.set_tol('C', 'N', 2.0)
print(tol_m)
xtal.from_random(3, 12, ['C','N'], [2,4], tm=tol_m)
print(xtal)

You will see the following output:


------Crystal from random------
Dimension: 3
Composition: C2N4
Group: C2/m (12)
monoclinic lattice:   5.7468   2.1158   3.7166  90.0000  84.8496  90.0000
Wyckoff sites:
	 C @ [ 0.0000  0.0000  0.0000], WP [2a] Site [.2/m.]
	 N @ [ 0.6692  0.0000  0.5282], WP [4i] Site [.m.]

--Tol_matrix class object--
Prototype: atomic
Atomic radius type: covalent
Radius scaling factor: 0.5
Custom tolerance values:
C-N:  2.000

------Crystal from random------
Dimension: 3
Composition: C2N4
Group: C2/m (12)
monoclinic lattice:   5.1097   2.6992   4.0948  90.0000  80.2407  90.0000
Wyckoff sites:
	 C @ [ 0.0000  0.5000  0.5000], WP [2d] Site [.2/m.]
	 N @ [ 0.2476  0.0000  0.9665], WP [4i] Site [.m.]

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