Skip to content

Conversation

@VsevolodX
Copy link
Member

No description provided.

@VsevolodX VsevolodX changed the title Feature/sof 7782 Feature/SOF-7782 Maxweel displacement Dec 18, 2025
@VsevolodX VsevolodX changed the title Feature/SOF-7782 Maxweel displacement Feature/SOF-7782 Maxwell displacement Dec 18, 2025
if output_path is not None:
with open(output_path, "w") as f:
json.dump(data, f, indent=2)
return data
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

from mat3ra.made.utils import AXIS_TO_INDEX_MAP


class ElementalFunctionHolder(InMemoryEntityPydantic):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reuse FunctionHolder

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AtomicMassDependentFunctionHolder(FunctionHolder)

return displacement.tolist()


def create_maxwell_displacement_function(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be in helpers

is_elemental = isinstance(perturbation_function, ElementalFunctionHolder)

for atom_index, coordinate in enumerate(original_coordinates):
if is_elemental:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove


for coordinate in original_coordinates:
# If func_holder returns a scalar, assume z-axis; otherwise vector
displacement = perturbation_function.apply_function(coordinate)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Send the element symbol together with this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Send the whole material with it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

additional_parameters = perturbation_function.calculate_additional_parameters(material)

in the loop:

displacement = perturbation_function.apply_function(coordinate=coordinate, additional_parameters=additional_parameters)


super().__init__(function=function, variables=variables, **data)

def apply_function(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove atom_index


if self.is_mass_used:
element = material.basis.elements.values[atom_index]
mass = get_atomic_mass_from_element(element)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can get all masses as array in the parent class

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In material analyzer

from .fixtures.bulk import BULK_Si_PRIMITIVE
from .fixtures.slab import SI_CONVENTIONAL_SLAB_001

DISORDER_PARAMETER = 3000.0 # Temperature-like
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the conversion constant and just put a comment that DISORDER_PARAMETER is close to temperature in eV

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

including the effective "spring" constant next to the current state

disorder_parameter: float,
random_seed: Optional[int] = None,
is_mass_used: bool = True,
conversion_constant: float = 2e-3,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be necessary anymore

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes!

@VsevolodX VsevolodX merged commit bdd4484 into main Dec 29, 2025
7 checks passed
@VsevolodX VsevolodX deleted the feature/SOF-7782 branch December 29, 2025 02:30
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

Successfully merging this pull request may close these issues.

3 participants