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

Feature proposal: automated workflow for temperature induced solid-solid transition #143

Open
stefanhiemer opened this issue Aug 14, 2024 · 10 comments

Comments

@stefanhiemer
Copy link
Contributor

Hi there,

I would like to create a workflow similar as the melting protocol, but it is even easier here as we do not have to check for melting or solidification. The workflow is identical to here, but without the melting checks:

https://calphy.org/en/latest/examples/example_04/analysis.html

If someone fears that his phases transform during transformation, one would have to implement checks, but that may be difficult to set up in a framework that works for arbitrary unit cells / solid phases. Further generalizations of this may be to extend this to composition and pressure variation as in example.

If you agree, I would start editing routines.py and copy the class MeltingTemp. My test case would be a comparison with the manual calculation of the transition temperature in Example 02.

Regards
Stefan

@srmnitc
Copy link
Member

srmnitc commented Aug 14, 2024

Sounds like a great idea to me. An initial version without checks also sound fine to me. I would ba happy to support the implementation as needed. Thanks!

@stefanhiemer
Copy link
Contributor Author

Ok. I would start on friday. Are you available during the day, if I have already a working prototype?

@srmnitc
Copy link
Member

srmnitc commented Aug 14, 2024

Yes, I will be available.

@stefanhiemer
Copy link
Contributor Author

stefanhiemer commented Aug 16, 2024

Three questions:

  1. Where can I add the signature string for mode, that triggers the simulation?
  2. Do I need to add it in the list of this expression?
    for key in ['md', 'queue', 'tolerance', 'melting_temperature', 'nose_hoover', 'berendsen', 'composition_scaling', 'temperature_high']:
  3. Where can i make it a requirement to have to two input lattices?

@srmnitc
Copy link
Member

srmnitc commented Aug 19, 2024

Three questions:

  1. Where can I add the signature string for mode, that triggers the simulation?
  2. Do I need to add it in the list of this expression?
    for key in ['md', 'queue', 'tolerance', 'melting_temperature', 'nose_hoover', 'berendsen', 'composition_scaling', 'temperature_high']:
  3. Where can i make it a requirement to have to two input lattices?

this would be mostly in 'input.py'. I could also take over this part if you wish. We can merge it into a branch and finish up.

  • this where the calculations are started
  • You do not need to add it to the list
  • this is where the checking of the lattice starts. At the moment, it only accounts for 1 lattice. This could be a bit tricky because I did not account for multiple lattices. What could be the better approach is to modify here, and at reading in stage, make two sets of calculations. Therefore all the validation can work without issues. And then in your new class, make sure to run these calculations one by one. Would that make sense?

@stefanhiemer
Copy link
Contributor Author

stefanhiemer commented Aug 19, 2024

Have a look at the current changes I did on my fork:

https://github.com/stefanhiemer/calphy

So far the changes are untested and mostly based on copying the melting temperature routine:

-kicked out the melting check in routines.py
-changed reference from liquid to solid in routines.py
-added some stuff analogue to the melting temperature into input.py

As soon as I understand how to add the signature string, I will start testing/debugging. As string I would suggest transformation_temperature.

@stefanhiemer
Copy link
Contributor Author

Hi Sarath, I just started testing my implementation and encountered an unrelated bug (or a hole in my understanding of calphy). I try this temperature scaling script.
temperature-scaling.txt
should start two calculations for FCC and BCC each, right? But I get this error:

Traceback (most recent call last):
File "/home/shiemer/anaconda3/envs/calphy/bin/calphy", line 33, in
sys.exit(load_entry_point('calphy==1.3.10', 'console_scripts', 'calphy')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/shiemer/anaconda3/envs/calphy/lib/python3.12/site-packages/calphy-1.3.10-py3.12.egg/calphy/kernel.py", line 165, in main
run_jobs(args["input"])
File "/home/shiemer/anaconda3/envs/calphy/lib/python3.12/site-packages/calphy-1.3.10-py3.12.egg/calphy/kernel.py", line 55, in run_jobs
calculations = read_inputfile(inputfile)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/shiemer/anaconda3/envs/calphy/lib/python3.12/site-packages/calphy-1.3.10-py3.12.egg/calphy/input.py", line 556, in read_inputfile
calculations = _read_inputfile(outfile)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/shiemer/anaconda3/envs/calphy/lib/python3.12/site-packages/calphy-1.3.10-py3.12.egg/calphy/input.py", line 568, in _read_inputfile
calculations.append(Calculation(**calc))
^^^^^^^^^^^^^^^^^^^
File "/home/shiemer/anaconda3/envs/calphy/lib/python3.12/site-packages/pydantic/main.py", line 193, in init
self.pydantic_validator.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for Main input class
lattice
Input should be a valid string [type=string_type, input_value=['FCC', 'BCC'], input_type=list]
For further information visit https://errors.pydantic.dev/2.8/v/string_type

Thanks and regards
Stefan

PS: Have you checked out my fork?

@srmnitc
Copy link
Member

srmnitc commented Sep 12, 2024

@stefanhiemer Just about the issue above; this is not supported anymore. You can only have one value in lattice, and have to add a separate calculation for each, like this:

calculations:
- mode: ts
  element: Fe
  lattice: FCC
  mass: 55.845
  md:
    barostat_damping: 0.1
    equilibration_control: nose_hoover
    thermostat_damping: 0.1
    timestep: 0.001
  n_equilibration_steps: 1000
  n_iterations: 1
  n_switching_steps: 1000
  pair_coeff: '* * Fe.eam'
  pair_style: eam
  pressure: 1.0
  queue:
    commands:
    - conda activate calphy
    cores: 1
    scheduler: local
  reference_phase: solid
  temperature:
  - 100.0
  - 1400.0
  tolerance:
    solid_fraction: 0
    liquid_fraction: 0
- mode: ts
  element: Fe
  lattice: BCC
  mass: 55.845
  md:
    barostat_damping: 0.1
    equilibration_control: nose_hoover
    thermostat_damping: 0.1
    timestep: 0.001
  n_equilibration_steps: 1000
  n_iterations: 1
  n_switching_steps: 1000
  pair_coeff: '* * Fe.eam'
  pair_style: eam
  pressure: 1.0
  queue:
    commands:
    - conda activate calphy
    cores: 1
    scheduler: local
  reference_phase: solid
  temperature:
  - 100.0
  - 1400.0
  tolerance:
    solid_fraction: 0
    liquid_fraction: 0

@srmnitc
Copy link
Member

srmnitc commented Sep 12, 2024

A bit incovenient, but the reason was to simply the input for the code, and to make it be able to choose the parameters for each calculation differently. Now, you can only have one simulation in each block.

@srmnitc
Copy link
Member

srmnitc commented Sep 12, 2024

Todo:

  • Update docs to reflect new input file changes
  • Allow multiple lattices for the new mode

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