Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Julian Schneider

Pages: 1 [2] 3 4 ... 12
16
General Questions and Answers / Re: M3GNET
« on: January 12, 2024, 22:07 »
Good to hear that it works!
I can understand that the warning can be misleading and we will work on improving that.

Best regards,
Julian

17
General Questions and Answers / Re: M3GNET
« on: January 11, 2024, 20:55 »
Dear Asif,

this message is not necessarily pointing towards an error in the calculation, it just means that the CUDA drivers cannot be initialized.
It could still be that the calculation ran through fine, especially since your calculation ran M3GNet on CPU only.
Could you please double check if the calculations completed ok (meaning that the results files are there and no other error message is written to the log)?
If there are other error messages or a traceback in the log, could you please report them here, then we can let you know how to fix it?

18
General Questions and Answers / Re: M3GNET
« on: January 9, 2024, 17:50 »
Thank you for your question.

Using M3GNet requires the installation of pytorch into QuantumATK first. There are two possibilities how to do that in QuantumATK.

Option 1: Installing pytorch in a python virtual environment (venv, see also https://docs.python.org/3/library/venv.html ):
This is the safe way as it keeps pytorch separated from the QuantumATK installation.

Create a folder with enough space for the venv (we call it $MY_ENV_DIR).
Set up the venv using the python executable in the QuantumATK package:
Code
"$QATK_DIR/atkpython/bin/python" -m venv --system-site-packages "$MY_ENV_DIR"
Activate the venv:
Code
source "$MY_ENV_DIR/bin/activate"
Installing pytorch 2.1
Code
python -m pip install torch==2.1.1 --index-url https://download.pytorch.org/whl/cu118
All simulations need to be run in the activated venv.
The differences to running a simulation via atkpython is:
1. Use the python executable instead of atkpython.
2. Add the line
Code
from QuantumATK import *
at the top of the python script you want to run.
Then M3GNet can be imported and set up like a normal calculator in QuantumATK:
Code
from tremolox.neighborlistcalculator.M3GNetCalculator import TremoloXM3GNetDirectPESCalculator
calculator = TremoloXM3GNetDirectPESCalculator(device='cpu')


Option 2: Installing pytorch directly into the QuantumATK installation.
Although we have not encountered any compatibility issue between pytorch and the external modules in quantumatk, there is still a small risk that this can cause problems. Therefore we recommend making a separate installation of QuantumATK for this. The advantage is that the usage is more straightforward.
Install pytorch using pip:
Code
"$QATK_DIR/atkpython/bin/python -m pip install torch==2.1.1 --index-url https://download.pytorch.org/whl/cu118

In this case scripts can directly be run via atkpython, as one is used to.
M3GNet can be imported and set up like a normal calculator in QuantumATK:
Code
from tremolox.neighborlistcalculator.M3GNetCalculator import TremoloXM3GNetDirectPESCalculator
calculator = TremoloXM3GNetDirectPESCalculator(device='cpu')


To use GPU acceleration one can set
Code
device='cuda'


Note, these instructions are for Linux systems.
For Windows the steps are identical but some of the directories have to be adapted slightly, e.g. replacing bin/ with Scripts/

In case you encounter problems with disc space during installation of pytorch, we recommend to set the environment variables XDG_CACHE_HOME (for the pip cache) and TMPDIR to directories where enough disc space is available.


Hope this helps.

19
Dear Akhil,

as the message says MTP does currently not support using tags to select the subset of atoms it acts on.
In your case I would recommend augmenting the MTP with a D3-dispersion correction, exactly as one would in DFT.
We have a fast force-field-like implementation of the D3-correction which can be combined with other force-fields (https://docs.quantumatk.com/manual/ForceField.html#dispersiond3bj-na-p-sr-ac-pd-ne-ni-f-nd-gd-pt-re-nb-rh-v-rb-at-c-xe-cs-co-cl-ce-yb-hf-ru-b-ra-pb-u-cu-ga-sb-os-au-br-tl-n-s-y-te-bi-ar-eu-pu-po-cr-mg-sc-ir-zn-pr-as-lu-mn-ca-ta-fr-se-ho-ge-rn-h-li-mo-ti-zr-o-er-ag-w-al-tm-ba-hg-tb-be-pm-tc-sm-k-pa-fe-sn-kr-cd-si-la-np-dy-th-in-i-he)


It would work something like this:
Code
# Set up the MTP potential set as you normally would.
potential_set_mtp = TremoloXPotentialSet('MTP')
potential_set_mtp.addParticleType(ParticleType('Mo'))
potential_set_mtp.addParticleType(ParticleType('S'))
potential_set_mtp.addPotential(MTPPotential('mtp_filename.mtp'))

# Use the pre-defined potential set for D3 correction with BJ-damping.
potential_set_d3 = DispersionD3BJ("PBE")

# Merge both potential sets when setting up the calculator
calculator = TremoloXCalculator([potential_set_mtp, potential_set_d3])

This approach will be more accurate than the one based on a LJ potential, because it only adds the missing dispersion contribution to the otherwise accurate MTP.

20
Hi Korand,

Ideally, you should use similar compounds in the training data, so if you would like to generate a MTP for Bi2Se3, then the training data should contain some Bi2Se3 configurations, e.g. from our database, or from the materials project database, which QuamtumATK has a interface to. IT can also make sense to include other compunds, then the trained MTP would be applicable to a broader range of compositions.

For a given crystal structure, we recommend that you use our crystal training protocol https://docs.quantumatk.com/manual/Types/crystalTrainingRandomDisplacements/crystalTrainingRandomDisplacements.html.
A total number of 100-200 configurations per crystal structure are usually enough. The example https://docs.quantumatk.com/manual/Types/crystalTrainingRandomDisplacements/crystalTrainingRandomDisplacements.html#usage-examples should be a good starting point.
You should run this protocol for the relevant crystal structures that you want to include in the training. Then you can combine all these training sets to train a MTP, which should already work well to describe the crystal phases.

To extend the training data to other configurations (e.g. amoprhous, or high temperature) you can run active learning simulations, which generates additional training configurations. This process is described here: https://docs.quantumatk.com/tutorials/mtp_hfo2/mtp_hfo2.html

Hope this helps!

Best regards,
Julian

21
Active learning can be a bit sensitive the size of the MTP basis, especially  if you have only few configurations in the initial training data or all configurations in the training data are relatively similar, which is often the case when you use a realtively short MD trajectory as initial training data.
In that case the given MTP basis can "overdescribe" the training data and the active learning algorithm becomes numerically unstable and cannot reliably select new candidate configurations. This is also what the warning says.

The first thing to try in this case, is to use a lower MTP basis, e.g. 50-100, until the warning disappears.
Once you have collected more training data, you can increase the number of basis functions again.

Alternatively, one can try to sample more different configurations in the initial training data, by running longer MD simulations, or using different initial confgurations for the MD.

22
Hi,

it looks like the issue is that you want to load an MDTrajectory object, but in the nlread() statement you specify a Trajectory object.
It will probably work if you instead use the following line:
Code
# Load another Trajectory object with precalculated data.
trajectory_training_data_input = nlread('KPF6_MD_trajectory_300K_0.1GPa.hdf5', MDTrajectory)[0]

If there is only one object in your file, then you don't need to specify the trajectory type at all.

Hope this fixes it!

23
Dear Korand,

thanks for reporting.
Looks like an issue in the parallelization. We have never encountered this issue in MTP training.
To be able to try and reproduce it and possibly fix it, we would need the script that you have been running and the details of the parallel settings, i.e. how many nodes/cores, ideally also which types of nodes, etc.

Best regards,
Julian

24
Hi,

that's an interesting problem.
Unfortunately it is not possible in QATK to combine 2 different ReaxFF potential using tags, and even if that was possible, there would still be the questions how the layers should interact with each other.

As you mention, machine learned FFs, in particular the Moment Tensor Potential (MTP) in QATK, could be a good alternative for such a system. However, there is some effort associated with training a ML FF. In your case, since you there are no repulsive parameters in your DFT model, you'd have to use DFT (probably with dispersion correction) to generate the training data for the ML model.

In your case the training data would probably consist of the following 3 parts:
Training data for MoS2
Training data for BN
Training data for mixed combined BN / MoS2 system.
All of these can proabbly generated using random displacements around the optimized crystal structure, using the functionality described here:https://docs.quantumatk.com/manual/Types/crystalTrainingRandomDisplacements/crystalTrainingRandomDisplacements.html.
In the end all 3 training sets should be combined in the training of a single MomentTensorPotential using this class:
https://docs.quantumatk.com/manual/Types/MomentTensorPotentialTraining/MomentTensorPotentialTraining.html#momenttensorpotentialtraining-c


The cheaper alternative might be to combine 2 Stillinger-Weber potentials, which should work well to descibe for the interactions in each layer, and add Lennard-Jones potentials for the interactions between the layers. Here, the parameters can be taken e.g. from the universal force field (UFF). I have attached a script with an example for such a potential.
Note, there is one subtlety with such a potential: By default the Lennard-Jones potential would act also between the atoms within a layer, and would be added to the Stillinger-Weber interactions, which should already be sufficient alone. This can be avoided to a large extent by setting static bonds (using e.g. the findBonds() method on the configuration), and setting the bonded_mode parameter in the Lennard-Jones potentials to 'mode_14'. In this case the Lennard-Jones potential would only act between atoms that are separated by at least 3 bonds (see the attached example script for details). In this case the effect of the LJ potential within the layer should be minor, but it still makes sense to check e.g. the optimized lattice constants of each material.

Hope this helps.

25
Hi,

This problem was known to appear in very rare cases, but should have been fixed in the QATK-Q-2019.12 version.
Which QATK version are you using?

Best,
Julian

26
General Questions and Answers / Re: Phonon DOS
« on: September 2, 2020, 10:05 »
Hi,

these fluctuations are not uncommon for Nose-Hoover-like thermostats, especially for small systems like yours. One could try to increase the thermostat timescale or the Nose-Hoover chain length (in script), but this would probably only decrease the fluctuations a bit and with DFT-MD it is probably not so easy to run a few test simulations.

If it is only about the stability of the system at the given temperature, then you could use NVT-Berendsen instead. This should give a much more constant temperature than Nose-Hoover.
Berendsen is a bit more approximate in how exactly the canonical ensemble is reproduced, but just for qualitatively checking the thermal stability it should be ok.

Best,
Julian

27
Hi,

The NEB Builder plugin requires atoms to have the exact same position before constraints can be applied, so this would probably not help in your case.

I think the most straightforward way to fix your problem would be to manually (e.g. in  Coordinate Tools > Coordinate List plugin, see attached image) change the problematic atom positions so that they match in the first and last image.

28
The potential you selected uses a polarization energy term in which the dipole moments on each atom needs to be computed self-consistently via optimization at each MD step
(see e.g. https://docs.quantumwise.com/manual/Types/MaddenParticle/MaddenParticle.html#maddenparticle-c or https://aip.scitation.org/doi/10.1063/1.1513312 ).

In your case the optimization of the dipoles did not meet the convergence criteria, which results in this error message.
Without knowing what system you are looking at I can only speculate that this could be due to that you have an unstable system which is tricky to optimize (i.e. atoms too close,) or not suited for this type of potential.
You could try to pre-optimize it with a simpler potential or use a simpler potential alltogether (if available).

An advanced possibility would be to change the optimization options in the Madden potential by adding a MaddenOptimizationOption to the potential set (see example in https://docs.quantumwise.com/manual/Types/MaddenOptimizationOption/MaddenOptimizationOption.html#maddenoptimizationoption-c
Here the parameters to play around with would be to increase the polMaxIterations (i.e. the max number of optimization iterations, default 200), or to increase the polFTol or polGradTol values (tolerance to stop the optimization, default values 10**-10 and 10**-4)

29
The repetition score is a measure for how many of the atoms in the electrode candidate can be repeated beyond the electrode extension in the central region by translating them by a multiple of the electrode length, minus the number of atoms in the electrode candidate itself.

    As an example: If we have 8 atoms in the electrode candidate, and we find 2 complete
    repetitions of these atoms beyond the electrode extension (translating them by 1*electrode_length, and by 2*electrode_length)
    then the score for this candidate would be 8.
    If we find exactly one complete repetition, the score would be zero.
    If only 4 of the 8 atoms are repeated, the score would be -4.

So, a negative score can still mean that the electrode candidate is suitable, but it is not always guaranteed.

Note that, all this applies to "full" (i.e. not minimal) electrodes.

30
Quote
If I want to make the interface with 3A between two materials, is it correct to put -24.0 as z value as the first picture?
Yes, that should do it.

Quote
With this structure having negative B-Y value, LAMMPS input file showed an error because it yhi value is smaller than ylo value as shown the 2nd.
I think this would be fixed if you edit the LAMMPS file to use ylo -211 and yhi 0, or, if that does not work, to ylo 0 and yhi 211. This would shift the origin of the cell, but then you'd probably also need to change the sign of the xy value in the LAMMPS file  from -121 to 121.. But please double check that the structure in LAMMPS is still the correct one. after this change.

Pages: 1 [2] 3 4 ... 12