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

Question on a different result between ovito and asap implementation #8

Open
jjhjm17 opened this issue Jun 9, 2022 · 3 comments
Open

Comments

@jjhjm17
Copy link

jjhjm17 commented Jun 9, 2022

Dear Dr, Peter Larsen,

I appreciate for developing the polyhedral template matching algorithm, which works well at finite temperature.

Using the algorithm, the local environment of a solid structure was analyzed. Interestingly, ovito and asap implemtation gave different results, and the difference of frequency was around 3 % of total atoms. (Anyway 3 % is a small value.)

Could you please confirm which value is better?

The sturcture is bcc titanium at temperature where bcc titanium is unstable, but hcp titanium is stable. Note that at the temperature where bcc titanium is stable, the proportion of atoms marked as hcp increases, probably because temperature is high.

Do you think that these atoms marked as hcp structures are significant?

The same rmse_max of 0.2 was used. Is there another parameter that should be adjusted?

  1. asap implementation using python

asap3.version
'3.12.8'
Type frequency (max 1): (total 128 atoms)
bcc 0.867
hcp 0.102
fcc 0.016
none 0.016

  1. ovito implementation using ovito gui version 3.7.5 (both free and pro version):
    Type frequency (max 1):
    bcc 0.898
    hcp 0.086
    fcc 0.016
    none 0.000

Attached is structure file.
bcc_Ti.zip

Because I do not know how to use this repository directly, asap and ovito are used.

The code for asap follows and is attached:
get_local_structure_asap.zip

#!/usr/bin/env python3
# polyhedral template matching. Is the local structure bcc or hcp or others?

import os
import numpy as np
from asap3.analysis import PTM
from ase.visualize import view
from ase.io import read

# Ref.: https://wiki.fysik.dtu.dk/asap/Local%20crystalline%20order

# for polyhedral template matching method
rmsd_max = 0.2  # Ang

visualize = False
# visualize = True

# VERBOSE = True
VERBOSE = False


def analyze_polyhedral_template_matching(atoms):
    ptmdata = PTM(atoms, rmsd_max=rmsd_max)
    num_atoms = len(atoms)
    # get unique structures and counts
    structures, counts = np.unique(ptmdata['structure'], return_counts=True)
    frequency = counts / num_atoms
    # Flip so that most frequent structure comes first.
    structures = np.flip(structures)
    frequency = np.flip(frequency)

    # print('Type 0 = none; 1 = FCC; 2 = HCP; 3 = BCC; 4 = Icosahedral; 5 = SC.')
    structures = structures.tolist()
    for index, value in enumerate(structures):
        if value == 0:
            structures[index] = 'none'
        elif value == 1:
            structures[index] = 'fcc'
        elif value == 2:
            structures[index] = 'hcp'
        elif value == 3:
           structures[index] = 'bcc'
        elif value == 4:
            structures[index] = 'icosahedral'
        elif value == 5:
            structures[index] = 'sc'

    print('  Type   frequency (max 1):')
    for index, value in enumerate(structures):
        print(f'  {structures[index]}   {frequency[index]:.3f}')

    if visualize:
        atoms.set_tags(ptmdata['structure'])
        view(atoms)

        # menu -> view, colors -> by tag
        # 3: bcc


print('The result of polyhedral template matching follows. \n')


atoms = read('bcc_Ti.cfg')
analyze_polyhedral_template_matching(atoms)
@pmla
Copy link
Owner

pmla commented Jun 10, 2022

Hi @jjhjm17.
Thank you for raising this issue. ASAP uses an older version of PTM. The version in OVITO has had a lot of updates and bugfixes so I would use that one.

I will try to update the PTM version in ASAP at some point so that there are no discrepancies between them.

@schiotz
Copy link
Collaborator

schiotz commented Jun 10, 2022

I will try to update the PTM version in ASAP at some point so that there are no discrepancies between them.

Hi @pmla ,

I give it a try soon(ish). I am sure you have made a lot of improvements in the meantime. There are some hacks involved in merging the code with Asap, I think I have a recipe somewhere....
/Jakob

@jjhjm17
Copy link
Author

jjhjm17 commented Jun 10, 2022

Dear @pmla and @schiotz,

thank you very much for the reply, that ovito version is the newer version. Because the small difference is expected and is coming from bug fixes, the difference is acceptable for the purpose of analysis, at least for me. For analysis, both values agree closely within 5 % (a small value) and both versions are basically supported by publication, so for me it is sufficient.

Thank you very much!

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

3 participants