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 - AsifShah

Pages: [1] 2 3 ... 15
1
General Questions and Answers / Re: Finetuning MACE
« on: April 1, 2026, 03:06 »
Update:

Turns out increasing Energy/Force/Stress weight in the 2026 version causes this error, at least for my model.
Restricting weights to 30 with learning rate of 0.001 gave excellent finetuned models.



2
General Questions and Answers / Finetuning MACE
« on: March 13, 2026, 02:37 »
Dear Admin,
I am fine-tuning (multi-head) a MACE model "mace-mp-0b3-medium.model" with interface  ~3000 configurations obtained from optimization of various interface structures between two materials. The caculator used to generate the data was LCAO-PAW. However, I observe that the training loss is more than validation loss and it does not converge easily below 2. I am using latest version of QuantumATK Y-2026.03

Code
# %% MACEFittingParameters

model_parameters = MACEModelParameters(
    foundation_model_path='/home/MHeadFineTune/AB_PAW/Model2/mace-mp-0b3-medium.model'
)

replay_finetuning_settings = MACEReplayFinetuningSettings(
    replay_data_filepath='/home/MHeadFineTune/AB_PAW/Model2/mp_traj_combined.xyz',
    number_of_samples=10000,
    replay_subselect_method=MLParameterOptions.REPLAY_SUBSELECT.RANDOM,
    replay_filtering_type=MLParameterOptions.REPLAY_FILTERING.COMBINATIONS,
)

dataset_parameters = ForceFieldDatasetParameters(
    dataset_name=None,
    validation_fraction=0.2,
    isolated_atom_energies=None,
    energy_key='REF_energy',
    forces_key='REF_forces',
    stress_key='REF_stress',
    energy_weight=1,
    forces_weight=100.0,
    stress_weight=1,
    compute_stress=True,
    forces_cap=None,
    replay_finetuning_settings=replay_finetuning_settings,
)

training_parameters = TrainingParameters(
    experiment_name='AB_replay_finetuning',
    batch_size=5,
    max_number_of_epochs=200,
    patience=50,
    device=Automatic,
    random_seed=123,
    number_of_workers=0,
    default_dtype=MLParameterOptions.DTYPE.FLOAT64,
    learning_rate=0.005,
    weight_decay=5e-07,
    restart_from_last_checkpoint=True,
    scheduler_patience=5,
    gradient_clipping_threshold=100,
    save_all_available_model_formats=True,
    additional_parameters=None,
)

mace_fitting_parameters = MACEFittingParameters(
    model_parameters=model_parameters,
    dataset_parameters=dataset_parameters,
    training_parameters=training_parameters,
)
nlsave('GSiO2hBN_Train_model_with_MultiHFine.hdf5', mace_fitting_parameters)


# %% MachineLearnedForceFieldTrainer

machine_learned_force_field_trainer = MachineLearnedForceFieldTrainer(
    fitting_parameters=mace_fitting_parameters,
    training_sets=combined_training_set_training_set_0,
    calculator=cam_AB_training_set_lcao_calculator_0,
    train_test_split=0.9,
    random_seed=None,
    save_model_evaluator=True,
)
machine_learned_force_field_trainer.train()

Log file
Code
Epoch |   Train loss | dataset val. loss | foundation_replay val. loss |
Combined val. loss
    1 |      18.9857 |       9.0502 |       9.6832 |       9.5235
    2 |      16.2392 |       9.5699 |       9.8213 |       9.7579
    3 |      15.9793 |       8.4948 |      14.1380 |      12.7140
    4 |      15.7344 |       7.0205 |       9.3637 |       8.7724
    5 |      15.2174 |       7.4290 |       9.1267 |       8.6983
    6 |      15.1447 |       7.6615 |       9.5313 |       9.0595
    7 |      13.9269 |       7.7902 |       9.3499 |       8.9563
    8 |      14.3858 |       6.9831 |       8.4594 |       8.0869
    9 |      14.6542 |       6.1258 |       9.1843 |       8.4125
   10 |      67.0137 |       7.2914 |       9.0968 |       8.6412
   11 |      14.6468 |       7.3211 |       9.6342 |       9.0505
   12 |      13.7790 |       6.7579 |      72.1496 |      55.6489
   13 |    3348.1013 |       6.4292 |       9.5679 |       8.7759
   14 |      13.6505 |       6.6999 |      13.4243 |      11.7275
   15 |      18.6541 |       4.8157 |       8.1373 |       7.2992
   16 |      10.8260 |       4.5590 |       9.3064 |       8.1084
   17 |      10.2169 |       5.3469 |       8.0607 |       7.3759
   18 |      10.8128 |       4.8280 |       7.9056 |       7.1290
   19 |      44.6345 |       4.8770 |       8.8867 |       7.8749
   20 |      13.1652 |       6.0382 |       8.0510 |       7.5431
   21 |       9.9637 |       5.0135 |       8.2736 |       7.4510
   22 |       9.9831 |       5.1497 |       7.8262 |       7.1508
   23 |       9.9076 |       5.5356 |       8.3363 |       7.6296
   24 |       9.4363 |       5.0831 |       8.0683 |       7.3150
   25 |       9.2744 |       4.0919 |       8.0174 |       7.0269
   26 |       8.5802 |       4.0783 |       7.9753 |       6.9919
   27 |       8.5956 |       3.7595 |       7.9519 |       6.8940
   28 |       7.9154 |       4.1679 |       8.0973 |       7.1057
   29 |       7.9012 |       4.1561 |       8.0263 |       7.0497
   30 |       7.8318 |       3.7461 |       7.9410 |       6.8825
   31 |       7.6374 |       3.7943 |       8.1701 |       7.0659
   32 |       8.1747 |       3.6043 |       8.1010 |       6.9663
   33 |       8.0958 |       3.6114 |       8.4863 |       7.2561
   34 |       7.4335 |       3.9294 |       8.1361 |       7.0746
   35 |       7.4023 |       4.0456 |       8.1316 |       7.1006
   36 |       7.2933 |       3.7167 |       8.4425 |       7.2500
   37 |       7.0873 |       3.3984 |       8.2840 |       7.0512
   38 |       6.3931 |       3.4524 |       8.4852 |       7.2152
   39 |       6.6867 |       3.2221 |       8.5646 |       7.2165
   40 |       6.4043 |       3.3317 |       8.5464 |       7.2305
   41 |       6.6129 |       3.1848 |       8.6768 |       7.2910
   42 |       6.4041 |       3.3490 |       8.6733 |       7.3298
   43 |       6.3622 |       3.0963 |       8.7256 |       7.3051
   44 |       6.0477 |       3.0227 |       8.8481 |       7.3782
   45 |       5.9473 |       3.0272 |       8.8475 |       7.3789
   46 |       5.9198 |       3.0129 |       8.8019 |       7.3411

3
Hi,

Just a small suggestion. Instead of going with MTP, I would suggest fine-tuning a MACE mode which is more accurate than MTP. The fine tuning is also very simple. You can go throught his tutorial.

 "https://docs.quantumatk.com/tutorials/mace-training-c-am-TiSi/mace-training-c-am-TiSi.html"

4
On the same note,

I am using RTX 6000 Ada but there is no speedup. The CPU runs faster than GPU.
Any idea, why? Will these issues be resolved in next version of QATK?

5
General Questions and Answers / Re: DFT Phonon Transmission
« on: November 2, 2025, 09:18 »
Hi
I fine tuned MACE with additional data as per my requirement and when run on GPU, it is very very slow. It has been one day it shows only two progress cells in phonon transmission. The total size is 928 atoms

Is this normal?

6
Dear Admin,
I am trying to launch a simulation from SLURM. It shows active status on squeue but the log file is empty for long time.
I m using latest QuantumATK X.2025.06.

Kindly help in this regard!

7
Hi kaihuang,

Can you check with these quick fixes for the file D0_BulkDevice.py

1. Increase electrode extension.
2. Use k_point_sampling = MonkhorstPackGrid(na=12, nc=300).
3. Use medium basis set.



8
General Questions and Answers / Re: DFT Phonon Transmission
« on: September 3, 2025, 20:03 »
Thanks. I will take a look into universal forcefields.

9
Ah, just follow up. It turned out I had to choose the polarization average rather than polarization in/out. That worked, qualitatively atleast.

10
Hi,

Try closing and reopening QuantumATK. Also, make sure you have selected right folder under project icon (Top left)

11
Hi Pshinyeong,
From what I see you have commented the following lines:
#mpirun ~/QuantumATK23/quantumatk/V-2023.09/bin/atkpython_system-mpi $PYTHON_SCRIPT > $LOG_FILE
#mpirun /home/edrl_05/QuantumATK/QuantumATK-U-2022.12-SP1/bin/atkpython $PYTHON_SCRIPT > $LOG_FILE

Also, instead of using mpirun, I would recommend using QATK inbuilt mpiexec.hydra for parallelization and atkpython for execution.
Also, you need to update the paths, so your SLURM script will look something like this:
Code
#!/bin/bash

#SBATCH --job-name=QuantumATK
#SBATCH --ntasks=60
#SBATCH --ntasks-per-node=60
#SBATCH --nodes=1
#SBATCH --cpus-per-task=1
#SBATCH --output=%x-%j.out
#SBATCH --error=%x-%j.err
#SBATCH --partition=normal
#SBATCH --mem=210GB
#SBATCH --nodelist=n16,n15,n14

cd $SLURM_SUBMIT_DIR
export ATK=/home/edrl_05/QuantumATK/quantumatk/X-2025.06/bin/atkpython
export MPI=/home/edrl_05/QuantumATK/quantumatk/X-2025.06/mpi/bin/mpiexec.hydra
export MPIE=/home/edrl_05/QuantumATK/quantumatk/X-2025.06/mpi/bin/mpiexec
export MKL_DYNAMIC=TRUE
export OMP_NUM_THREADS=1
export MKL_NUM_THREADS=1
export LM_LICENSE_FILE="path"
export SNPSLMD_LICENSE_FILE="path"

${MPI} ${ATK} in.py > out.log

12
If 0.01 also gives convergence issues.. try 0.01 or 0.02 with history steps reduced 12

13
What I understand is that you want to do NPT while fixing X and Y directions.
I think this is not possible.
Instead, what you can do is to use a NVT ensemble with vacuum in z direction. This will allow your system to relax in z direction but again this has some artifacts. One is that there will be surface effects at the termination in z direction. And one way to avoid that is using rigid atom constraint there.

14
Hi,
In MD block, you can then use NVT ensemble if you want to fix cell vectors. If you use NPT it will allow volume to change during MD.

15
Dear Admin,
I am trying to calculate Raman Spectrum of monolayer MoS2. But I only see one peak around 396 cm^-1 whereas the experimental peaks are around 385 and 403 cm^-1. Kindly clarify the issue. I also tried changing polarization direction to 100. That gives three peaks but incorrect also. The script is as follows:

Code
# %% Molybdenite (1)

# Set up lattice
lattice = Hexagonal(3.1604*Angstrom, 40.0*Angstrom)

# Define elements
elements = [Molybdenum, Sulfur, Sulfur]

# Define coordinates
fractional_coordinates = [[ 0.333333333333,  0.666666666667,  0.5           ],
                          [ 0.666666666667,  0.333333333333,  0.460348625   ],
                          [ 0.666666666667,  0.333333333333,  0.539651375   ]]

# Set up configuration
molybdenite_1 = BulkConfiguration(
    bravais_lattice=lattice,
    elements=elements,
    fractional_coordinates=fractional_coordinates
    )

molybdenite_1_name = "Molybdenite (1)"


# %% Set LCAOCalculator

# %% LCAOCalculator

# ----------------------------------------
# Basis Set
# ----------------------------------------
basis_set = [
    BasisGGASG15.Sulfur_High,
    BasisGGASG15.Molybdenum_High,
]

k_point_sampling = MonkhorstPackGrid(na=13, nb=13)

numerical_accuracy_parameters = NumericalAccuracyParameters(
    density_mesh_cutoff=120.0 * Hartree, k_point_sampling=k_point_sampling
)

calculator = LCAOCalculator(
    basis_set=basis_set,
    numerical_accuracy_parameters=numerical_accuracy_parameters,
    checkpoint_handler=NoCheckpointHandler,
)


# %% Set Calculator

molybdenite_1.setCalculator(calculator)

molybdenite_1.update()

nlsave('Raman_SG15High.hdf5', molybdenite_1)


# %% OptimizeGeometry

restart_strategy = RestartFromTrajectory(
    trajectory_filename='Raman_SG15High.hdf5',
    object_id='optimize_trajectory',
)

optimized_configuration = OptimizeGeometry(
    configuration=molybdenite_1,
    max_forces=0.01 * eV / Angstrom,
    constraints=[FixStrain(True, True, True)],
    trajectory_filename='Raman_SG15High.hdf5',
    trajectory_object_id='optimize_trajectory',
    optimize_cell=False,
    restart_strategy=restart_strategy,
)

nlsave('Raman_SG15High.hdf5', optimized_configuration, object_id='optgeom')


# %% DynamicalMatrix

dynamical_matrix = DynamicalMatrix(
    configuration=optimized_configuration,
    filename='Raman_SG15High.hdf5',
    object_id='dm',
    calculator=calculator,
)
dynamical_matrix.update()


# %% SusceptibilityDerivatives

kpoints = MonkhorstPackGrid(na=23, nb=23, nc=2)

susceptibility_derivatives = SusceptibilityDerivatives(
    configuration=optimized_configuration,
    filename='Raman_SG15High.hdf5',
    object_id='sd',
    kpoints=kpoints,
)

susceptibility_derivatives.update()


# %% RamanSpectrum

raman_spectrum = RamanSpectrum(
    configuration=optimized_configuration,
    dynamical_matrix=dynamical_matrix,
    susceptibility_derivatives=susceptibility_derivatives,
    polarization_in=(0.0, 0.0, 1.0),
    polarization_out=(0.0, 0.0, 1.0),
    number_of_angles=None,
    polarization_orthogonal=None,
)
nlsave('Raman_SG15High.hdf5', raman_spectrum)

Pages: [1] 2 3 ... 15