QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: Nemthianhoi Zou on July 31, 2025, 09:59

Title: WYCKOFF POSITIONS FROM CRYSTAL STRUCTURE PREDICTION SCRIPTOR
Post by: Nemthianhoi Zou on July 31, 2025, 09:59
Dear Experts,
I need your assistance regarding the output of a crystal structure prediction script. I want to create a structure for a material and have been following the crystal structure prediction tutorial. However, I noticed that the output does not include structural details such as the Wyckoff positions or lattice parameters (a, b, c, and angles α, β, γ).

How can I extract these details from the predicted structures?
Title: Re: WYCKOFF POSITIONS FROM CRYSTAL STRUCTURE PREDICTION SCRIPTOR
Post by: Anders Blom on July 31, 2025, 18:58
What "output" are you referring to? When you press Create it generates a structure in the Builder. This can further be inspected using the various tools in the Builder for instance to see the lattice parameters, but it's true the Wyckoff positions are actually not currently saved.
Title: Re: WYCKOFF POSITIONS FROM CRYSTAL STRUCTURE PREDICTION SCRIPTOR
Post by: Nemthianhoi Zou on August 1, 2025, 06:08
By "output," I’m referring to the structure displayed in the Builder. However, when I click on the HDF5 file, there is no option such as "Create" or "Open in Builder." Although I can view the structure using the "Viewer" and access structural details, I’m unable to export or send the structure directly to the Builder for further modification.
Title: Re: WYCKOFF POSITIONS FROM CRYSTAL STRUCTURE PREDICTION SCRIPTOR
Post by: Anders Blom on August 5, 2025, 11:55
In general you can drop objects on the Builder icon to open them there, but in this case you probably need to Unpack the object first.
Title: Re: WYCKOFF POSITIONS FROM CRYSTAL STRUCTURE PREDICTION SCRIPTOR
Post by: Nemthianhoi Zou on August 5, 2025, 13:58
Dear Anders Blom,

Thank you for your response. However, upon clicking the "Unpack" option, I encountered the following error:

'numpy.float64' object has no attribute 'inUnitsOf'

I would appreciate your guidance on how to resolve this issue.
Title: Re: WYCKOFF POSITIONS FROM CRYSTAL STRUCTURE PREDICTION SCRIPTOR
Post by: Anders Blom on August 12, 2025, 18:48
Interesting. Was this a very long run? If you can share the input file or even output files, we'd be interested in having a look.
Title: Re: WYCKOFF POSITIONS FROM CRYSTAL STRUCTURE PREDICTION SCRIPTOR
Post by: Nemthianhoi Zou on August 12, 2025, 19:14
The simulation was brief, and the code is shown below
# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------

potentialSet = Pedone_2006Fe2()
calculator = TremoloXCalculator(parameters=potentialSet)
calculator.setVerletListsDelta(0.25*Angstrom)

# -------------------------------------------------------------
# Elements
# -------------------------------------------------------------

elements = [Oxygen, Oxygen, Oxygen, Oxygen, Titanium, Titanium]

# -------------------------------------------------------------
# Random Number Generator
# -------------------------------------------------------------

rng = numpy.random.RandomState()

# -------------------------------------------------------------
# Initial Population
# -------------------------------------------------------------

initial_population = generateInitialPopulation(
    elements=elements,
    population_size=10,
    calculator=calculator,
    volume=51.57*Angstrom**3,
    max_forces=0.01*eV/Angstrom,
    max_stress=0.1*GPa,
    max_steps=1000,
    max_step_length=0.2*Angstrom,
    external_pressure=0.0*GPa,
    rng=rng,
    log_filename_prefix="initial_population_",
    )

# -------------------------------------------------------------
# Crystal Structure Prediction
# -------------------------------------------------------------

crystal_structure_prediction = CrystalStructurePrediction(
    initial_population,
    number_of_generations=20,
    selection_pressure=2.0,
    number_of_elites=10,
    number_to_promote=4,
    heredity_probability=50.0,
    permutation_probability=20.0,
    mutation_probability=30.0,
    sigma_lattice=0.7,
    max_forces=0.01*eV/Angstrom,
    max_stress=0.1*GPa,
    max_steps=1000,
    max_step_length=0.2*Angstrom,
    external_pressure=0.0*GPa,
    rng=rng,
    write_population=True,
    log_filename_prefix="generation_",
    )

Title: Re: WYCKOFF POSITIONS FROM CRYSTAL STRUCTURE PREDICTION SCRIPTOR
Post by: Anders Blom on August 13, 2025, 16:20
I'll check on the error you reported, I get it too. But right now, what you can do instead is double-click any of the Population objects in the "generation" files. This will open an instance of the Movie Tool, where you can browse the structures, and for each one send them to the Builder for further analysis and manipulation.

You could also write a short script to extract the configurations from a particular generation, and save in a new file (or same):
Code: python
population = nlread("generation_20.hdf5")[0]
for individual in population:
    nlsave("individuals_20.hdf5", individual.configuration)
Title: Re: WYCKOFF POSITIONS FROM CRYSTAL STRUCTURE PREDICTION SCRIPTOR
Post by: Nemthianhoi Zou on August 14, 2025, 09:19
Thank you for providing the solution. It was really useful.