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

how to visualize the generated results? #60

Open
yuuhaixia opened this issue May 12, 2024 · 20 comments
Open

how to visualize the generated results? #60

yuuhaixia opened this issue May 12, 2024 · 20 comments

Comments

@yuuhaixia
Copy link

Thank you very much for your work, after training the generation task, may I ask how to visualize the generated results?

@JianZhou711
Copy link

JianZhou711 commented May 13, 2024

You have to take the Pytorch file and convert the data using the Crystal class in the code which you can then feed into packages like ASE, nglview, or some other software.

@yuuhaixia
Copy link
Author

class Crystal(object):

def __init__(self, crys_array_dict):
    self.frac_coords = crys_array_dict['frac_coords']
    self.atom_types = crys_array_dict['atom_types']
    self.lengths = crys_array_dict['lengths']
    self.angles = crys_array_dict['angles']
    self.dict = crys_array_dict

...........

Hello, are you referring to this Crystal class below in the compute_metrics.py file? Do I need to run through this evaluation file to visualize my generated results?

If I just run python cdvae/run.py data=perov expname=perov
and
python scripts/evaluate.py --model_path MODEL_PATH --tasks recon gen

Is it possible to get the results of the generated crystals, as well as visualize them?

@yuuhaixia
Copy link
Author

@JianZhou711

@JianZhou711
Copy link

Our workflow included importing the crystal class and using it to convert the PT file then converting the info from that into a poscar before visualizing it with Vesta (example in the attached image). I have experimented with running it on ASE and NGLview without converting poscar and have worked, but I do not have those files atm. There might be a way to do it without the class, but we just determined that was the easiest method.
image

@yuuhaixia
Copy link
Author

Thank you very much for your reply, can you please share the code to convert PT to POSCAR, I keep having problems! @JianZhou711

@yuuhaixia
Copy link
Author

The output of the PT in the generated material does not tell the type of atom, such as whether it is Bi or O, etc., so how should one determine what component the generated material is?

@JianZhou711
Copy link

https://www.dropbox.com/scl/fo/2jrwuphiulv5rkgji8der/AAM_BCKXbj_nbGSmz7owoPc?rlkey=w6hg37silgt4eboooqy4im4jm&st=ydbhn7f5&dl=0

This should answer both questions. I'll leave it up for a few days before deleting it.

@yuuhaixia
Copy link
Author

Thank you really, but I don't understand why I'm getting this error AttributeError: 'Crystal' object has no attribute 'structure'

微信图片_20240516155450

@yuuhaixia
Copy link
Author

@JianZhou711

@JianZhou711
Copy link

That's weird, we never ran into that error when doing test runs with mp-20. Try doing a try-except run instead of a list comprehension and skip all of the ones that ran into an error.

@yuuhaixia
Copy link
Author

Is it something to do with the number of times it was trained, because I only trained 500 epochs, and the output 'atom_types' are all negative. Below is the result of my PT printout, is there any anomaly?
Thanks again!
微信图片_20240517092840
@JianZhou711

@JianZhou711
Copy link

Potentially? I didn't see those issues when I ran, but I did mainly use the mp_20 dataset for trains. I could ask others, but I'm on break for a few weeks. I would recommend just running try excepts and ignoring them before doing another model run to test.

@yuuhaixia
Copy link
Author

If I skip the exception then I will get null value. Can you provide me with a PT file that you have trained and generated, I want to make sure that there is something wrong with my generated data that is causing the visualization not to work. Really thank you very much for replying me multiple times~

微信图片_20240517110823
@JianZhou711

@JianZhou711
Copy link

same dropbox

@yuuhaixia
Copy link
Author

Many thanks to the authors for their contribution and sharing. However, when I am using the PT file you shared for visualization, (I am using VESTA), one of the crystal diagrams I get is as follows: there is no chemical bond link between atoms. May I ask why this is so? Or is there something wrong with @JianZhou711

image

@JianZhou711
Copy link

I am actually not sure. You would probably have to consult with material scientists or the paper. I'd assume some of the elements are just not feasible, but that is just my assumption. We did filter out a vast majority of the PT file to a small list of elements that we feel are realistic and potentially relevant.

@yuuhaixia
Copy link
Author

Thank you again, you really helped me a lot! I wish you all the happiness in the world every day!

@yuuhaixia yuuhaixia reopened this May 23, 2024
@yuuhaixia
Copy link
Author

You mean the crystals that are generated, some are not chemically linked and some are chemically linked are they? @JianZhou711

@JianZhou711
Copy link

Yes, that's what I think is happening. I recommend reaching out to someone with a better grasp of material science instead though. I am not confident since I am on the computational side of things.

@Ati-Da
Copy link

Ati-Da commented Oct 24, 2024

have to consult with material scientists or the paper. I'd assume some of the elements are just not feasible, but that is just my assumption. We did filter out a vast majority of the PT file to a small list of elements that we feel are realistic and potentially relevant.

Could you please share the code for visualization of pt files? @yuuhaixia

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