Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Classifier does not scale with system size #2

Closed
markus1978 opened this issue Mar 3, 2019 · 4 comments
Closed

Classifier does not scale with system size #2

markus1978 opened this issue Mar 3, 2019 · 4 comments

Comments

@markus1978
Copy link

markus1978 commented Mar 3, 2019

matid.Classifier.classify's execution time is definitely above linear to the system size. With 1k+ atoms in the system, we need 1h+ on a decent CPU.

I'll try to look into it myself, but maybe you already have an idea or know about this limitation? Or is there a way to tune the behaviour. The Classifier class seems to have a plethora of thresholds and similar parameter?

@lauri-codes
Copy link
Contributor

lauri-codes commented Mar 3, 2019

Hi @markus1978,

Yes, the classification is definitely above linear in scaling. Even the simplest form of classification that just returns the dimensionality will require calculating the full distance matrix, which scales as O(n^2) with system size n.

The code becomes especially slow when doing full classification for surfaces and 2D systems. Some of that time is controllable by tweaking the default settings to favor speed instead of accuracy. Could be e.g. done by lowering max_cell_size to ~9Å and using pos_tol=[0.5]. The rest of that time could be cut with a more optimized implementation and switching to C++ in a couple of critical places.

If you really need to classify a lot of systems with around 1k atoms, I could do some profiling to identify the bottlenecks and improve on them.

@lauri-codes
Copy link
Contributor

@markus1978,

If you only require the dimensionality from the classifier (0D, 1D, 2D, 3D), you can check out this tutorial. Doing just this will be a lot faster than the full classification when surfaces and 2D materials are involved.

@markus1978
Copy link
Author

markus1978 commented Mar 4, 2019 via email

@lauri-codes
Copy link
Contributor

Ok, great! Please keep me informed about the performance (reopen the issues if needed). The simple dimensionality detection should definitely not take hours for ~1000k atoms.

In general, the more advanced classification performed by the matid.Classifier.classify is not really designed for systems that big. It is meant for systems sizes up to a few hundred atoms. The bigger systems with 1k+ atoms are typically force-field calculations, and their classification is a much more complicated task than what MatID was designed for, as they can represent much more complex systems (solid-liquid interfaces, stacked structures, liquids).

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

No branches or pull requests

2 participants