# How to keep the freedom of an atom along a specific direction in VASP?

I am trying to relax my model's structure by letting some atoms could move freely along some specific direction, in VASP, I could set selective dynamics, but it seems I could only adjust the freedom along with three different lattice directions, so what should I do if I wanna choose a special direction?

Autosave\of\TiO2_mp-2657_compute\(1\1\0)\(2)
1.0
+11.8767995834  +0.0000000000  +0.0000000000
+0.0000000000 +13.1613998413  +0.0000000000
+0.0000000000  +0.0000000000 +33.4453010559
Ti O H C
64 128 8 8
Selective
Direct
+0.1250000000  +0.2500000000  +0.1880100070  F F F
+0.1250000000  +0.0000000000  +0.2863900070  F F F
+0.1250000000  +0.2500000000  +0.3847799900  T T T
+0.1250000000  +0.0000000000  +0.4831599890  T T T
+0.0000000000  +0.0000000000  +0.1880100070  F F F
+0.0000000000  +0.2500000000  +0.2863900070  F F F

$$$$

• The only way to do that , orient your crystal in such a way the relaxation direction lies along X, Y or Z. If I am not wrong you are trying to avoid shear distortion on doing so. Jan 7 at 13:24

This is related to your other question, you are correct VASP only supports fixing atoms along the X, Y, and Z axis. You can use ASE optimizers with the FixLine or FixPlane constraints to do this. You just specify which atoms are constrained and which direction they are constrained to move in.
Just be aware, ASE running VASP is slower than VASP running its own optimizer. You can offset this by outputting the CHGCAR/WAVECAR or by using the VaspInteractive` calculator in ASE if the cell is not changing.